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 8c416d962c1c4aad6cd5085b82ac12ea62097902
Author:     Jan Holesovsky <ke...@collabora.com>
AuthorDate: Wed Jul 15 21:29:23 2020 +0200
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Wed Jul 15 23:41:07 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/+/98861
    Tested-by: Jan Holesovsky <ke...@collabora.com>
    Reviewed-by: Jan Holesovsky <ke...@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() {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to