Fixed: Kiwix now opens in the Samsung file navigator.

This commit is contained in:
MohitMaliFtechiz 2024-11-07 10:39:01 +05:30 committed by Kelson
parent 4c773e27a5
commit 071dc96c9a
2 changed files with 9 additions and 4 deletions

View File

@ -28,7 +28,7 @@
android:configChanges="orientation|keyboardHidden|screenSize" android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true" android:exported="true"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTop" android:launchMode="singleInstance"
android:theme="@style/KiwixTheme.Launcher" android:theme="@style/KiwixTheme.Launcher"
android:windowSoftInputMode="adjustPan"> android:windowSoftInputMode="adjustPan">

View File

@ -117,9 +117,6 @@ class KiwixMainActivity : CoreMainActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
activityKiwixMainBinding = ActivityKiwixMainBinding.inflate(layoutInflater) activityKiwixMainBinding = ActivityKiwixMainBinding.inflate(layoutInflater)
setContentView(activityKiwixMainBinding.root) setContentView(activityKiwixMainBinding.root)
if (intent.action == "GET_CONTENT") {
navigate(R.id.downloadsFragment)
}
navController.addOnDestinationChangedListener(finishActionModeOnDestinationChange) navController.addOnDestinationChangedListener(finishActionModeOnDestinationChange)
activityKiwixMainBinding.drawerNavView.setupWithNavController(navController) activityKiwixMainBinding.drawerNavView.setupWithNavController(navController)
@ -130,6 +127,7 @@ class KiwixMainActivity : CoreMainActivity() {
activityKiwixMainBinding.bottomNavView.setupWithNavController(navController) activityKiwixMainBinding.bottomNavView.setupWithNavController(navController)
migrateInternalToPublicAppDirectory() migrateInternalToPublicAppDirectory()
handleZimFileIntent(intent) handleZimFileIntent(intent)
handleGetContentIntent(intent)
} }
private fun migrateInternalToPublicAppDirectory() { private fun migrateInternalToPublicAppDirectory() {
@ -220,11 +218,18 @@ class KiwixMainActivity : CoreMainActivity() {
super.onNewIntent(intent) super.onNewIntent(intent)
handleNotificationIntent(intent) handleNotificationIntent(intent)
handleZimFileIntent(intent) handleZimFileIntent(intent)
handleGetContentIntent(intent)
supportFragmentManager.fragments.filterIsInstance<FragmentActivityExtensions>().forEach { supportFragmentManager.fragments.filterIsInstance<FragmentActivityExtensions>().forEach {
it.onNewIntent(intent, this) it.onNewIntent(intent, this)
} }
} }
private fun handleGetContentIntent(intent: Intent?) {
if (intent?.action == ACTION_GET_CONTENT) {
navigate(R.id.downloadsFragment)
}
}
private fun handleZimFileIntent(intent: Intent?) { private fun handleZimFileIntent(intent: Intent?) {
intent?.data?.let { intent?.data?.let {
when (it.scheme) { when (it.scheme) {