+
+ // Set a listener to edit a bookmark when it is tapped.
+ bookmarksListView.setOnItemClickListener((AdapterView<?> parent, View view, int position, long id) -> {
+ // Convert the database ID to an int.
+ int databaseId = (int) id;
+
+ // Show the edit bookmark or edit bookmark folder dialog.
+ if (bookmarksDatabaseHelper.isFolder(databaseId)) {
+ // Save the current folder name, which is used in `onSaveBookmarkFolder()`.
+ oldFolderNameString = bookmarksCursor.getString(bookmarksCursor.getColumnIndexOrThrow(BookmarksDatabaseHelper.BOOKMARK_NAME));
+
+ // Show the edit bookmark folder dialog.
+ DialogFragment editBookmarkFolderDatabaseViewDialog = EditBookmarkFolderDatabaseViewDialog.folderDatabaseId(databaseId, favoriteIconBitmap);
+ editBookmarkFolderDatabaseViewDialog.show(getSupportFragmentManager(), getResources().getString(R.string.edit_folder));
+ } else {
+ // Show the edit bookmark dialog.
+ DialogFragment editBookmarkDatabaseViewDialog = EditBookmarkDatabaseViewDialog.bookmarkDatabaseId(databaseId, favoriteIconBitmap);
+ editBookmarkDatabaseViewDialog.show(getSupportFragmentManager(), getResources().getString(R.string.edit_bookmark));
+ }
+ });
+
+ // Handle long presses on the list view.
+ bookmarksListView.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {
+ // Instantiate the common variables.
+ MenuItem selectAllMenuItem;
+ MenuItem deleteMenuItem;
+ boolean deletingBookmarks;
+
+ @Override
+ public boolean onCreateActionMode(ActionMode mode, Menu menu) {
+ // Inflate the menu for the contextual app bar.
+ getMenuInflater().inflate(R.menu.bookmarks_databaseview_context_menu, menu);
+
+ // Set the title.
+ mode.setTitle(R.string.bookmarks);
+
+ // Get handles for the menu items.
+ selectAllMenuItem = menu.findItem(R.id.select_all);
+ deleteMenuItem = menu.findItem(R.id.delete);
+
+ // Disable the delete menu item if a delete is pending.
+ deleteMenuItem.setEnabled(!deletingBookmarks);
+
+ // Get the number of currently selected bookmarks.
+ int numberOfSelectedBookmarks = bookmarksListView.getCheckedItemCount();
+
+ // Set the action mode subtitle according to the number of selected bookmarks. This must be set here or it will be missing if the activity is restarted.
+ mode.setSubtitle(getString(R.string.selected) + " " + numberOfSelectedBookmarks);
+
+ // Do not show the select all menu item if all the bookmarks are already checked.
+ if (bookmarksListView.getCheckedItemCount() == bookmarksListView.getCount()) {
+ selectAllMenuItem.setVisible(false);
+ }
+
+ // Make it so.
+ return true;
+ }
+
+ @Override
+ public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
+ // Do nothing.
+ return false;
+ }
+
+ @Override
+ public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
+ // Calculate the number of selected bookmarks.
+ int numberOfSelectedBookmarks = bookmarksListView.getCheckedItemCount();
+
+ // Only run the commands if at least one bookmark is selected. Otherwise, a context menu with 0 selected bookmarks is briefly displayed.
+ if (numberOfSelectedBookmarks > 0) {
+ // Update the action mode subtitle according to the number of selected bookmarks.
+ mode.setSubtitle(getString(R.string.selected) + " " + numberOfSelectedBookmarks);
+
+ // Only show the select all menu item if all of the bookmarks are not already selected.
+ selectAllMenuItem.setVisible(bookmarksListView.getCheckedItemCount() != bookmarksListView.getCount());
+
+ // Convert the database ID to an int.
+ int databaseId = (int) id;
+
+ // If a folder was selected, also select all the contents.
+ if (checked && bookmarksDatabaseHelper.isFolder(databaseId)) {
+ selectAllBookmarksInFolder(databaseId);
+ }
+
+ // Do not allow a bookmark to be deselected if the folder is selected.
+ if (!checked) {
+ // Get the folder name.
+ String folderName = bookmarksDatabaseHelper.getParentFolderName((int) id);
+
+ // If the bookmark is not in the root folder, check to see if the folder is selected.
+ if (!folderName.isEmpty()) {
+ // Get the database ID of the folder.
+ int folderDatabaseId = bookmarksDatabaseHelper.getFolderDatabaseId(folderName);
+
+ // Move the bookmarks cursor to the first position.
+ bookmarksCursor.moveToFirst();
+
+ // Initialize the folder position variable.
+ int folderPosition = -1;
+
+ // Get the position of the folder in the bookmarks cursor.
+ while ((folderPosition < 0) && (bookmarksCursor.getPosition() < bookmarksCursor.getCount())) {
+ // Check if the folder database ID matches the bookmark database ID.
+ if (folderDatabaseId == bookmarksCursor.getInt(bookmarksCursor.getColumnIndexOrThrow(BookmarksDatabaseHelper._ID))) {
+ // Get the folder position.
+ folderPosition = bookmarksCursor.getPosition();
+
+ // Check if the folder is selected.
+ if (bookmarksListView.isItemChecked(folderPosition)) {
+ // Reselect the bookmark.
+ bookmarksListView.setItemChecked(position, true);
+
+ // Display a snackbar explaining why the bookmark cannot be deselected.
+ Snackbar.make(bookmarksListView, R.string.cannot_deselect_bookmark, Snackbar.LENGTH_LONG).show();
+ }
+ }
+
+ // Increment the bookmarks cursor.
+ bookmarksCursor.moveToNext();
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean onActionItemClicked(ActionMode mode, MenuItem menuItem) {
+ // Get a the menu item ID.
+ int menuItemId = menuItem.getItemId();
+
+ // Run the command that corresponds to the selected menu item.
+ if (menuItemId == R.id.select_all) { // Select all the bookmarks.
+ // Get the total number of bookmarks.
+ int numberOfBookmarks = bookmarksListView.getCount();
+
+ // Select them all.
+ for (int i = 0; i < numberOfBookmarks; i++) {
+ bookmarksListView.setItemChecked(i, true);
+ }
+ } else if (menuItemId == R.id.delete) { // Delete the selected bookmarks.
+ // Set the deleting bookmarks flag, which prevents the delete menu item from being enabled until the current process finishes.
+ deletingBookmarks = true;
+
+ // Get an array of the selected row IDs.
+ long[] selectedBookmarksIdsLongArray = bookmarksListView.getCheckedItemIds();
+
+ // Get an array of checked bookmarks. `.clone()` makes a copy that won't change if the list view is reloaded, which is needed for re-selecting the bookmarks on undelete.
+ SparseBooleanArray selectedBookmarksPositionsSparseBooleanArray = bookmarksListView.getCheckedItemPositions().clone();
+
+ // Update the bookmarks cursor with the current contents of the bookmarks database except for the specified database IDs.
+ switch (currentFolderDatabaseId) {
+ // Get a cursor with all the folders.
+ case ALL_FOLDERS_DATABASE_ID:
+ if (sortByDisplayOrder) {
+ bookmarksCursor = bookmarksDatabaseHelper.getAllBookmarksByDisplayOrderExcept(selectedBookmarksIdsLongArray);
+ } else {
+ bookmarksCursor = bookmarksDatabaseHelper.getAllBookmarksExcept(selectedBookmarksIdsLongArray);
+ }
+ break;
+
+ // Get a cursor for the home folder.
+ case HOME_FOLDER_DATABASE_ID:
+ if (sortByDisplayOrder) {
+ bookmarksCursor = bookmarksDatabaseHelper.getBookmarksByDisplayOrderExcept(selectedBookmarksIdsLongArray, "");
+ } else {
+ bookmarksCursor = bookmarksDatabaseHelper.getBookmarksExcept(selectedBookmarksIdsLongArray, "");
+ }
+ break;
+
+ // Display the selected folder.
+ default:
+ // Get a cursor for the selected folder.
+ if (sortByDisplayOrder) {
+ bookmarksCursor = bookmarksDatabaseHelper.getBookmarksByDisplayOrderExcept(selectedBookmarksIdsLongArray, currentFolderName);
+ } else {
+ bookmarksCursor = bookmarksDatabaseHelper.getBookmarksExcept(selectedBookmarksIdsLongArray, currentFolderName);
+ }
+ }
+
+ // Update the list view.
+ bookmarksCursorAdapter.changeCursor(bookmarksCursor);
+
+ // Create a Snackbar with the number of deleted bookmarks.
+ bookmarksDeletedSnackbar = Snackbar.make(findViewById(R.id.bookmarks_databaseview_coordinatorlayout),
+ getString(R.string.bookmarks_deleted) + " " + selectedBookmarksIdsLongArray.length, Snackbar.LENGTH_LONG)
+ .setAction(R.string.undo, view -> {
+ // Do nothing because everything will be handled by `onDismissed()` below.
+ })
+ .addCallback(new Snackbar.Callback() {
+ @SuppressLint("SwitchIntDef") // Ignore the lint warning about not handling the other possible events as they are covered by `default:`.
+ @Override
+ public void onDismissed(Snackbar snackbar, int event) {
+ if (event == Snackbar.Callback.DISMISS_EVENT_ACTION) { // The user pushed the undo button.
+ // Update the bookmarks list view with the current contents of the bookmarks database, including the "deleted bookmarks.
+ updateBookmarksListView();
+
+ // Re-select the previously selected bookmarks.
+ for (int i = 0; i < selectedBookmarksPositionsSparseBooleanArray.size(); i++) {
+ bookmarksListView.setItemChecked(selectedBookmarksPositionsSparseBooleanArray.keyAt(i), true);
+ }
+ } else { // The Snackbar was dismissed without the undo button being pushed.
+ // Delete each selected bookmark.
+ for (long databaseIdLong : selectedBookmarksIdsLongArray) {
+ // Convert `databaseIdLong` to an int.
+ int databaseIdInt = (int) databaseIdLong;
+
+ // Delete the selected bookmark.
+ bookmarksDatabaseHelper.deleteBookmark(databaseIdInt);
+ }
+ }
+
+ // Reset the deleting bookmarks flag.
+ deletingBookmarks = false;
+
+ // Enable the delete menu item.
+ deleteMenuItem.setEnabled(true);
+
+ // Close the activity if back has been pressed.
+ if (closeActivityAfterDismissingSnackbar) {
+ onBackPressed();
+ }
+ }
+ });
+
+ // Show the Snackbar.
+ bookmarksDeletedSnackbar.show();
+ }
+
+ // Consume the click.
+ return false;
+ }
+
+ @Override
+ public void onDestroyActionMode(ActionMode mode) {
+ // Do nothing.
+ }
+ });
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu.
+ getMenuInflater().inflate(R.menu.bookmarks_databaseview_options_menu, menu);
+
+ // Get a handle for the sort menu item.
+ MenuItem sortMenuItem = menu.findItem(R.id.sort);
+
+ // Change the sort menu item icon if the listview is sorted by display order, which restores the state after a restart.
+ if (sortByDisplayOrder) {
+ sortMenuItem.setIcon(R.drawable.sort_selected);
+ }
+
+ // Success.
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem menuItem) {
+ // Get the menu item ID.
+ int menuItemId = menuItem.getItemId();
+
+ // Run the command that corresponds to the selected menu item.
+ if (menuItemId == android.R.id.home) { // Go Home. The home arrow is identified as `android.R.id.home`, not just `R.id.home`.
+ // Exit the activity.
+ onBackPressed();
+ } else if (menuItemId == R.id.sort) { // Toggle the sort mode.
+ // Update the sort by display order tracker.
+ sortByDisplayOrder = !sortByDisplayOrder;
+
+ // Get a handle for the bookmarks list view.
+ ListView bookmarksListView = findViewById(R.id.bookmarks_databaseview_listview);
+
+ // Update the icon and display a snackbar.
+ if (sortByDisplayOrder) { // Sort by display order.
+ // Update the icon.
+ menuItem.setIcon(R.drawable.sort_selected);
+
+ // Display a Snackbar indicating the current sort type.
+ Snackbar.make(bookmarksListView, R.string.sorted_by_display_order, Snackbar.LENGTH_SHORT).show();
+ } else { // Sort by database id.
+ // Update the icon.
+ menuItem.setIcon(R.drawable.sort);
+
+ // Display a Snackbar indicating the current sort type.
+ Snackbar.make(bookmarksListView, R.string.sorted_by_database_id, Snackbar.LENGTH_SHORT).show();
+ }
+
+ // Update the list view.
+ updateBookmarksListView();
+ }
+
+ // Consume the event.
+ return true;
+ }
+
+ @Override
+ public void onSaveInstanceState (@NonNull Bundle savedInstanceState) {
+ // Run the default commands.
+ super.onSaveInstanceState(savedInstanceState);
+
+ // Store the class variables in the bundle.
+ savedInstanceState.putInt(CURRENT_FOLDER_DATABASE_ID, currentFolderDatabaseId);
+ savedInstanceState.putString(CURRENT_FOLDER_NAME, currentFolderName);
+ savedInstanceState.putBoolean(SORT_BY_DISPLAY_ORDER, sortByDisplayOrder);
+ }
+
+ @Override
+ public void onBackPressed() {
+ // Check to see if a snackbar is currently displayed. If so, it must be closed before existing so that a pending delete is completed before reloading the list view in the bookmarks activity.
+ if ((bookmarksDeletedSnackbar != null) && bookmarksDeletedSnackbar.isShown()) { // Close the bookmarks deleted snackbar before going home.
+ // Set the close flag.
+ closeActivityAfterDismissingSnackbar = true;
+
+ // Dismiss the snackbar.
+ bookmarksDeletedSnackbar.dismiss();
+ } else { // Go home immediately.
+ // Update the current folder in the bookmarks activity.
+ if ((currentFolderDatabaseId == ALL_FOLDERS_DATABASE_ID) || (currentFolderDatabaseId == HOME_FOLDER_DATABASE_ID)) { // All folders or the the home folder are currently displayed.
+ // Load the home folder.
+ BookmarksActivity.currentFolder = "";
+ } else { // A subfolder is currently displayed.
+ // Load the current folder.
+ BookmarksActivity.currentFolder = currentFolderName;
+ }
+
+ // Reload the bookmarks list view when returning to the bookmarks activity.
+ BookmarksActivity.restartFromBookmarksDatabaseViewActivity = true;
+
+ // Exit the bookmarks database view activity.
+ super.onBackPressed();
+ }
+ }
+
+ private void updateBookmarksListView() {
+ // Populate the bookmarks list view based on the spinner selection.
+ switch (currentFolderDatabaseId) {
+ // Get a cursor with all the folders.
+ case ALL_FOLDERS_DATABASE_ID:
+ if (sortByDisplayOrder) {
+ bookmarksCursor = bookmarksDatabaseHelper.getAllBookmarksByDisplayOrder();
+ } else {
+ bookmarksCursor = bookmarksDatabaseHelper.getAllBookmarks();
+ }
+ break;
+
+ // Get a cursor for the home folder.
+ case HOME_FOLDER_DATABASE_ID:
+ if (sortByDisplayOrder) {
+ bookmarksCursor = bookmarksDatabaseHelper.getBookmarksByDisplayOrder("");
+ } else {
+ bookmarksCursor = bookmarksDatabaseHelper.getBookmarks("");
+ }
+ break;
+
+ // Display the selected folder.
+ default:
+ // Get a cursor for the selected folder.
+ if (sortByDisplayOrder) {
+ bookmarksCursor = bookmarksDatabaseHelper.getBookmarksByDisplayOrder(currentFolderName);
+ } else {
+ bookmarksCursor = bookmarksDatabaseHelper.getBookmarks(currentFolderName);
+ }
+ }
+
+ // Update the cursor adapter if it isn't null, which happens when the activity is restarted.
+ if (bookmarksCursorAdapter != null) {
+ bookmarksCursorAdapter.changeCursor(bookmarksCursor);
+ }
+ }
+
+ private void selectAllBookmarksInFolder(int folderId) {
+ // Get a handle for the bookmarks list view.
+ ListView bookmarksListView = findViewById(R.id.bookmarks_databaseview_listview);
+
+ // Get the folder name.
+ String folderName = bookmarksDatabaseHelper.getFolderName(folderId);
+
+ // Get a cursor with the contents of the folder.
+ Cursor folderCursor = bookmarksDatabaseHelper.getBookmarks(folderName);
+
+ // Move to the beginning of the cursor.
+ folderCursor.moveToFirst();
+
+ while (folderCursor.getPosition() < folderCursor.getCount()) {
+ // Get the bookmark database ID.
+ int bookmarkId = folderCursor.getInt(folderCursor.getColumnIndexOrThrow(BookmarksDatabaseHelper._ID));
+
+ // Move the bookmarks cursor to the first position.
+ bookmarksCursor.moveToFirst();
+
+ // Initialize the bookmark position variable.
+ int bookmarkPosition = -1;
+
+ // Get the position of this bookmark in the bookmarks cursor.
+ while ((bookmarkPosition < 0) && (bookmarksCursor.getPosition() < bookmarksCursor.getCount())) {
+ // Check if the bookmark IDs match.
+ if (bookmarkId == bookmarksCursor.getInt(bookmarksCursor.getColumnIndexOrThrow(BookmarksDatabaseHelper._ID))) {
+ // Get the bookmark position.
+ bookmarkPosition = bookmarksCursor.getPosition();
+
+ // If this bookmark is a folder, select all the bookmarks inside it.
+ if (bookmarksDatabaseHelper.isFolder(bookmarkId)) {
+ selectAllBookmarksInFolder(bookmarkId);
+ }
+
+ // Select the bookmark.
+ bookmarksListView.setItemChecked(bookmarkPosition, true);
+ }
+
+ // Increment the bookmarks cursor position.
+ bookmarksCursor.moveToNext();
+ }
+
+ // Move to the next position.
+ folderCursor.moveToNext();
+ }
+ }
+
+ @Override
+ public void onSaveBookmark(DialogFragment dialogFragment, int selectedBookmarkDatabaseId, @NonNull Bitmap favoriteIconBitmap) {
+ // Get the dialog from the dialog fragment.
+ Dialog dialog = dialogFragment.getDialog();
+
+ // Remove the incorrect lint warning below that the dialog might be null.
+ assert dialog != null;
+
+ // Get handles for the views from dialog fragment.
+ RadioButton currentIconRadioButton = dialog.findViewById(R.id.current_icon_radiobutton);
+ EditText bookmarkNameEditText = dialog.findViewById(R.id.bookmark_name_edittext);
+ EditText bookmarkUrlEditText = dialog.findViewById(R.id.bookmark_url_edittext);
+ Spinner folderSpinner = dialog.findViewById(R.id.bookmark_folder_spinner);
+ EditText displayOrderEditText = dialog.findViewById(R.id.bookmark_display_order_edittext);
+
+ // Extract the bookmark information.
+ String bookmarkNameString = bookmarkNameEditText.getText().toString();
+ String bookmarkUrlString = bookmarkUrlEditText.getText().toString();
+ int folderDatabaseId = (int) folderSpinner.getSelectedItemId();
+ int displayOrderInt = Integer.parseInt(displayOrderEditText.getText().toString());
+
+ // Instantiate the parent folder name `String`.
+ String parentFolderNameString;
+
+ // Set the parent folder name.
+ if (folderDatabaseId == HOME_FOLDER_DATABASE_ID) { // The home folder is selected. Use `""`.
+ parentFolderNameString = "";
+ } else { // Get the parent folder name from the database.
+ parentFolderNameString = bookmarksDatabaseHelper.getFolderName(folderDatabaseId);
+ }
+
+ // Update the bookmark.
+ if (currentIconRadioButton.isChecked()) { // Update the bookmark without changing the favorite icon.
+ bookmarksDatabaseHelper.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString, parentFolderNameString, displayOrderInt);
+ } else { // Update the bookmark using the `WebView` favorite icon.
+ // Create a favorite icon byte array output stream.
+ ByteArrayOutputStream newFavoriteIconByteArrayOutputStream = new ByteArrayOutputStream();
+
+ // Convert the favorite icon bitmap to a byte array. `0` is for lossless compression (the only option for a PNG).
+ favoriteIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, newFavoriteIconByteArrayOutputStream);
+
+ // Convert the favorite icon byte array stream to a byte array.
+ byte[] newFavoriteIconByteArray = newFavoriteIconByteArrayOutputStream.toByteArray();
+
+ // Update the bookmark and the favorite icon.
+ bookmarksDatabaseHelper.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString, parentFolderNameString, displayOrderInt, newFavoriteIconByteArray);
+ }
+
+ // Update the list view.
+ updateBookmarksListView();
+ }
+
+ @Override
+ public void onSaveBookmarkFolder(DialogFragment dialogFragment, int selectedBookmarkDatabaseId, @NonNull Bitmap favoriteIconBitmap) {
+ // Get the dialog from the dialog fragment.
+ Dialog dialog = dialogFragment.getDialog();
+
+ // Remove the incorrect lint warning below that the dialog might be null.
+ assert dialog != null;
+
+ // Get handles for the views from dialog fragment.
+ RadioButton currentIconRadioButton = dialog.findViewById(R.id.current_icon_radiobutton);
+ RadioButton defaultIconRadioButton = dialog.findViewById(R.id.default_icon_radiobutton);
+ ImageView defaultIconImageView = dialog.findViewById(R.id.default_icon_imageview);
+ EditText folderNameEditText = dialog.findViewById(R.id.folder_name_edittext);
+ Spinner parentFolderSpinner = dialog.findViewById(R.id.parent_folder_spinner);
+ EditText displayOrderEditText = dialog.findViewById(R.id.display_order_edittext);
+
+ // Extract the folder information.
+ String newFolderNameString = folderNameEditText.getText().toString();
+ int parentFolderDatabaseId = (int) parentFolderSpinner.getSelectedItemId();
+ int displayOrderInt = Integer.parseInt(displayOrderEditText.getText().toString());
+
+ // Instantiate the parent folder name `String`.
+ String parentFolderNameString;
+
+ // Set the parent folder name.
+ if (parentFolderDatabaseId == HOME_FOLDER_DATABASE_ID) { // The home folder is selected. Use `""`.
+ parentFolderNameString = "";
+ } else { // Get the parent folder name from the database.
+ parentFolderNameString = bookmarksDatabaseHelper.getFolderName(parentFolderDatabaseId);
+ }
+
+ // Update the folder.
+ if (currentIconRadioButton.isChecked()) { // Update the folder without changing the favorite icon.
+ bookmarksDatabaseHelper.updateFolder(selectedBookmarkDatabaseId, oldFolderNameString, newFolderNameString, parentFolderNameString, displayOrderInt);
+ } else { // Update the folder and the icon.
+ // Create the new folder icon Bitmap.
+ Bitmap folderIconBitmap;
+
+ // Populate the new folder icon bitmap.
+ if (defaultIconRadioButton.isChecked()) {
+ // Get the default folder icon drawable.
+ Drawable folderIconDrawable = defaultIconImageView.getDrawable();
+
+ // Convert the folder icon drawable to a bitmap drawable.
+ BitmapDrawable folderIconBitmapDrawable = (BitmapDrawable) folderIconDrawable;
+
+ // Convert the folder icon bitmap drawable to a bitmap.
+ folderIconBitmap = folderIconBitmapDrawable.getBitmap();
+ } else { // Use the `WebView` favorite icon.
+ // Get a copy of the favorite icon bitmap.
+ folderIconBitmap = favoriteIconBitmap;
+ }
+
+ // Create a folder icon byte array output stream.
+ ByteArrayOutputStream newFolderIconByteArrayOutputStream = new ByteArrayOutputStream();
+
+ // Convert the folder icon bitmap to a byte array. `0` is for lossless compression (the only option for a PNG).
+ folderIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, newFolderIconByteArrayOutputStream);
+
+ // Convert the folder icon byte array stream to a byte array.
+ byte[] newFolderIconByteArray = newFolderIconByteArrayOutputStream.toByteArray();
+
+ // Update the folder and the icon.
+ bookmarksDatabaseHelper.updateFolder(selectedBookmarkDatabaseId, oldFolderNameString, newFolderNameString, parentFolderNameString, displayOrderInt, newFolderIconByteArray);
+ }
+
+ // Update the list view.
+ updateBookmarksListView();
+ }
+
+ @Override
+ public void onDestroy() {
+ // Close the bookmarks cursor and database.
+ bookmarksCursor.close();
+ bookmarksDatabaseHelper.close();
+
+ // Run the default commands.
+ super.onDestroy();