fix from pr (#801)

This commit is contained in:
firelight 2023-12-09 14:04:26 +00:00 committed by GitHub
parent 2d87983eca
commit 3ef8f3030c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 3 deletions

View file

@ -398,7 +398,7 @@ class LibraryFragment : Fragment() {
0, 0,
viewpager.adapter?.itemCount ?: 0 viewpager.adapter?.itemCount ?: 0
) )
binding?.viewpager?.setCurrentItem(libraryViewModel.currentPage, false) binding?.viewpager?.setCurrentItem(libraryViewModel.getTabPosition().value ?: 0, false)
// Only stop loading after 300ms to hide the fade effect the viewpager produces when updating // Only stop loading after 300ms to hide the fade effect the viewpager produces when updating
// Without this there would be a flashing effect: // Without this there would be a flashing effect:

View file

@ -41,8 +41,6 @@ class LibraryViewModel : ViewModel() {
private val _pages: MutableLiveData<Resource<List<SyncAPI.Page>>> = MutableLiveData(null) private val _pages: MutableLiveData<Resource<List<SyncAPI.Page>>> = MutableLiveData(null)
val pages: LiveData<Resource<List<SyncAPI.Page>>> = _pages val pages: LiveData<Resource<List<SyncAPI.Page>>> = _pages
var currentPage: Int = 0
private val _currentApiName: MutableLiveData<String> = MutableLiveData("") private val _currentApiName: MutableLiveData<String> = MutableLiveData("")
val currentApiName: LiveData<String> = _currentApiName val currentApiName: LiveData<String> = _currentApiName