[Libreoffice-commits] core.git: android/source

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 12 05:20:33 UTC 2021


 android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

New commits:
commit bcb74b50920a44729ba2c88db98738a61d8d9920
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Apr 9 10:03:06 2021 +0200
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Mon Apr 12 07:19:50 2021 +0200

    android: Drop fallback of opening default doc
    
    Drop the fallback of opening 'example.odt' when
    no file to open was given.
    I see no valid way how that fallback should be
    reached, so write an error log message instead,
    just in case there is still a way to get there.
    
    Change-Id: I8b8040ba0099cba9196f65982f09c67791be01c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113880
    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 2f067b48f90b..022965e65052 100644
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -60,7 +60,6 @@ import java.util.UUID;
 public class LibreOfficeMainActivity extends AppCompatActivity implements SettingsListenerModel.OnSettingsPreferenceChangedListener {
 
     private static final String LOGTAG = "LibreOfficeMainActivity";
-    private static final String DEFAULT_DOC_PATH = "/assets/example.odt";
     private static final String ENABLE_EXPERIMENTAL_PREFS_KEY = "ENABLE_EXPERIMENTAL";
     private static final String ASSETS_EXTRACTED_PREFS_KEY = "ASSETS_EXTRACTED";
     private static final String ENABLE_DEVELOPER_PREFS_KEY = "ENABLE_DEVELOPER";
@@ -211,9 +210,8 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
                 toolbarTop.setTitle(mInputFile.getName());
             }
         } else {
-            mInputFile = new File(DEFAULT_DOC_PATH);
-            mDocumentUri = Uri.fromFile(mInputFile);
-            mbISReadOnlyMode = true;
+            Log.e(LOGTAG, "No document specified. This should never happen.");
+            return;
         }
 
         mDrawerLayout = findViewById(R.id.drawer_layout);
@@ -356,10 +354,6 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
      * Save the document.
      */
     public void saveDocument() {
-        if (!mInputFile.exists()) {
-            // Needed for handling null in case new document is not created.
-            mInputFile = new File(DEFAULT_DOC_PATH);
-        }
         Toast.makeText(this, R.string.message_saving, Toast.LENGTH_SHORT).show();
         // local save
         LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND_NOTIFY, ".uno:Save", true));


More information about the Libreoffice-commits mailing list