diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-12-08 16:34:19 +0100 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2023-12-11 19:04:49 +0100 |
commit | 4bba7fbc22f13d579e57b36e8c8e302d987e01f0 (patch) | |
tree | e7251b46406866abcd153123514eef515e88fda4 /android | |
parent | 885538d308e49a10eb67e0b6f23f3acc0a91d1e2 (diff) |
android lint: Add API level check for EXTRA_INITIAL_URI
`DocumentsContract.EXTRA_INITIAL_URI` was added in API level 26,
so only set it conditionally when that API level is avaible.
Change-Id: I6783e89f50354c017968b74cc45fb1a3b6faab83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160468
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'android')
-rw-r--r-- | android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java index 23bf8d27b6c3..cf60ff37c5da 100644 --- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -324,7 +324,9 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin intent.addCategory(Intent.CATEGORY_OPENABLE); String mimeType = getODFMimeTypeForDocument(); intent.setType(mimeType); - intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, mDocumentUri); + if (Build.VERSION.SDK_INT >= 26) { + intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, mDocumentUri); + } startActivityForResult(intent, REQUEST_CODE_SAVEAS); } @@ -351,7 +353,9 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType(FileUtilities.MIMETYPE_PDF); // suggest directory and file name based on the doc - intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, mDocumentUri); + if (Build.VERSION.SDK_INT >= 26) { + intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, mDocumentUri); + } final String displayName = toolbarTop.getTitle().toString(); final String suggestedFileName = FileUtilities.stripExtensionFromFileName(displayName) + ".pdf"; intent.putExtra(Intent.EXTRA_TITLE, suggestedFileName); |