mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-15 02:18:04 -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.NavController
|
||||||
import androidx.navigation.NavDestination
|
import androidx.navigation.NavDestination
|
||||||
import androidx.navigation.NavDirections
|
import androidx.navigation.NavDirections
|
||||||
|
import androidx.navigation.NavOptions
|
||||||
import com.google.android.material.navigation.NavigationView
|
import com.google.android.material.navigation.NavigationView
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@ -393,6 +394,10 @@ abstract class CoreMainActivity : BaseActivity(), WebViewProvider {
|
|||||||
navController.navigate(fragmentId, bundle)
|
navController.navigate(fragmentId, bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun navigate(fragmentId: Int, bundle: Bundle, navOptions: NavOptions) {
|
||||||
|
navController.navigate(fragmentId, bundle, navOptions)
|
||||||
|
}
|
||||||
|
|
||||||
private fun openSettings() {
|
private fun openSettings() {
|
||||||
handleDrawerOnNavigation()
|
handleDrawerOnNavigation()
|
||||||
navigate(settingsFragmentResId)
|
navigate(settingsFragmentResId)
|
||||||
@ -435,13 +440,18 @@ abstract class CoreMainActivity : BaseActivity(), WebViewProvider {
|
|||||||
if (zimReaderSource != null) {
|
if (zimReaderSource != null) {
|
||||||
zimFileUri = zimReaderSource.toDatabase()
|
zimFileUri = zimReaderSource.toDatabase()
|
||||||
}
|
}
|
||||||
|
val navOptions = NavOptions.Builder()
|
||||||
|
.setLaunchSingleTop(true)
|
||||||
|
.setPopUpTo(readerFragmentResId, inclusive = true)
|
||||||
|
.build()
|
||||||
navigate(
|
navigate(
|
||||||
readerFragmentResId,
|
readerFragmentResId,
|
||||||
bundleOf(
|
bundleOf(
|
||||||
PAGE_URL_KEY to pageUrl,
|
PAGE_URL_KEY to pageUrl,
|
||||||
ZIM_FILE_URI_KEY to zimFileUri,
|
ZIM_FILE_URI_KEY to zimFileUri,
|
||||||
SHOULD_OPEN_IN_NEW_TAB to shouldOpenInNewTab
|
SHOULD_OPEN_IN_NEW_TAB to shouldOpenInNewTab
|
||||||
)
|
),
|
||||||
|
navOptions
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user