android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java | 21 +++++----- 1 file changed, 12 insertions(+), 9 deletions(-)
New commits: commit 40115df50102bd5314a93f54042ae6d035c1f685 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Apr 1 09:38:55 2021 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu Apr 1 17:18:23 2021 +0200 android: Extract opening of file to separate method 'openDocument' The method will also be used from elsewhere in a follow-up commit. Change-Id: I94cbdfa9faf54fcb655233f43d13ced8740b88a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113456 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java index 539b355cc932..f9afa9578d56 100644 --- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java +++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java @@ -467,15 +467,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_OPEN_FILECHOOSER && resultCode == RESULT_OK) { final Uri fileUri = data.getData(); - - // "forward" to LibreOfficeMainActivity to open the file - Intent intent = new Intent(Intent.ACTION_VIEW, fileUri); - intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); - String packageName = getApplicationContext().getPackageName(); - ComponentName componentName = new ComponentName(packageName, - LibreOfficeMainActivity.class.getName()); - intent.setComponent(componentName); - startActivity(intent); + openDocument(fileUri); } else if (requestCode == REQUEST_CODE_CREATE_NEW_DOCUMENT) { // "forward" to LibreOfficeMainActivity to create + open the file final Uri fileUri = data.getData(); @@ -667,6 +659,17 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings }.execute(document); } + private void openDocument(final Uri documentUri) { + // "forward" to LibreOfficeMainActivity to open the file + Intent intent = new Intent(Intent.ACTION_VIEW, documentUri); + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); + String packageName = getApplicationContext().getPackageName(); + ComponentName componentName = new ComponentName(packageName, + LibreOfficeMainActivity.class.getName()); + intent.setComponent(componentName); + startActivity(intent); + } + private void createNewFileDialog() { final String extension; if (newDocType == DocumentType.WRITER) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits