#2280 added intent to KiwixMainActivity for local file transfer

This commit is contained in:
HissPirat 2020-08-17 10:25:29 +02:00
parent ed6480a25d
commit 4c8fe0f192
3 changed files with 18 additions and 0 deletions

View File

@ -39,6 +39,17 @@
android:label="@string/app_name"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/octet-stream" />
<data android:pathPattern=".*\\.zim" />
<data android:pathPattern=".*\\..*\\.zim" />
<data android:pathPattern=".*\\..*\\..*\\.zim" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.zim" />
<data android:host="*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

View File

@ -308,6 +308,7 @@ open class WifiDirectManager @Inject constructor(
disconnect()
}
unregisterWifiDirectBroadcastReceiver()
callbacks = null
}
private fun disconnect() {

View File

@ -120,6 +120,12 @@ class KiwixMainActivity : CoreMainActivity() {
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
when (intent.action) {
Intent.ACTION_SEND_MULTIPLE -> {
setIntent(intent)
navigate(R.id.localFileTransferFragment)
}
}
supportFragmentManager.fragments.filterIsInstance<FragmentActivityExtensions>().forEach {
it.onNewIntent(intent, this)
}