🌟 add StateRestorationPolicy to feed

This commit is contained in:
theapache64
2020-05-09 18:41:11 +05:30
parent 18b86d3a7a
commit b98005a9a3
3 changed files with 27 additions and 5 deletions

View File

@ -70,7 +70,9 @@ dependencies {
implementation "androidx.core:core-ktx:$ktx_version"
implementation "androidx.constraintlayout:constraintlayout:$constraint_version"
implementation "com.google.android.material:material:$material_version"
implementation "androidx.activity:activity-ktx:1.2.0-alpha03"
implementation "androidx.activity:activity-ktx:1.2.0-alpha04"
implementation "androidx.recyclerview:recyclerview:1.2.0-alpha03"
// Coroutines
def coroutines_version = '1.3.5'
@ -91,7 +93,7 @@ dependencies {
// Retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.1'
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version"
// Moshi
@ -132,7 +134,7 @@ dependencies {
testImplementation "androidx.test.espresso:espresso-contrib:$espresso_version"
testImplementation 'androidx.test:runner:1.2.0'
testImplementation 'androidx.test:rules:1.2.0'
testImplementation "androidx.fragment:fragment-testing:1.3.0-alpha03"
testImplementation "androidx.fragment:fragment-testing:1.3.0-alpha04"
testImplementation "org.robolectric:robolectric:4.3.1"
testImplementation 'com.github.fabioCollini.daggermock:daggermock:0.8.5'
testImplementation 'com.github.fabioCollini.daggermock:daggermock-kotlin:0.8.5'
@ -147,9 +149,8 @@ dependencies {
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation "org.mockito:mockito-core:$mockito_version"
androidTestImplementation "org.mockito:mockito-android:$mockito_version"
androidTestImplementation "androidx.fragment:fragment-testing:1.3.0-alpha03"
androidTestImplementation "androidx.fragment:fragment-testing:1.3.0-alpha04"
androidTestImplementation 'com.github.fabioCollini.daggermock:daggermock:0.8.5'
androidTestImplementation 'com.github.fabioCollini.daggermock:daggermock-kotlin:0.8.5'
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
}

View File

@ -11,6 +11,7 @@ import androidx.core.app.ActivityOptionsCompat
import androidx.core.util.Pair
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.RecyclerView
import com.theapache64.topcorn.R
import com.theapache64.topcorn.data.remote.Movie
import com.theapache64.topcorn.databinding.ActivityFeedBinding
@ -72,6 +73,8 @@ class FeedActivity : BaseAppCompatActivity(), FeedHandler {
goToMovieActivity(movie, poster, title)
}.apply {
setHasStableIds(true)
stateRestorationPolicy =
RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY
}
},
{ position ->

18
gpm.json Normal file
View File

@ -0,0 +1,18 @@
{
"added": [
{
"id": 1,
"type": "implementation",
"installed_name": "recyclerview",
"gpm_dep": {
"artifact_id": "recyclerview",
"default_type": "implementation",
"docs": "https://mvnrepository.com/artifact/androidx.recyclerview/recyclerview",
"get_from": "Google",
"group_id": "androidx.recyclerview",
"name": "Android Support RecyclerView V7",
"description": "Android Support RecyclerView v7"
}
}
]
}