[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - android/app

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 15 21:45:33 UTC 2020


 android/app/src/main/AndroidManifest.xml |   47 +++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

New commits:
commit 7b772cb213bbac148b6ea16dc76afe8297c6e875
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Jul 14 20:13:47 2020 +0200
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed Jul 15 23:45:23 2020 +0200

    android: Add support for ODT/ODS/ODP for Chrome OS.
    
    Turns out that the ODF mime types are most probably not supported by
    Chrome OS, because the android:mimeType=... is not enough to associate
    the app with the ODT/ODP/ODS files.
    
    So introduce an additional intent-filter that explicitly matches
    according to the file extension; a bit hacky, but works.
    
    Change-Id: If7cad42333314e8d16f96d035380460d5c3da347
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98764
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 6912a0b57..4e8723706 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -116,6 +116,53 @@
                 <data android:mimeType="image/x-wmf" />
                 <data android:mimeType="image/svg+xml" />
             </intent-filter>
+            <!-- HACK to support ODF files on Chrome OS, inspired by
+                 https://stackoverflow.com/questions/1733195/android-intent-filter-for-a-particular-file-extension
+
+                 Seems like the ODF mime types are not available on Chrome OS,
+                 so we have to explicitly match the extension.  But the ".*" is
+                 not greedy, so the matching stops at the first "\\.", so we
+                 have to list several variants to handle files like "blah.ugh.odt".
+
+                 Additionally, this must not be in the above intent-filter
+                 section, because the android:mimeType="*/*" would make it
+                 make problems there. -->
+            <intent-filter>
+                <action android:name="android.intent.action.VIEW" />
+                <action android:name="android.intent.action.EDIT" />
+                <action android:name="android.intent.action.PICK" />
+
+                <category android:name="android.intent.category.DEFAULT" />
+
+                <data android:scheme="file" />
+                <data android:scheme="content" />
+                <data android:host="*" />
+                <data android:mimeType="*/*" />
+
+                <data android:pathPattern=".*\\.odt" />
+                <data android:pathPattern=".*\\..*\\.odt" />
+                <data android:pathPattern=".*\\..*\\..*\\.odt" />
+                <data android:pathPattern=".*\\..*\\..*\\..*\\.odt" />
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.odt" />
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.odt" />
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.odt" />
+
+                <data android:pathPattern=".*\\.ods" />
+                <data android:pathPattern=".*\\..*\\.ods" />
+                <data android:pathPattern=".*\\..*\\..*\\.ods" />
+                <data android:pathPattern=".*\\..*\\..*\\..*\\.ods" />
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.ods" />
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.ods" />
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.ods" />
+
+                <data android:pathPattern=".*\\.odp" />
+                <data android:pathPattern=".*\\..*\\.odp" />
+                <data android:pathPattern=".*\\..*\\..*\\.odp" />
+                <data android:pathPattern=".*\\..*\\..*\\..*\\.odp" />
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.odp" />
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.odp" />
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.odp" />
+            </intent-filter>
         </activity>
 
         <!-- The Activity to show license or notice -->


More information about the Libreoffice-commits mailing list