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) {
|
val directions = when (from) {
|
||||||
BrowserDirection.FromGlobal -> NavGraphDirections.actionGlobalBrowser(customTabSessionId)
|
BrowserDirection.FromGlobal -> NavGraphDirections.actionGlobalBrowser(customTabSessionId)
|
||||||
BrowserDirection.FromHome -> HomeFragmentDirections.actionHomeFragmentToBrowserFragment(customTabSessionId)
|
BrowserDirection.FromHome -> HomeFragmentDirections.actionHomeFragmentToBrowserFragment(customTabSessionId)
|
||||||
BrowserDirection.FromSearch ->
|
BrowserDirection.FromSearch -> {
|
||||||
SearchFragmentDirections.actionSearchFragmentToBrowserFragment(customTabSessionId)
|
if (!navHost.navController.popBackStack(R.id.browserFragment, false)) {
|
||||||
|
SearchFragmentDirections.actionSearchFragmentToBrowserFragment(customTabSessionId)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
BrowserDirection.FromSettings ->
|
BrowserDirection.FromSettings ->
|
||||||
SettingsFragmentDirections.actionSettingsFragmentToBrowserFragment(customTabSessionId)
|
SettingsFragmentDirections.actionSettingsFragmentToBrowserFragment(customTabSessionId)
|
||||||
BrowserDirection.FromBookmarks ->
|
BrowserDirection.FromBookmarks ->
|
||||||
|
@ -208,7 +213,9 @@ open class HomeActivity : AppCompatActivity() {
|
||||||
if (sessionObserver == null)
|
if (sessionObserver == null)
|
||||||
sessionObserver = subscribeToSessions()
|
sessionObserver = subscribeToSessions()
|
||||||
|
|
||||||
navHost.navController.navigate(directions)
|
directions?.let {
|
||||||
|
navHost.navController.navigate(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun load(searchTermOrURL: String, newTab: Boolean, engine: SearchEngine?, forceSearch: Boolean) {
|
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?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
postponeEnterTransition()
|
postponeEnterTransition()
|
||||||
|
sharedElementEnterTransition =
|
||||||
|
TransitionInflater.from(context).inflateTransition(android.R.transition.move).setDuration(
|
||||||
|
SHARED_TRANSITION_MS
|
||||||
|
)
|
||||||
job = Job()
|
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()
|
startPostponedEnterTransition()
|
||||||
|
|
||||||
QuickActionComponent(
|
QuickActionComponent(
|
||||||
|
|
|
@ -58,7 +58,8 @@
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_searchFragment_to_browserFragment"
|
android:id="@+id/action_searchFragment_to_browserFragment"
|
||||||
app:destination="@id/browserFragment"
|
app:destination="@id/browserFragment"
|
||||||
app:popUpTo="@id/homeFragment" />
|
app:popUpTo="@id/searchFragment"
|
||||||
|
app:popUpToInclusive="true" />
|
||||||
<argument
|
<argument
|
||||||
android:name="session_id"
|
android:name="session_id"
|
||||||
app:argType="string"
|
app:argType="string"
|
||||||
|
|
Loading…
Reference in New Issue