X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FBookmarksActivity.java;h=35ac9e34e897dfa425e436ca73fdd551abbb3628;hp=b6f9bc617c1902ae8f069ceb42d587bd7fd8792f;hb=557c44e588c9c881a5a1573667a34d0355cde834;hpb=61a76e491469916f2f30aebb47b98cda7cceb557 diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java index b6f9bc61..35ac9e34 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java @@ -405,6 +405,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma // Scroll to where the deleted bookmark was located. bookmarksListView.setSelection(selectedBookmarkPosition - 5); + // Initialize `snackbarMessage`. String snackbarMessage; // Determine how many items are in the array and prepare an appropriate Snackbar message. @@ -425,31 +426,17 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma .addCallback(new Snackbar.Callback() { @Override public void onDismissed(Snackbar snackbar, int event) { - // Android Studio wants to see entries for every possible `Snackbar.Callback` even if they aren't used. switch (event) { - // The user pushed the "Undo" button. + // The user pushed the `Undo` button. case Snackbar.Callback.DISMISS_EVENT_ACTION: // Refresh the ListView to show the rows again. updateBookmarksListView(currentFolder); // Scroll to where the deleted bookmark was located. bookmarksListView.setSelection(selectedBookmarkPosition - 5); - break; - case Snackbar.Callback.DISMISS_EVENT_CONSECUTIVE: - // Do nothing and let the default behavior run. - - case Snackbar.Callback.DISMISS_EVENT_MANUAL: - // Do nothing and let the default behavior run. - - case Snackbar.Callback.DISMISS_EVENT_SWIPE: - // Do nothing and let the default behavior run. - - case Snackbar.Callback.DISMISS_EVENT_TIMEOUT: - // Do nothing and let the default behavior run. - - // The Snackbar was dismissed without the "Undo" button being pushed. + // The `Snackbar` was dismissed without the `Undo` button being pushed. default: // Delete each selected row. for (long databaseIdLong : selectedBookmarksLongArray) { @@ -505,32 +492,27 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma @Override public boolean onCreateOptionsMenu(Menu menu) { - //Inflate the menu. + // Inflate the menu. getMenuInflater().inflate(R.menu.bookmarks_options_menu, menu); - return true; - } - - @Override - public boolean onPrepareOptionsMenu(Menu menu) { - super.onPrepareOptionsMenu(menu); - + // Success. return true; } @Override public boolean onOptionsItemSelected(MenuItem menuItem) { + // Get the ID of the `MenuItem` that was selected. int menuItemId = menuItem.getItemId(); switch (menuItemId) { - case android.R.id.home: + case android.R.id.home: // The home arrow is identified as `android.R.id.home`, not just `R.id.home`. if (currentFolder.isEmpty()) { // Exit BookmarksActivity if currently in the home folder. NavUtils.navigateUpFromSameTask(this); } else { // Navigate up one folder. // Place the former parent folder in `currentFolder`. currentFolder = bookmarksDatabaseHelper.getParentFolder(currentFolder); - // Exit BookmarksActivity if currently in the home folder. + // Update `bookmarksListView`. updateBookmarksListView(currentFolder); } break;