[Libreoffice-commits] online.git: android/lib loleaflet/src
kaishu-sahu (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 6 09:23:49 UTC 2019
android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java | 30 ++++++++--
loleaflet/src/map/Map.js | 8 ++
2 files changed, 33 insertions(+), 5 deletions(-)
New commits:
commit 0f9492268e8684b16e9c3d92be26eeb814fcf7a3
Author: kaishu-sahu <kaishusahu101 at gmail.com>
AuthorDate: Sun Jul 28 05:13:26 2019 +0530
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Sep 6 11:23:29 2019 +0200
android: add support for screen dimming from JS.
Change-Id: Icd766c7dcc9c2d62ec90945ec88fa46f88a4711d
Reviewed-on: https://gerrit.libreoffice.org/76489
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
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 2258a78a2..95c7c040f 100644
--- a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
+++ b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
@@ -32,6 +32,7 @@ import android.print.PrintAttributes;
import android.print.PrintDocumentAdapter;
import android.print.PrintManager;
import android.util.Log;
+import android.view.WindowManager;
import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
@@ -154,9 +155,10 @@ public class LOActivity extends AppCompatActivity {
}
}
- /** Copies fonts except the NotoSans from the system to our location.
- * This is necessary because the NotoSans is huge and fontconfig needs
- * ages to parse them.
+ /**
+ * Copies fonts except the NotoSans from the system to our location.
+ * This is necessary because the NotoSans is huge and fontconfig needs
+ * ages to parse them.
*/
private static boolean copyFonts(String fromPath, String targetDir) {
try {
@@ -171,8 +173,7 @@ public class LOActivity extends AppCompatActivity {
if (!fontFileName.equals("Roboto-Regular.ttf")) {
Log.i(TAG, "Ignored font file: " + fontFile);
continue;
- }
- else {
+ } else {
Log.i(TAG, "Copying font file: " + fontFile);
}
@@ -214,6 +215,7 @@ public class LOActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
sPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
updatePreferences();
@@ -579,6 +581,24 @@ public class LOActivity extends AppCompatActivity {
});
break;
}
+ case "DIM_SCREEN": {
+ mainHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ }
+ });
+ return false;
+ }
+ case "LIGHT_SCREEN": {
+ mainHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ }
+ });
+ return false;
+ }
}
return true;
}
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 118e74833..d5db0a0dd 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -1162,6 +1162,11 @@ L.Map = L.Evented.extend({
this._active = false;
clearTimeout(vex.timer);
+ if (window.ThisIsTheAndroidApp) {
+ window.postMobileMessage('DIM_SCREEN');
+ return;
+ }
+
var message = '';
var map = this;
if (!map['wopi'].DisableInactiveMessages) {
@@ -1189,6 +1194,9 @@ L.Map = L.Evented.extend({
notifyActive : function() {
this.lastActiveTime = Date.now();
+ if (window.ThisIsTheAndroidApp) {
+ window.postMobileMessage('LIGHT_SCREEN');
+ }
},
_dimIfInactive: function () {
More information about the Libreoffice-commits
mailing list