Fixes Crash: Pop up to Browser Fragment if exists when coming from Search
parent
8dbed67f7f
commit
18cd9e58f9
|
@ -187,8 +187,13 @@ open class HomeActivity : AppCompatActivity() {
|
|||
val directions = when (from) {
|
||||
BrowserDirection.FromGlobal -> NavGraphDirections.actionGlobalBrowser(customTabSessionId)
|
||||
BrowserDirection.FromHome -> HomeFragmentDirections.actionHomeFragmentToBrowserFragment(customTabSessionId)
|
||||
BrowserDirection.FromSearch ->
|
||||
SearchFragmentDirections.actionSearchFragmentToBrowserFragment(customTabSessionId)
|
||||
BrowserDirection.FromSearch -> {
|
||||
if (!navHost.navController.popBackStack(R.id.browserFragment, false)) {
|
||||
SearchFragmentDirections.actionSearchFragmentToBrowserFragment(customTabSessionId)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
BrowserDirection.FromSettings ->
|
||||
SettingsFragmentDirections.actionSettingsFragmentToBrowserFragment(customTabSessionId)
|
||||
BrowserDirection.FromBookmarks ->
|
||||
|
@ -208,7 +213,9 @@ open class HomeActivity : AppCompatActivity() {
|
|||
if (sessionObserver == null)
|
||||
sessionObserver = subscribeToSessions()
|
||||
|
||||
navHost.navController.navigate(directions)
|
||||
directions?.let {
|
||||
navHost.navController.navigate(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun load(searchTermOrURL: String, newTab: Boolean, engine: SearchEngine?, forceSearch: Boolean) {
|
||||
|
|
|
@ -120,6 +120,10 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
postponeEnterTransition()
|
||||
sharedElementEnterTransition =
|
||||
TransitionInflater.from(context).inflateTransition(android.R.transition.move).setDuration(
|
||||
SHARED_TRANSITION_MS
|
||||
)
|
||||
job = Job()
|
||||
}
|
||||
|
||||
|
@ -180,11 +184,6 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
sharedElementEnterTransition =
|
||||
TransitionInflater.from(context).inflateTransition(android.R.transition.move).setDuration(
|
||||
SHARED_TRANSITION_MS
|
||||
)
|
||||
startPostponedEnterTransition()
|
||||
|
||||
QuickActionComponent(
|
||||
|
|
|
@ -58,7 +58,8 @@
|
|||
<action
|
||||
android:id="@+id/action_searchFragment_to_browserFragment"
|
||||
app:destination="@id/browserFragment"
|
||||
app:popUpTo="@id/homeFragment" />
|
||||
app:popUpTo="@id/searchFragment"
|
||||
app:popUpToInclusive="true" />
|
||||
<argument
|
||||
android:name="session_id"
|
||||
app:argType="string"
|
||||
|
|
Loading…
Reference in New Issue