android/source/res/values-de/strings.xml                              |    1 
 android/source/res/values/strings.xml                                 |    1 
 android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java  |    2 -
 android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java |   14 
+++++-----
 4 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit f5e4a54f8c2d5b6ba570219322b08be6815ff31a
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Jan 18 12:20:34 2023 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Jan 18 13:03:54 2023 +0000

    android: Hide UI to creat new files for SDK version < 19
    
    Just like for the the case where editing is disabled
    (s. Change-Id I2f8c86f5db96a5135ff8a66a7a7078b664d05a5e,
    "android: Only offer creating docs when editing enabled"),
    just hide the UI to create new files when running on devices
    that don't support `Intent.ACTION_CREATE_DOCUMENT`, rather
    than showing the button, but then showing a message that
    creating files is not supported once the button is clicked.
    
    Change-Id: Ifedf40e22dc8906557d5364ecf9ec3a9db2315e6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145736
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/android/source/res/values-de/strings.xml 
b/android/source/res/values-de/strings.xml
index 41e8f6e2c7b1..30dd48ceb16e 100644
--- a/android/source/res/values-de/strings.xml
+++ b/android/source/res/values-de/strings.xml
@@ -156,7 +156,6 @@
     <string name="unable_to_export_pdf">PDF-Export nicht möglich</string>
     <string name="unable_to_save">Speichern nicht möglich</string>
     <string name="printing_not_supported">Ihr Gerät unterstützt Drucken 
nicht</string>
-    <string name="creating_new_files_not_supported">Erstellen neuer Dokumente 
auf diesem Gerät nicht verfügbar, benötigt Android-SDK-Version >= 19.</string>
     <string name="error">Fehler</string>
     <string name="enter_part_name">Name für Abschnitt eingeben</string>
     <string name="bmp_null">Bmp ist null!</string>
diff --git a/android/source/res/values/strings.xml 
b/android/source/res/values/strings.xml
index 207be1c2c150..2cce872808e9 100644
--- a/android/source/res/values/strings.xml
+++ b/android/source/res/values/strings.xml
@@ -156,7 +156,6 @@
     <string name="unable_to_export_pdf">Unable to export to pdf</string>
     <string name="unable_to_save">Unable to save file</string>
     <string name="printing_not_supported">Your device does not support 
printing</string>
-    <string name="creating_new_files_not_supported">Creating new files not 
supported on this device, requires Android SDK version >= 19.</string>
     <string name="error">Error</string>
     <string name="enter_part_name">Enter a part name</string>
     <string name="bmp_null">Bmp is null!</string>
diff --git 
a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java 
b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index 05a0c2f8ef21..0539a920b307 100644
--- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -180,9 +180,11 @@ public class LibreOfficeUIActivity extends 
AppCompatActivity implements Settings
 
         editFAB = findViewById(R.id.editFAB);
         editFAB.setOnClickListener(this);
-        // allow creating new docs only when experimental editing is enabled
+        // allow creating new docs only when experimental editing is enabled 
and
+        // Intent.ACTION_CREATE_DOCUMENT (used in 'createNewFileDialog') is 
available (SDK version >= 19)
         SharedPreferences preferences = 
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
-        boolean bAllowCreatingDocs = BuildConfig.ALLOW_EDITING && 
preferences.getBoolean(LibreOfficeMainActivity.ENABLE_EXPERIMENTAL_PREFS_KEY, 
false);
+        final boolean bEditingEnabled = BuildConfig.ALLOW_EDITING && 
preferences.getBoolean(LibreOfficeMainActivity.ENABLE_EXPERIMENTAL_PREFS_KEY, 
false);
+        final boolean bAllowCreatingDocs = bEditingEnabled && 
Build.VERSION.SDK_INT >= 19;
         editFAB.setVisibility(bAllowCreatingDocs ? View.VISIBLE : 
View.INVISIBLE);
 
         impressFAB = findViewById(R.id.newImpressFAB);
@@ -451,12 +453,6 @@ public class LibreOfficeUIActivity extends 
AppCompatActivity implements Settings
     public void onClick(View v) {
         int id = v.getId();
         if (id == R.id.editFAB) {
-            // Intent.ACTION_CREATE_DOCUMENT, used in 'createNewFileDialog' 
requires SDK version 19
-            if (Build.VERSION.SDK_INT < 19) {
-                Toast.makeText(this,
-                    getString(R.string.creating_new_files_not_supported), 
Toast.LENGTH_SHORT).show();
-                return;
-            }
             if (isFabMenuOpen) {
                 collapseFabMenu();
             } else {
commit 5e4bcb501f2cefaa495e59de7decbdf5a1f69d51
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Jan 18 12:10:43 2023 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Jan 18 13:03:46 2023 +0000

    android: Only offer creating docs when editing enabled
    
    Hide the UI to create new documents unless the
    experimental editing mode is enabled. There is
    little use in creating new empty documents when there
    is no way to edit them...
    
    Change-Id: I2f8c86f5db96a5135ff8a66a7a7078b664d05a5e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145735
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git 
a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java 
b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
index a44ec56e2457..54418f5cbc8f 100644
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -60,7 +60,7 @@ import java.util.UUID;
 public class LibreOfficeMainActivity extends AppCompatActivity implements 
SettingsListenerModel.OnSettingsPreferenceChangedListener {
 
     private static final String LOGTAG = "LibreOfficeMainActivity";
-    private static final String ENABLE_EXPERIMENTAL_PREFS_KEY = 
"ENABLE_EXPERIMENTAL";
+    public 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";
     private static final int REQUEST_CODE_SAVEAS = 12345;
diff --git 
a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java 
b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index a5fa78f22404..05a0c2f8ef21 100644
--- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -46,6 +46,7 @@ import android.widget.TextView;
 import android.widget.Toast;
 
 import org.libreoffice.AboutDialogFragment;
+import org.libreoffice.BuildConfig;
 import org.libreoffice.LibreOfficeMainActivity;
 import org.libreoffice.LocaleHelper;
 import org.libreoffice.R;
@@ -179,6 +180,11 @@ public class LibreOfficeUIActivity extends 
AppCompatActivity implements Settings
 
         editFAB = findViewById(R.id.editFAB);
         editFAB.setOnClickListener(this);
+        // allow creating new docs only when experimental editing is enabled
+        SharedPreferences preferences = 
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
+        boolean bAllowCreatingDocs = BuildConfig.ALLOW_EDITING && 
preferences.getBoolean(LibreOfficeMainActivity.ENABLE_EXPERIMENTAL_PREFS_KEY, 
false);
+        editFAB.setVisibility(bAllowCreatingDocs ? View.VISIBLE : 
View.INVISIBLE);
+
         impressFAB = findViewById(R.id.newImpressFAB);
         impressFAB.setOnClickListener(this);
         writerFAB = findViewById(R.id.newWriterFAB);

Reply via email to