[Libreoffice-commits] online.git: android/app android/lib

mert (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 3 22:08:05 UTC 2020


 android/app/src/main/java/org/libreoffice/androidapp/SettingsActivity.java  |    3 +++
 android/app/src/main/res/values/strings.xml                                 |    2 ++
 android/app/src/main/res/xml/libreoffice_preferences.xml                    |    8 ++++++++
 android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java        |    3 ++-
 android/lib/src/main/java/org/libreoffice/androidlib/SlideShowActivity.java |    7 ++++++-
 5 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit 4122634c9b8ef217877b168f529e1147ea4a00db
Author:     mert <mert.tumer at collabora.com>
AuthorDate: Wed Jan 29 17:13:24 2020 +0300
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Mon Feb 3 23:07:41 2020 +0100

    Added the chrome debugging enablement into the settings
    
    Change-Id: I24c97018b499517637f460ba663737ca781ee975
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87687
    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/SettingsActivity.java b/android/app/src/main/java/org/libreoffice/androidapp/SettingsActivity.java
index c51d098af..510979a7a 100644
--- a/android/app/src/main/java/org/libreoffice/androidapp/SettingsActivity.java
+++ b/android/app/src/main/java/org/libreoffice/androidapp/SettingsActivity.java
@@ -34,6 +34,9 @@ public class SettingsActivity extends AppCompatActivity {
             if (!BuildConfig.DEBUG) {
                 findPreference("ENABLE_SHOW_DEBUG_INFO").setVisible(false);
             }
+            else {
+                findPreference("ENABLE_CHROME_DEBUGGING").setVisible(false);
+            }
         }
 
         @Override
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index 12f65fc11..390ec274b 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -27,6 +27,8 @@
     <string name="pref_filter_summary">Set which file filter should be used by default.</string>
     <string name="pref_show_debug_info">Show Debug Info</string>
     <string name="pref_show_debug_info_summary">Enable to show debug information in document viewer</string>
+    <string name="pref_enable_chrome_debugger">Chrome Debugging</string>
+    <string name="pref_enable_chrome_debugger_info">Enable to use Chrome\'s debugging tool in the document</string>
 
     <string name="about_license">Show License</string>
     <string name="about_notice">Show Notice</string>
diff --git a/android/app/src/main/res/xml/libreoffice_preferences.xml b/android/app/src/main/res/xml/libreoffice_preferences.xml
index 5f8389d45..a6da9e4ef 100644
--- a/android/app/src/main/res/xml/libreoffice_preferences.xml
+++ b/android/app/src/main/res/xml/libreoffice_preferences.xml
@@ -43,6 +43,14 @@
             android:summary="@string/pref_show_debug_info_summary"
             android:defaultValue="false"
             app:iconSpaceReserved="false" />
+        <CheckBoxPreference
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:defaultValue="false"
+            android:key="ENABLE_CHROME_DEBUGGING"
+            android:summary="@string/pref_enable_chrome_debugger_info"
+            android:title="@string/pref_enable_chrome_debugger"
+            app:iconSpaceReserved="false" />
 
     </PreferenceCategory>
 
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 9c7729ef9..34fd8b1b2 100644
--- a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
+++ b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
@@ -292,10 +292,11 @@ public class LOActivity extends AppCompatActivity {
         webSettings.setJavaScriptEnabled(true);
         mWebView.addJavascriptInterface(this, "LOOLMessageHandler");
 
+        boolean isChromeDebugEnabled = sPrefs.getBoolean("ENABLE_CHROME_DEBUGGING", false);
         // allow debugging (when building the debug version); see details in
         // https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
-            if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
+            if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0 || isChromeDebugEnabled) {
                 WebView.setWebContentsDebuggingEnabled(true);
             }
         }
diff --git a/android/lib/src/main/java/org/libreoffice/androidlib/SlideShowActivity.java b/android/lib/src/main/java/org/libreoffice/androidlib/SlideShowActivity.java
index 21eeeeb9f..761d73c07 100644
--- a/android/lib/src/main/java/org/libreoffice/androidlib/SlideShowActivity.java
+++ b/android/lib/src/main/java/org/libreoffice/androidlib/SlideShowActivity.java
@@ -12,9 +12,11 @@ package org.libreoffice.androidlib;
 import androidx.annotation.NonNull;
 import androidx.appcompat.app.AppCompatActivity;
 
+import android.content.SharedPreferences;
 import android.content.pm.ApplicationInfo;
 import android.graphics.Color;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.util.Log;
 import android.view.View;
 import android.webkit.WebSettings;
@@ -39,7 +41,10 @@ public class SlideShowActivity extends AppCompatActivity {
             slidesSvgUri = savedInstanceState.getString(SVG_URI_KEY);
         }
         Log.d(TAG, "SlideShow Svg Uri "+slidesSvgUri);
-        if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
+        SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
+        boolean isChromeDebugEnabled = sPrefs.getBoolean("ENABLE_CHROME_DEBUGGING", false);
+
+        if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0 || isChromeDebugEnabled) {
             WebView.setWebContentsDebuggingEnabled(true);
         }
         slideShowWebView.setBackgroundColor(Color.BLACK);


More information about the Libreoffice-commits mailing list