mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
Fixed: Reader screen was showing twice when pressing the back button after opening a page from the history, bookmarks, or notes screens in custom apps.
This commit is contained in:
parent
d3f40f2219
commit
5a47a7ba94
@ -40,6 +40,7 @@ import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.NavDestination
|
||||
import androidx.navigation.NavDirections
|
||||
import androidx.navigation.NavOptions
|
||||
import com.google.android.material.navigation.NavigationView
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@ -393,6 +394,10 @@ abstract class CoreMainActivity : BaseActivity(), WebViewProvider {
|
||||
navController.navigate(fragmentId, bundle)
|
||||
}
|
||||
|
||||
fun navigate(fragmentId: Int, bundle: Bundle, navOptions: NavOptions) {
|
||||
navController.navigate(fragmentId, bundle, navOptions)
|
||||
}
|
||||
|
||||
private fun openSettings() {
|
||||
handleDrawerOnNavigation()
|
||||
navigate(settingsFragmentResId)
|
||||
@ -435,13 +440,18 @@ abstract class CoreMainActivity : BaseActivity(), WebViewProvider {
|
||||
if (zimReaderSource != null) {
|
||||
zimFileUri = zimReaderSource.toDatabase()
|
||||
}
|
||||
val navOptions = NavOptions.Builder()
|
||||
.setLaunchSingleTop(true)
|
||||
.setPopUpTo(readerFragmentResId, inclusive = true)
|
||||
.build()
|
||||
navigate(
|
||||
readerFragmentResId,
|
||||
bundleOf(
|
||||
PAGE_URL_KEY to pageUrl,
|
||||
ZIM_FILE_URI_KEY to zimFileUri,
|
||||
SHOULD_OPEN_IN_NEW_TAB to shouldOpenInNewTab
|
||||
)
|
||||
),
|
||||
navOptions
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user