diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2022-04-21 16:34:03 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2022-04-21 21:01:05 +0200 |
commit | b68362b178f732f90fdc99073aaa5940bee409bb (patch) | |
tree | b82d64face558d743c6aab333bccfad2edf7860b /android/source | |
parent | 6515633aad867dd9e2d59378f3254e292dbdacb0 (diff) |
android: Slightly improve style in use of arrays
Addresses these warnings shown in Android Studio
for class `LibreOfficeUIActivity`:
* "Unnecessary 'Arrays.asList()' call"
* "Raw use of parameterized class 'ArrayList'"
* "Explicit type argument ShortcutInfo can be replaced with <>"
Change-Id: I083e5fcf804209fae704b19643ce80bc92126ca8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133271
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'android/source')
-rw-r--r-- | android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java index 1f7292b2a538..16e0fe8af2cd 100644 --- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java +++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java @@ -197,9 +197,9 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings SharedPreferences prefs = getSharedPreferences(EXPLORER_PREFS_KEY, MODE_PRIVATE); String recentPref = prefs.getString(RECENT_DOCUMENTS_KEY, ""); - List<String> recentFileStrings = Arrays.asList(recentPref.split(RECENT_DOCUMENTS_DELIMITER)); + String[] recentFileStrings = recentPref.split(RECENT_DOCUMENTS_DELIMITER); - final List<RecentFile> recentFiles = new ArrayList(); + final List<RecentFile> recentFiles = new ArrayList<>(); for (String recentFileString : recentFileStrings) { Uri uri = Uri.parse(recentFileString); String filename = FileUtilities.retrieveDisplayNameForDocumentUri(getContentResolver(), uri); @@ -364,7 +364,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings getContentResolver().takePersistableUriPermission(fileUri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); String newRecent = fileUri.toString(); - List<String> recentsList = new ArrayList(Arrays.asList(prefs.getString(RECENT_DOCUMENTS_KEY, "").split(RECENT_DOCUMENTS_DELIMITER))); + List<String> recentsList = new ArrayList<>(Arrays.asList(prefs.getString(RECENT_DOCUMENTS_KEY, "").split(RECENT_DOCUMENTS_DELIMITER))); // remove string if present, so that it doesn't appear multiple times recentsList.remove(newRecent); @@ -393,7 +393,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings //Remove all shortcuts, and apply new ones. shortcutManager.removeAllDynamicShortcuts(); - ArrayList<ShortcutInfo> shortcuts = new ArrayList<ShortcutInfo>(); + ArrayList<ShortcutInfo> shortcuts = new ArrayList<>(); for (String recentDoc : recentsList) { Uri docUri = Uri.parse(recentDoc); String filename = FileUtilities.retrieveDisplayNameForDocumentUri(getContentResolver(), docUri); |