android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java | 26 ++++++++++ loleaflet/src/control/Control.MobileWizard.js | 5 + loleaflet/src/core/Socket.js | 5 + wsd/protocol.txt | 6 ++ 4 files changed, 42 insertions(+)
New commits: commit 0a35e432ff17b1a80065c36d56069393bfba6bea Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Tue Jan 14 16:49:36 2020 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Tue Jan 14 17:44:28 2020 +0100 android: When the mobile-wizard is open, the Back button should go a level up. Without this, we were closing the document, which was very annoying. Change-Id: I1e841da28c92c0e01284c2d7e2d4dbc6762bfffd Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86779 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Michael Meeks <michael.me...@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 713032122..030f35357 100644 --- a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java +++ b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java @@ -99,6 +99,9 @@ public class LOActivity extends AppCompatActivity { private Handler nativeHandler; private Looper nativeLooper; + /** In case the mobile-wizard is visible, we have to intercept the Android's Back button. */ + private boolean mMobileWizardVisible = false; + private ValueCallback<Uri[]> valueCallback; public static final int REQUEST_SELECT_FILE = 555; @@ -448,6 +451,18 @@ public class LOActivity extends AppCompatActivity { } } + @Override + public void onBackPressed() { + if (mMobileWizardVisible) + { + // just return one level up in the mobile-wizard (or close it) + callFakeWebsocketOnMessage("'mobile: mobilewizardback'"); + return; + } + + super.onBackPressed(); + } + private void loadDocument() { // setup the LOOLWSD ApplicationInfo applicationInfo = getApplicationInfo(); @@ -596,6 +611,17 @@ public class LOActivity extends AppCompatActivity { }); return false; } + case "MOBILEWIZARD": { + switch (messageAndParam[1]) { + case "show": + mMobileWizardVisible = true; + break; + case "hide": + mMobileWizardVisible = false; + break; + } + return false; + } } return true; } diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js index f186a2412..7b91d1a94 100644 --- a/loleaflet/src/control/Control.MobileWizard.js +++ b/loleaflet/src/control/Control.MobileWizard.js @@ -27,6 +27,7 @@ L.Control.MobileWizard = L.Control.extend({ map.on('mobilewizard', this._onMobileWizard, this); map.on('closemobilewizard', this._hideWizard, this); map.on('showwizardsidebar', this._showWizardSidebar, this); + map.on('mobilewizardback', this.goLevelUp, this); this._setupBackButton(); }, @@ -58,6 +59,8 @@ L.Control.MobileWizard = L.Control.extend({ _showWizard: function() { $('#mobile-wizard').show(); $('#toolbar-down').hide(); + if (window.ThisIsTheAndroidApp) + window.postMobileMessage('MOBILEWIZARD show'); }, _showWizardSidebar: function() { @@ -72,6 +75,8 @@ L.Control.MobileWizard = L.Control.extend({ if (this.map._permission === 'edit') { $('#toolbar-down').show(); } + if (window.ThisIsTheAndroidApp) + window.postMobileMessage('MOBILEWIZARD hide'); this.map.showSidebar = false; this._isActive = false; diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index 653b71366..a65133d4c 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -755,6 +755,11 @@ L.Socket = L.Class.extend({ vex.closeAll(); } } + else if (window.ThisIsAMobileApp && textMsg.startsWith('mobile:')) { + // allow passing some events easily from the mobile app + var mobileEvent = textMsg.substring('mobile: '.length); + this._map.fire(mobileEvent); + } else if (!textMsg.startsWith('tile:') && !textMsg.startsWith('renderfont:') && !textMsg.startsWith('windowpaint:')) { // log the tile msg separately as we need the tile coordinates L.Log.log(textMsg, L.INCOMING); diff --git a/wsd/protocol.txt b/wsd/protocol.txt index 6e097587b..fd94c741f 100644 --- a/wsd/protocol.txt +++ b/wsd/protocol.txt @@ -544,6 +544,12 @@ shapeselectioncontent: <content> Current selection's content +mobile: <event> + + Available only in the mobile (Android and iOS) apps. When you send + 'mobile: eventname', the socket code will fire a 'eventname' event on the + map. + child -> parent =============== _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits