diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-01-18 12:20:34 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-01-18 13:03:54 +0000 |
commit | f5e4a54f8c2d5b6ba570219322b08be6815ff31a (patch) | |
tree | 41c239c5076764763659c087cb2cbbbb8112da33 /android/source/src | |
parent | 5e4bcb501f2cefaa495e59de7decbdf5a1f69d51 (diff) |
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.weghorn@posteo.de>
Diffstat (limited to 'android/source/src')
-rw-r--r-- | android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java | 12 |
1 files changed, 4 insertions, 8 deletions
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 { |