[Libreoffice-commits] online.git: 2 commits - android/app loleaflet/src
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed May 22 08:17:15 UTC 2019
android/app/src/main/cpp/androidapp.cpp | 2 -
android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java | 15 ++++++++--
loleaflet/src/control/Control.Toolbar.js | 10 +++---
3 files changed, 19 insertions(+), 8 deletions(-)
New commits:
commit 720fffedf28b177c42498eb35daedd78a80e4251
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed May 22 10:14:01 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed May 22 10:16:12 2019 +0200
mobile: Avoid uncaught exceptions when some toolbars don't exist at all.
Change-Id: Ie29c2cdf83bce5d65bf64cd982917186f7adbc8e
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index 648eb338a..17cf8381a 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -91,23 +91,23 @@ function onClick(e, id, item, subItem) {
var toolbar = w2ui['editbar'];
item = toolbar.get(id);
}
- else if (w2ui.formulabar.get(id) !== null) {
- toolbar = w2ui.formulabar;
+ else if ('formulabar' in w2ui && w2ui['formulabar'].get(id) !== null) {
+ toolbar = w2ui['formulabar'];
item = toolbar.get(id);
}
else if ('document-signing-bar' in w2ui && w2ui['document-signing-bar'].get(id) !== null) {
toolbar = w2ui['document-signing-bar'];
item = toolbar.get(id);
}
- else if (w2ui['actionbar'].get(id) !== null) {
+ else if ('actionbar' in w2ui && w2ui['actionbar'].get(id) !== null) {
toolbar = w2ui['actionbar'];
item = toolbar.get(id);
}
- else if (w2ui['spreadsheet-toolbar'].get(id) !== null) {
+ else if ('spreadsheet-toolbar' in w2ui && w2ui['spreadsheet-toolbar'].get(id) !== null) {
toolbar = w2ui['spreadsheet-toolbar'];
item = toolbar.get(id);
}
- else if (w2ui['presentation-toolbar'].get(id) !== null) {
+ else if ('presentation-toolbar' in w2ui && w2ui['presentation-toolbar'].get(id) !== null) {
toolbar = w2ui['presentation-toolbar'];
item = toolbar.get(id);
}
commit 4bf4ba0212241540c3d8be3a72a5fd4d25675f89
Author: Florin Ciornei <florin.ciornei at collabora.com>
AuthorDate: Fri Mar 29 18:23:16 2019 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed May 22 10:16:11 2019 +0200
android: Implement returning using the back button
Pressing back button now returns you to the document browser.
Change-Id: I93f281bd6251522422a578e2e23bd68e75c9af7d
diff --git a/android/app/src/main/cpp/androidapp.cpp b/android/app/src/main/cpp/androidapp.cpp
index b41571e51..e10639eba 100644
--- a/android/app/src/main/cpp/androidapp.cpp
+++ b/android/app/src/main/cpp/androidapp.cpp
@@ -125,7 +125,7 @@ static void send2JS(jclass mainActivityClz, jobject mainActivityObj, const std::
/// Handle a message from JavaScript.
extern "C" JNIEXPORT void JNICALL
-Java_org_libreoffice_androidapp_MainActivity_postMobileMessage(JNIEnv *env, jobject instance, jstring message)
+Java_org_libreoffice_androidapp_MainActivity_postMobileMessageNative(JNIEnv *env, jobject instance, jstring message)
{
const char *string_value = env->GetStringUTFChars(message, nullptr);
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 43315e7c9..586a64ee5 100644
--- a/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java
+++ b/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java
@@ -316,7 +316,7 @@ public class MainActivity extends AppCompatActivity {
protected void onStop() {
super.onStop();
Log.d(TAG, "Stop LOOLWSD instance");
- postMobileMessage("BYE");
+ postMobileMessageNative("BYE");
}
private void loadDocument() {
@@ -346,7 +346,18 @@ public class MainActivity extends AppCompatActivity {
* Passing messages from JS (instead of the websocket communication).
*/
@JavascriptInterface
- public native void postMobileMessage(String message);
+ public void postMobileMessage(String message) {
+ Log.d(TAG, "postMobileMessage: " + message);
+
+ postMobileMessageNative(message);
+
+ // Going back to document browser on BYE (called when pressing the top left exit button)
+ if (message.equals("BYE"))
+ finish();
+ };
+
+ /** Call the post method form C++ */
+ public native void postMobileMessageNative(String message);
/**
* Passing messages from JS (instead of the websocket communication).
More information about the Libreoffice-commits
mailing list