[Libreoffice-commits] core.git: android/source
Michael Weghorn (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 21 19:59:42 UTC 2021
android/source/src/java/org/libreoffice/FormattingController.java | 8 +++-----
android/source/src/java/org/libreoffice/LOKitTileProvider.java | 8 --------
android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java | 1 -
3 files changed, 3 insertions(+), 14 deletions(-)
New commits:
commit a3f682f90f85d69270f4d10ee1d661f25257bf21
Author: Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri May 21 15:44:46 2021 +0200
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Fri May 21 21:59:01 2021 +0200
tdf#106370 android: Make inserting pictures work
Instead of just setting LibreOfficeMainActivity's
'pendingInsertGraphic' member when inserting an
image, call the method responsible for asking what
compression to apply, doing the actual compression
and sending the event so the picture is actually
inserted right away.
'LibreOfficeMainActivity#pendingInsertGraphic' is
(by now) only evaluated in 'LOKitTileProvider' when the
document is initially loaded, therefore just setting
it had no effect.
The more complicated handling used previously instead
of just inserting the picture right away was probably
necessary/used because 'LibreOfficeMainActivity#onStart'
used to reload the whole document before
commit 1bc42472200c32c9a0a10dd1c3cd6c6a8a5d47d2
Author: Michael Weghorn <m.weghorn at posteo.de>
Date: Fri Apr 9 13:59:43 2021 +0200
tdf#95517 android: Rework app/doc lifecycle handling
and that was called when returning to the main activity
from the picture chooser. (That is just a guess, I didn't
actually verify this).
While this fix probably doesn't have much to do with what
caused that functionality to not work back in 2018,
when most of the feature was introduced but it did
not yet fully work as mentioned in
commit 8d977511e3ab755da65d34a0bd618ef3c9db90c7
Date: Mon Aug 14 11:41:30 2017 -0500
tdf#106370 Android: add ability to insert pictures
Added ability to insert pictures to Android Viewer.
You can take photo or select photo from device or
the cloud (Google photos, Dropbox). You can also
compress the picture before inserting it with multiple
compress grades. So far, inserting doesn't work for
Writer due LO native library issues (I think).
it still makes inserting pictures "just work" by now.
Change-Id: Idad9dcbba177ea12f056bc31bd6b9c08621062cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115932
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/android/source/src/java/org/libreoffice/FormattingController.java b/android/source/src/java/org/libreoffice/FormattingController.java
index a729e357bfe9..9259b2ea6cae 100644
--- a/android/source/src/java/org/libreoffice/FormattingController.java
+++ b/android/source/src/java/org/libreoffice/FormattingController.java
@@ -421,15 +421,14 @@ class FormattingController implements View.OnClickListener {
void handleActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == TAKE_PHOTO && resultCode == Activity.RESULT_OK) {
- mContext.pendingInsertGraphic = true;
+ compressAndInsertImage();
} else if (requestCode == SELECT_PHOTO && resultCode == Activity.RESULT_OK) {
getFileFromURI(data.getData());
- mContext.pendingInsertGraphic = true;
+ compressAndInsertImage();
}
}
- // Called by LOKitTileProvider when activity is resumed from photo/gallery/camera/cloud apps
- void popCompressImageGradeSelection() {
+ void compressAndInsertImage() {
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
String[] options = {mContext.getResources().getString(R.string.compress_photo_smallest_size),
mContext.getResources().getString(R.string.compress_photo_medium_size),
@@ -493,7 +492,6 @@ class FormattingController implements View.OnClickListener {
LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:InsertGraphic", rootJson.toString()));
LOKitShell.sendEvent(new LOEvent(LOEvent.REFRESH));
mContext.setDocumentChanged(true);
- mContext.pendingInsertGraphic = false;
}
private void compressImage(int grade) {
diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
index 1c04fbe5a43a..579162931d3a 100644
--- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
@@ -160,14 +160,6 @@ class LOKitTileProvider implements TileProvider {
mContext.getDocumentPartViewListAdapter().notifyDataSetChanged();
}
});
- mContext.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- if (mContext.pendingInsertGraphic) {
- mContext.getFormattingController().popCompressImageGradeSelection();
- }
- }
- });
}
public void addPart(){
diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
index 3927cc744eb4..5ce176716d66 100644
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -101,7 +101,6 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
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() {
return mLayerClient;
More information about the Libreoffice-commits
mailing list