From f5e4a54f8c2d5b6ba570219322b08be6815ff31a Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 18 Jan 2023 12:20:34 +0100 Subject: 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 --- android/source/res/values-de/strings.xml | 1 - android/source/res/values/strings.xml | 1 - .../src/java/org/libreoffice/ui/LibreOfficeUIActivity.java | 12 ++++-------- 3 files changed, 4 insertions(+), 10 deletions(-) (limited to 'android') 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 @@ PDF-Export nicht möglich Speichern nicht möglich Ihr Gerät unterstützt Drucken nicht - Erstellen neuer Dokumente auf diesem Gerät nicht verfügbar, benötigt Android-SDK-Version >= 19. Fehler Name für Abschnitt eingeben Bmp ist null! 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 @@ Unable to export to pdf Unable to save file Your device does not support printing - Creating new files not supported on this device, requires Android SDK version >= 19. Error Enter a part name Bmp is null! 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 { -- cgit