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

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 16 09:52:08 UTC 2020


 android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java |    7 ----
 android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java               |   15 ++++++++++
 loleaflet/js/global.js                                                             |   15 ++++++++++
 3 files changed, 31 insertions(+), 6 deletions(-)

New commits:
commit 0d09490f831d0f8fa17cc1758cd6fb2259c032c8
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Jul 15 21:29:23 2020 +0200
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jul 16 11:51:49 2020 +0200

    android: Actually use the Desktop browser UI for Chromebooks.
    
    Chromebooks are not touch devices, the desktop browser-like UI makes
    much more sense there.
    
    Change-Id: Id963929e781f2baff32a65e0437afb4dfd8460a3
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98863
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java b/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java
index f44723861..e89913628 100644
--- a/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java
+++ b/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java
@@ -678,11 +678,6 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
         return true;
     }
 
-    /** True if the App is running under ChromeOS. */
-    private boolean isChromeOS() {
-        return getPackageManager().hasSystemFeature("org.chromium.arc.device_management");
-    }
-
     /** Start an ACTION_OPEN_DOCUMENT Intent to trigger opening a document. */
     private void openDocument() {
         collapseFabMenu();
@@ -700,7 +695,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
         // impossible to choose any files, unless they notice the dropdown in
         // the bottom left and choose "All files".  Interestingly, SVG / SVGZ
         // are shown there as an option, the other mime types are just blank
-        if (!isChromeOS()) {
+        if (!LOActivity.isChromeOS(this)) {
             final String[] mimeTypes = new String[] {
                 // ODF
                 "application/vnd.oasis.opendocument.text",
diff --git a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
index 3374ff4ca..e904c6d74 100644
--- a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
+++ b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
@@ -16,6 +16,7 @@ import android.content.ClipDescription;
 import android.content.ClipboardManager;
 import android.content.ActivityNotFoundException;
 import android.content.ContentResolver;
+import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
@@ -210,6 +211,11 @@ public class LOActivity extends AppCompatActivity {
         return mMainHandler;
     }
 
+    /** True if the App is running under ChromeOS. */
+    public static boolean isChromeOS(Context context) {
+        return context.getPackageManager().hasSystemFeature("org.chromium.arc.device_management");
+    }
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -776,6 +782,15 @@ public class LOActivity extends AppCompatActivity {
         Log.d(TAG, "postMobileDebug: " + message);
     }
 
+    /**
+     * Provide the info that this app is actually running under ChromeOS - so
+     * has to mostly look like on desktop.
+     */
+    @JavascriptInterface
+    public boolean isChromeOS() {
+        return isChromeOS(this);
+    }
+
     /**
      * Passing message the other way around - from Java to the FakeWebSocket in JS.
      */
diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 5e0007d43..619bb91db 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -143,9 +143,18 @@
 	};
 
 	global.mode = {
+		isChromebook: function() {
+			if (!window.ThisIsTheAndroidApp)
+				return false;
+
+			return window.LOOLMessageHandler.isChromeOS();
+		},
 		// Here "mobile" means "mobile phone" (at least for now). Has to match small screen size
 		// requirement.
 		isMobile: function() {
+			if (global.mode.isChromebook())
+				return false;
+
 			if (L.Browser.mobile && L.Browser.cypressTest) {
 				return true;
 			}
@@ -154,9 +163,15 @@
 		},
 		// Mobile device with big screen size.
 		isTablet: function() {
+			if (global.mode.isChromebook())
+				return false;
+
 			return L.Browser.mobile && !window.mode.isMobile();
 		},
 		isDesktop: function() {
+			if (global.mode.isChromebook())
+				return true;
+
 			return !L.Browser.mobile;
 		},
 		getDeviceFormFactor: function() {


More information about the Libreoffice-commits mailing list