X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;ds=sidebyside;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FBookmarksActivity.java;h=f49c502ebd7aae4a9dd4939cd6975dbe0395dce6;hb=17174f4ceb49bbdb01e2700b2c4d3b3aa670e18e;hp=dcb603ff715678d25e6c5511ebe4ad3397804baa;hpb=b3b4105e9acd9cf8e202abef3b811d49c6c36bec;p=PrivacyBrowserAndroid.git 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 dcb603ff..f49c502e 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) { @@ -579,7 +566,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma // Convert the favoriteIcon Bitmap to a byte array. ByteArrayOutputStream favoriteIconByteArrayOutputStream = new ByteArrayOutputStream(); // `0` is for lossless compression (the only option for a PNG). - MainWebViewActivity.favoriteIcon.compress(Bitmap.CompressFormat.PNG, 0, favoriteIconByteArrayOutputStream); + MainWebViewActivity.favoriteIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, favoriteIconByteArrayOutputStream); byte[] favoriteIconByteArray = favoriteIconByteArrayOutputStream.toByteArray(); // Display the new bookmark below the current items in the (0 indexed) list. @@ -617,7 +604,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma BitmapDrawable folderIconBitmapDrawable = (BitmapDrawable) folderIconDrawable; folderIconBitmap = folderIconBitmapDrawable.getBitmap(); } else { // Assign `favoriteIcon` from the `WebView`. - folderIconBitmap = MainWebViewActivity.favoriteIcon; + folderIconBitmap = MainWebViewActivity.favoriteIconBitmap; } // Convert `folderIconBitmap` to a byte array. `0` is for lossless compression (the only option for a PNG). @@ -658,7 +645,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma bookmarksDatabaseHelper.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString); } else { // Update the bookmark using the `WebView` favorite icon. ByteArrayOutputStream newFavoriteIconByteArrayOutputStream = new ByteArrayOutputStream(); - MainWebViewActivity.favoriteIcon.compress(Bitmap.CompressFormat.PNG, 0, newFavoriteIconByteArrayOutputStream); + MainWebViewActivity.favoriteIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, newFavoriteIconByteArrayOutputStream); byte[] newFavoriteIconByteArray = newFavoriteIconByteArrayOutputStream.toByteArray(); // Update the bookmark and the favorite icon. @@ -712,7 +699,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma BitmapDrawable folderIconBitmapDrawable = (BitmapDrawable) folderIconDrawable; folderIconBitmap = folderIconBitmapDrawable.getBitmap(); } else { // Get the web page icon `ImageView` from the `Dialog`. - folderIconBitmap = MainWebViewActivity.favoriteIcon; + folderIconBitmap = MainWebViewActivity.favoriteIconBitmap; } // Convert the folder `Bitmap` to a byte array. `0` is for lossless compression (the only option for a PNG).