Try to pop up to home if it exists on stack from browserfragment

nightly-build-test
ekager 5 years ago committed by Emily Kager
parent 40f2fe5166
commit 0e64ead75c

@ -57,7 +57,7 @@ class ToolbarIntegration(
{
toolbar.hideKeyboard()
// We need to dynamically add the options here because if you do it in XML it overwrites
val options = NavOptions.Builder().setPopUpTo(R.id.browserFragment, false)
val options = NavOptions.Builder().setPopUpTo(R.id.homeFragment, true)
.setEnterAnim(R.anim.fade_in).setExitAnim(R.anim.fade_out).build()
val extras =
FragmentNavigator.Extras.Builder()
@ -66,8 +66,10 @@ class ToolbarIntegration(
"$TAB_ITEM_TRANSITION_NAME${sessionManager.selectedSession?.id}"
)
.build()
Navigation.findNavController(toolbar)
.navigate(R.id.action_browserFragment_to_homeFragment, null, options, extras)
val navController = Navigation.findNavController(toolbar)
if (!navController.popBackStack(R.id.homeFragment, false)) {
navController.navigate(R.id.action_browserFragment_to_homeFragment, null, options, extras)
}
},
isPrivate
)

@ -48,8 +48,8 @@ import org.mozilla.fenix.R
import org.mozilla.fenix.collections.CreateCollectionViewModel
import org.mozilla.fenix.collections.SaveCollectionStep
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.allowUndo
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.urlToTrimmedHost
import org.mozilla.fenix.home.sessioncontrol.CollectionAction
@ -220,14 +220,6 @@ class HomeFragment : Fragment(), CoroutineScope, AccountObserver {
override fun onResume() {
super.onResume()
val homeViewModel = activity?.run {
ViewModelProviders.of(this).get(HomeScreenViewModel::class.java)
}
homeViewModel?.layoutManagerState?.also { parcelable ->
sessionControlComponent.view.layoutManager?.onRestoreInstanceState(parcelable)
}
homeLayout?.progress =
if (homeViewModel?.motionLayoutProgress ?: 0F > MOTION_LAYOUT_PROGRESS_ROUND_POINT) 1.0f else 0f
(activity as AppCompatActivity).supportActionBar?.hide()
requireComponents.backgroundServices.accountManager.register(this, owner = this)

Loading…
Cancel
Save