16
edits
Ivan.Savov (talk | contribs) (updates from initial discussions) |
Ivan.Savov (talk | contribs) (some changes from yesterday) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 230: | Line 230: | ||
** Kiwix renders a custom ZIMfile that conains fractions + 3 links deep | ** Kiwix renders a custom ZIMfile that conains fractions + 3 links deep | ||
* | * Include content from ZIM files in Koibri | ||
** | ** Example use case: in order to avoid duplication of supporting code, | ||
Line 253: | Line 250: | ||
* ACTION_VIEW intents that start with `kolibri://<path>` will be handled by the Kolibiri app (see below) | * ACTION_VIEW intents that start with `kolibri://<path>` will be handled by the Kolibiri app (see below) | ||
* ACTION_VIEW intents starting with `kiwix://<path>` will be handled by the Kiwix app, | * ACTION_VIEW intents starting with `kiwix://<path>` will be handled by the Kiwix app, | ||
* Suppose you're in the Kiwix app and you're browsing some videos from KA zim file. The exercises don't work within the Kiwix appthough, but you can click on an perseus exercise and the Kiwix app will send you to the Kolibri app as follows | * Suppose you're in the Kiwix app and you're browsing some videos from KA zim file. | ||
The exercises don't work within the Kiwix appthough, but you can click on an perseus exercise and the Kiwix app will send you to the Kolibri app as follows | |||
Uri exercise = Uri.parse("kolibri:/learn/#/1ceff53605.../topics/c/845ce535..."); | |||
Intent callIntent = new Intent(Intent.ACTION_VIEW, exercise); | |||
// do check here | |||
callIntent.startActivity() | |||
We could something like this in the Kolibri android app manifest: | We could something like this in the Kolibri android app manifest: | ||
<activity | <activity | ||
android:name=".activities.LinkDispatcherActivity" | android:name=".activities.LinkDispatcherActivity" | ||
Line 264: | Line 265: | ||
android:launchMode="singleInstance" | android:launchMode="singleInstance" | ||
android:theme="@android:style/Theme.NoDisplay" > | android:theme="@android:style/Theme.NoDisplay" > | ||
<nowiki> | |||
<intent-filter> | <intent-filter> | ||
<action android:name="android.intent.action.VIEW"/> | <action android:name="android.intent.action.VIEW"/> | ||
<category android:name="android.intent.category.DEFAULT"/> | <category android:name="android.intent.category.DEFAULT"/> | ||
<category android:name="android.intent.category.BROWSABLE"/> | <category android:name="android.intent.category.BROWSABLE"/> | ||
<data android:scheme="kolibri" /> | <data android:scheme="kolibri"/> | ||
<data android:host="view_channel"/> | |||
<data android:host="view_node"/> | |||
<data android:pathPattern=".*"/> | |||
</intent-filter> | </intent-filter> | ||
</nowiki> | |||
</activity> | </activity> | ||
in the Kiwix android app | in the Kiwix android app | ||
<activity | <activity | ||
android:name=".activities.LinkDispatcherActivity" | android:name=".activities.LinkDispatcherActivity" | ||
Line 282: | Line 286: | ||
android:launchMode="singleInstance" | android:launchMode="singleInstance" | ||
android:theme="@android:style/Theme.NoDisplay" > | android:theme="@android:style/Theme.NoDisplay" > | ||
<nowiki> | |||
<intent-filter> | <intent-filter> | ||
<action android:name="android.intent.action.VIEW"/> | <action android:name="android.intent.action.VIEW"/> | ||
<category android:name="android.intent.category.DEFAULT"/> | <category android:name="android.intent.category.DEFAULT"/> | ||
<category android:name="android.intent.category.BROWSABLE"/> | <category android:name="android.intent.category.BROWSABLE"/> | ||
<data android:scheme="kiwix" /> | <data android:scheme="kiwix"/> | ||
<data android:host="view_zimfile"/> | |||
<data android:host="view_page"/> | |||
<data android:pathPattern=".*"/> | |||
</intent-filter> | </intent-filter> | ||
</nowiki> | |||
</activity> | </activity> | ||
To verify there is an activity available that can respond to the intent, call <code>queryIntentActivities()</code> to get a list of activities capable of handling your <code>Intent</code>. If the returned <code>List</code> is not empty, you can safely use the intent. For example: | To verify there is an activity available that can respond to the intent, call <code>queryIntentActivities()</code> to get a list of activities capable of handling your <code>Intent</code>. If the returned <code>List</code> is not empty, you can safely use the intent. For example: |
edits