android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
New commits: commit b68362b178f732f90fdc99073aaa5940bee409bb Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Apr 21 16:34:03 2022 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu Apr 21 21:01:05 2022 +0200 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.wegh...@posteo.de> 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);