]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java
Remove AsyncTask from SSLCertificateErrorDialog. https://redmine.stoutner.com/issues/987
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / activities / BookmarksActivity.java
index 05bb2f5874146baa3f2c1ddcfc21ffdcf3af1070..8c14b0ef3fea8db6387d85bcdb2b9c2f389aa359 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2016-2023 Soren Stoutner <soren@stoutner.com>.
  *
  * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
  *
@@ -287,7 +287,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                     // Adjust the ActionMode and the menu according to the number of selected bookmarks.
                     if (numberOfSelectedBookmarks == 1) {  // One bookmark is selected.
                         // List the number of selected bookmarks in the subtitle.
-                        mode.setSubtitle(getString(R.string.selected) + "  1");
+                        mode.setSubtitle(getString(R.string.selected) + "1");
 
                         // Show the `Move Up`, `Move Down`, and  `Edit` options.
                         moveBookmarkUpMenuItem.setVisible(true);
@@ -298,7 +298,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                         updateMoveIcons();
                     } else {  // More than one bookmark is selected.
                         // List the number of selected bookmarks in the subtitle.
-                        mode.setSubtitle(getString(R.string.selected) + "  " + numberOfSelectedBookmarks);
+                        mode.setSubtitle(getString(R.string.selected) + numberOfSelectedBookmarks);
 
                         // Hide non-applicable `MenuItems`.
                         moveBookmarkUpMenuItem.setVisible(false);
@@ -504,7 +504,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                     bookmarksCursorAdapter.changeCursor(bookmarksCursor);
 
                     // Create a Snackbar with the number of deleted bookmarks.
-                    bookmarksDeletedSnackbar = Snackbar.make(findViewById(R.id.bookmarks_coordinatorlayout), getString(R.string.bookmarks_deleted) + "  " + numberOfBookmarksToDelete,
+                    bookmarksDeletedSnackbar = Snackbar.make(findViewById(R.id.bookmarks_coordinatorlayout), getString(R.string.bookmarks_deleted) + numberOfBookmarksToDelete,
                             Snackbar.LENGTH_LONG)
                             .setAction(R.string.undo, view -> {
                                 // Do nothing because everything will be handled by `onDismissed()` below.
@@ -625,12 +625,9 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                 // Get the checked bookmarks array list.
                 ArrayList<Integer> checkedBookmarksArrayList = savedInstanceState.getIntegerArrayList(CHECKED_BOOKMARKS_ARRAY_LIST);
 
-                // Check each previously checked bookmark in the list view.  When the minimum API >= 24 a `forEach()` command can be used instead.
-                if (checkedBookmarksArrayList != null) {
-                    for (int i = 0; i < checkedBookmarksArrayList.size(); i++) {
-                        bookmarksListView.setItemChecked(checkedBookmarksArrayList.get(i), true);
-                    }
-                }
+                // Check each previously checked bookmark in the list view.
+                if (checkedBookmarksArrayList != null)
+                    checkedBookmarksArrayList.forEach((position) -> bookmarksListView.setItemChecked(position, true));
             });
         }