[Libreoffice-commits] online.git: android/app
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Feb 22 13:02:46 UTC 2019
android/app/build.gradle | 1 +
android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java | 9 +++++++++
2 files changed, 10 insertions(+)
New commits:
commit 63b1853cd28c366c12f005a379948949b51d92d8
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Thu Feb 21 10:16:32 2019 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Feb 22 14:02:00 2019 +0100
android: Add possibility to debug JS in the WebView using a debugger.
Change-Id: I3d14dce55c7c94a151e72b631925419b4c313297
diff --git a/android/app/build.gradle b/android/app/build.gradle
index e9728cfcc..a628b9ccf 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -18,6 +18,7 @@ android {
//abiFilters "x86", "armeabi-v7a", "armeabi"
abiFilters "armeabi-v7a"
}
+ debuggable true
}
release {
ndk {
diff --git a/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java b/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java
index c1eea24cf..bba233af8 100644
--- a/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java
+++ b/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java
@@ -12,6 +12,7 @@ package org.libreoffice.androidapp;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.res.AssetManager;
+import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
@@ -135,6 +136,14 @@ public class MainActivity extends AppCompatActivity {
webSettings.setJavaScriptEnabled(true);
mWebView.addJavascriptInterface(this, "LOOLMessageHandler");
+ // 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) {
+ WebView.setWebContentsDebuggingEnabled(true);
+ }
+ }
+
mWebView.loadUrl("file:///android_asset/dist/loleaflet.html?file_path=" +
urlToLoad +
"&closebutton=1&permission=edit" +
More information about the Libreoffice-commits
mailing list