Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
Fix saving fab state on activity recreation (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
vase4kin committed Apr 19, 2020
1 parent f98d1ed commit 9b5e1b4
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class HomePresenterImpl @Inject constructor(
val selectedTab = savedInstanceState.getInt(ARG_SELECTED_TAB)
AppNavigationItem.values().getOrNull(selectedTab)?.let {
bottomNavigationView.setTitle(it.title)
onTabSelected(it.ordinal)
}
}
// Load notifications
Expand Down Expand Up @@ -143,6 +144,12 @@ class HomePresenterImpl @Inject constructor(
}
val titleRes = AppNavigationItem.values()[position].title
bottomNavigationView.setTitle(titleRes)
onTabSelected(position)
loadNotificationsCount()
view.dimissSnackbar()
}

private fun onTabSelected(position: Int) {
when (position) {
AppNavigationItem.FAVORITES.ordinal -> {
showFavoritesPrompt()
Expand All @@ -162,8 +169,6 @@ class HomePresenterImpl @Inject constructor(
}
else -> bottomNavigationView.hideFab()
}
loadNotificationsCount()
view.dimissSnackbar()
}

private fun trackTabSelection(position: Int) {
Expand Down

0 comments on commit 9b5e1b4

Please sign in to comment.