X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FBookmarks.java;h=37206f1fc1855fbae8ebd01e43b47f8c131ba55b;hp=5c059ec0820b3e5300a9530e0ded035e3c6a968f;hb=66213601459e6e2f739f2991581ffb0a1a1c0b43;hpb=b0ddee839c666ba339e374749588f910070658ee diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/Bookmarks.java b/app/src/main/java/com/stoutner/privacybrowser/activities/Bookmarks.java index 5c059ec0..37206f1f 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/Bookmarks.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/Bookmarks.java @@ -205,16 +205,14 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat // Calculate the number of selected bookmarks. int numberOfSelectedBookmarks = selectedBookmarksLongArray.length; - // Sometimes Android forgets to close the contextual app bar when all the items are deselected. + // Adjust the `mode` and the menu for the number of selected bookmarks. if (numberOfSelectedBookmarks == 0) { mode.finish(); - } - - // List the number of selected bookmarks in the subtitle. - mode.setSubtitle(numberOfSelectedBookmarks + " " + getString(R.string.selected)); + } else if (numberOfSelectedBookmarks == 1) { + // List the number of selected bookmarks in the subtitle. + mode.setSubtitle(getString(R.string.one_selected)); - if (numberOfSelectedBookmarks == 1) { - // Show the `Move Up`, `Move Down`, and `Edit` option only if 1 bookmark is selected. + // Show the `Move Up`, `Move Down`, and `Edit` options. moveBookmarkUpMenuItem.setVisible(true); moveBookmarkDownMenuItem.setVisible(true); editBookmarkMenuItem.setVisible(true); @@ -242,7 +240,11 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat moveBookmarkDownMenuItem.setEnabled(true); moveBookmarkDownMenuItem.setIcon(R.drawable.move_bookmark_down_enabled); } - } else { // Hide the MenuItems because more than one bookmark is selected. + } else { // More than one bookmark is selected. + // List the number of selected bookmarks in the subtitle. + mode.setSubtitle(numberOfSelectedBookmarks + " " + getString(R.string.selected)); + + // Hide non-applicable `MenuItems`. moveBookmarkUpMenuItem.setVisible(false); moveBookmarkDownMenuItem.setVisible(false); editBookmarkMenuItem.setVisible(false); @@ -727,7 +729,7 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat bookmarksListView.setSelection(selectedBookmarkPosition); } } else { // Don't edit the folder because the new name is not unique. - String cannot_rename_folder = getResources().getString(R.string.cannot_rename_folder) + " \"" + newFolderNameString + "\""; + String cannot_rename_folder = getResources().getString(R.string.cannot_save_folder) + " \"" + newFolderNameString + "\""; Snackbar.make(findViewById(R.id.bookmarks_coordinatorlayout), cannot_rename_folder, Snackbar.LENGTH_INDEFINITE).show(); } @@ -742,7 +744,7 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat long[] newFolderLongArray = folderListView.getCheckedItemIds(); if (newFolderLongArray.length == 0) { // No new folder was selected. - Snackbar.make(findViewById(R.id.bookmarks_coordinatorlayout), getString(R.string.cannot_move_bookmarks), Snackbar.LENGTH_LONG).show(); + Snackbar.make(findViewById(R.id.bookmarks_coordinatorlayout), getString(R.string.cannot_move_bookmarks), Snackbar.LENGTH_INDEFINITE).show(); } else { // Move the selected bookmarks. // Get the new folder database ID. int newFolderDatabaseId = (int) newFolderLongArray[0];