[Libreoffice-commits] core.git: android/source
Michael Weghorn (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 19 05:43:39 UTC 2021
android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
New commits:
commit 128f67e0efa02294205a1abe1be874557ecdcecd
Author: Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Tue May 18 14:27:51 2021 +0200
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Wed May 19 07:42:57 2021 +0200
tdf#142348 android: Avoid extra refresh after loading doc
commit 1bc42472200c32c9a0a10dd1c3cd6c6a8a5d47d2
Date: Fri Apr 9 13:59:43 2021 +0200
tdf#95517 android: Rework app/doc lifecycle handling
changed activity lifecycle for Android Viewer's
'LibreOfficeMainActivity'. It moved sending an event to
trigger loading of the document from the 'onStart' to the
'onCreate' method and added sending a more lightweight refresh
event the 'onStart' method instead.
However, since a refresh is already done when loading the
document, there's no need to do another refresh when the 'onStart'
method is called right after the 'onCreate' method.
Therefore, set a flag in the 'onCreate' method and use that
to skip sending the extra refresh event for that case. This
not only avoids doing unnecessary work but also avoids that
the two could get into each others way, resulting in Calc
documents sometimes not being rendered on initial load.
Change-Id: I5c47e1b5f7a42a49fb903891aa84585b36994a4b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115750
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
index 9d8828811ade..3927cc744eb4 100644
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -100,6 +100,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
private LOKitTileProvider mTileProvider;
private String mPassword;
private boolean mPasswordProtected;
+ private boolean mbSkipNextRefresh;
public boolean pendingInsertGraphic; // boolean indicating a pending insert graphic action, used in LOKitTileProvider.postLoad()
public GeckoLayerClient getLayerClient() {
@@ -213,6 +214,9 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
Log.e(LOGTAG, "No document specified. This should never happen.");
return;
}
+ // the loadDocument/loadNewDocument event already triggers a refresh as well,
+ // so there's no need to do another refresh in 'onStart'
+ mbSkipNextRefresh = true;
mDrawerLayout = findViewById(R.id.drawer_layout);
@@ -466,7 +470,10 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
protected void onStart() {
Log.i(LOGTAG, "onStart..");
super.onStart();
- LOKitShell.sendEvent(new LOEvent(LOEvent.REFRESH));
+ if (!mbSkipNextRefresh) {
+ LOKitShell.sendEvent(new LOEvent(LOEvent.REFRESH));
+ }
+ mbSkipNextRefresh = false;
}
@Override
More information about the Libreoffice-commits
mailing list