home: do not collect immediately on recreate
Do not use collectImmediately when recreating tabs in the home menu. This resulted in an issue where the ViewPager would not update to reflect the new tab layout.
This commit is contained in:
parent
5b70295330
commit
67ef667080
2 changed files with 2 additions and 5 deletions
|
@ -142,7 +142,7 @@ class HomeFragment : ViewBindingFragment<FragmentHomeBinding>(), Toolbar.OnMenuI
|
|||
// --- VIEWMODEL SETUP ---
|
||||
|
||||
collect(homeModel.isFastScrolling, ::updateFastScrolling)
|
||||
collectImmediately(homeModel.recreateTabs, ::handleRecreateTabs)
|
||||
collect(homeModel.recreateTabs, ::handleRecreateTabs)
|
||||
collectImmediately(homeModel.currentTab, ::updateCurrentTab)
|
||||
collectImmediately(indexerModel.state, ::handleIndexerState)
|
||||
collect(navModel.exploreNavigationItem, ::handleNavigation)
|
||||
|
|
|
@ -22,7 +22,6 @@ import android.content.Context
|
|||
import android.net.Uri
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -276,9 +275,7 @@ class PlaybackViewModel(application: Application) :
|
|||
|
||||
// --- SAVE/RESTORE FUNCTIONS ---
|
||||
|
||||
/**
|
||||
* Force save the current [PlaybackStateManager] state to the database.
|
||||
*/
|
||||
/** Force save the current [PlaybackStateManager] state to the database. */
|
||||
fun savePlaybackState(context: Context, onDone: () -> Unit) {
|
||||
viewModelScope.launch {
|
||||
playbackManager.saveState(PlaybackStateDatabase.getInstance(context))
|
||||
|
|
Loading…
Reference in a new issue