summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2020-07-15 21:29:23 +0200
committerJan Holesovsky <kendy@collabora.com>2020-07-15 23:41:07 +0200
commit8c416d962c1c4aad6cd5085b82ac12ea62097902 (patch)
tree7d1502593b1f3adb07f22cb36e36812e8b5fbda4
parentandroid: Add support for ODT/ODS/ODP for Chrome OS. (diff)
downloadonline-8c416d962c1c4aad6cd5085b82ac12ea62097902.tar.gz
online-8c416d962c1c4aad6cd5085b82ac12ea62097902.zip
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 <kendy@collabora.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java7
-rw-r--r--android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java15
-rw-r--r--loleaflet/js/global.js15
3 files changed, 31 insertions, 6 deletions
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 f447238610..e89913628d 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 3374ff4cad..e904c6d742 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);
@@ -777,6 +783,15 @@ public class LOActivity extends AppCompatActivity {
}
/**
+ * 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.
*/
void callFakeWebsocketOnMessage(final String message) {
diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 5e0007d43a..619bb91db0 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() {