import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
-// `ShortcutInfoCompat`, `ShortcutManagerCompat`, and `IconCompat` can be switched to the non-compat versions once API >= 26.
-import androidx.core.content.pm.ShortcutInfoCompat;
-import androidx.core.content.pm.ShortcutManagerCompat;
-import androidx.core.graphics.drawable.IconCompat;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.DialogFragment;
// AppCompatActivity from android.support.v7.app.AppCompatActivity must be used to have access to the SupportActionBar until the minimum API is >= 21.
public class MainWebViewActivity extends AppCompatActivity implements CreateBookmarkDialog.CreateBookmarkListener, CreateBookmarkFolderDialog.CreateBookmarkFolderListener,
- CreateHomeScreenShortcutDialog.CreateHomeScreenShortcutListener, DownloadFileDialog.DownloadFileListener, DownloadImageDialog.DownloadImageListener,
- DownloadLocationPermissionDialog.DownloadLocationPermissionDialogListener, EditBookmarkDialog.EditBookmarkListener, EditBookmarkFolderDialog.EditBookmarkFolderListener,
- HttpAuthenticationDialog.HttpAuthenticationListener, NavigationView.OnNavigationItemSelectedListener, PinnedMismatchDialog.PinnedMismatchListener,
+ DownloadFileDialog.DownloadFileListener, DownloadImageDialog.DownloadImageListener, DownloadLocationPermissionDialog.DownloadLocationPermissionDialogListener, EditBookmarkDialog.EditBookmarkListener,
+ EditBookmarkFolderDialog.EditBookmarkFolderListener, HttpAuthenticationDialog.HttpAuthenticationListener, NavigationView.OnNavigationItemSelectedListener, PinnedMismatchDialog.PinnedMismatchListener,
SslCertificateErrorDialog.SslCertificateErrorListener, UrlHistoryDialog.UrlHistoryListener {
// `darkTheme` is public static so it can be accessed from everywhere.
// `favoriteIconBitmap` is public static so it can be accessed from `CreateHomeScreenShortcutDialog`, `BookmarksActivity`, `BookmarksDatabaseViewActivity`, `CreateBookmarkDialog`,
// `CreateBookmarkFolderDialog`, `EditBookmarkDialog`, `EditBookmarkFolderDialog`, `EditBookmarkDatabaseViewDialog`, and `ViewSslCertificateDialog`. It is also used in `onCreate()`,
- // `onCreateBookmark()`, `onCreateBookmarkFolder()`, `onCreateHomeScreenShortcutCreate()`, `onSaveEditBookmark()`, `onSaveEditBookmarkFolder()`, and `applyDomainSettings()`.
+ // `onCreateBookmark()`, `onCreateBookmarkFolder()`, `onCreateHomeScreenShortcut()`, `onSaveEditBookmark()`, `onSaveEditBookmarkFolder()`, and `applyDomainSettings()`.
public static Bitmap favoriteIconBitmap;
// `favoriteIconDefaultBitmap` public static so it can be accessed from `PinnedMismatchDialog`. It is also used in `onCreate()` and `applyDomainSettings`.
public static Bitmap favoriteIconDefaultBitmap;
- // `formattedUrlString` is public static so it can be accessed from `AddDomainDialog`, `BookmarksActivity`, `DomainSettingsFragment`, `CreateBookmarkDialog`, and `PinnedMismatchDialog`.
+ // `formattedUrlString` is public static so it can be accessed from `AddDomainDialog`, `BookmarksActivity`, `DomainSettingsFragment`, `CreateBookmarkDialog`,
+ // and `PinnedMismatchDialog`.
// It is also used in `onCreate()`, `onOptionsItemSelected()`, `onNavigationItemSelected()`, `onCreateHomeScreenShortcutCreate()`, `loadUrlFromTextBox()`, and `applyProxyThroughOrbot()`.
public static String formattedUrlString;
// `orbotStatus` is public static so it can be accessed from `OrbotProxyHelper`. It is also used in `onCreate()`, `onResume()`, and `applyProxyThroughOrbot()`.
public static String orbotStatus;
- // `webViewTitle` is public static so it can be accessed from `CreateBookmarkDialog` and `CreateHomeScreenShortcutDialog`. It is also used in `onCreate()`.
+ // `webViewTitle` is public static so it can be accessed from `CreateBookmarkDialog`. It is also used in `onCreate()`.
public static String webViewTitle;
// `appliedUserAgentString` is public static so it can be accessed from `ViewSourceActivity`. It is also used in `applyDomainSettings()`.
return true;
case R.id.add_to_homescreen:
- // Show the alert dialog.
- DialogFragment createHomeScreenShortcutDialogFragment = new CreateHomeScreenShortcutDialog();
- createHomeScreenShortcutDialogFragment.show(getSupportFragmentManager(), getString(R.string.create_shortcut));
+ // Instantiate the create home screen shortcut dialog.
+ DialogFragment createHomeScreenShortcutDialogFragment = CreateHomeScreenShortcutDialog.createDialog(mainWebView.getTitle(), formattedUrlString, favoriteIconBitmap);
- //Everything else will be handled by the alert dialog and the associated listener below.
+ // Show the create home screen shortcut dialog.
+ createHomeScreenShortcutDialogFragment.show(getSupportFragmentManager(), getString(R.string.create_shortcut));
return true;
case R.id.proxy_through_orbot:
@Override
public void onCreateBookmark(DialogFragment dialogFragment) {
- // Get the `EditTexts` from the `dialogFragment`.
+ // Get the views from the dialog fragment.
EditText createBookmarkNameEditText = dialogFragment.getDialog().findViewById(R.id.create_bookmark_name_edittext);
EditText createBookmarkUrlEditText = dialogFragment.getDialog().findViewById(R.id.create_bookmark_url_edittext);
- // Extract the strings from the `EditTexts`.
+ // Extract the strings from the edit texts.
String bookmarkNameString = createBookmarkNameEditText.getText().toString();
String bookmarkUrlString = createBookmarkUrlEditText.getText().toString();
- // Convert the favoriteIcon Bitmap to a byte array. `0` is for lossless compression (the only option for a PNG).
+ // Get a copy of the favorite icon bitmap.
+ Bitmap favoriteIcon = favoriteIconBitmap;
+
+ // Scale the favorite icon bitmap down if it is larger than 256 x 256. Filtering uses bilinear interpolation.
+ if ((favoriteIcon.getHeight() > 256) || (favoriteIcon.getWidth() > 256)) {
+ favoriteIcon = Bitmap.createScaledBitmap(favoriteIcon, 256, 256, true);
+ }
+
+ // Create a favorite icon byte array output stream.
ByteArrayOutputStream favoriteIconByteArrayOutputStream = new ByteArrayOutputStream();
- favoriteIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, favoriteIconByteArrayOutputStream);
+
+ // Convert the favorite icon bitmap to a byte array. `0` is for lossless compression (the only option for a PNG).
+ favoriteIcon.compress(Bitmap.CompressFormat.PNG, 0, favoriteIconByteArrayOutputStream);
+
+ // Convert the favorite icon byte array stream to a byte array.
byte[] favoriteIconByteArray = favoriteIconByteArrayOutputStream.toByteArray();
// Display the new bookmark below the current items in the (0 indexed) list.
// Update the bookmarks cursor with the current contents of this folder.
bookmarksCursor = bookmarksDatabaseHelper.getBookmarksByDisplayOrder(currentBookmarksFolder);
- // Update the `ListView`.
+ // Update the list view.
bookmarksCursorAdapter.changeCursor(bookmarksCursor);
// Scroll to the new bookmark.
@Override
public void onCreateBookmarkFolder(DialogFragment dialogFragment) {
- // Get handles for the views in `dialogFragment`.
+ // Get handles for the views in the dialog fragment.
EditText createFolderNameEditText = dialogFragment.getDialog().findViewById(R.id.create_folder_name_edittext);
RadioButton defaultFolderIconRadioButton = dialogFragment.getDialog().findViewById(R.id.create_folder_default_icon_radiobutton);
ImageView folderIconImageView = dialogFragment.getDialog().findViewById(R.id.create_folder_default_icon);
// Get new folder name string.
String folderNameString = createFolderNameEditText.getText().toString();
- // Get the new folder icon `Bitmap`.
+ // Create a folder icon bitmap.
Bitmap folderIconBitmap;
+
+ // Set the folder icon bitmap according to the dialog.
if (defaultFolderIconRadioButton.isChecked()) { // Use the default folder icon.
- // Get the default folder icon and convert it to a `Bitmap`.
+ // Get the default folder icon drawable.
Drawable folderIconDrawable = folderIconImageView.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.
+ } else { // Use the WebView favorite icon.
+ // Get a copy of the favorite icon bitmap.
folderIconBitmap = favoriteIconBitmap;
+
+ // Scale the folder icon bitmap down if it is larger than 256 x 256. Filtering uses bilinear interpolation.
+ if ((folderIconBitmap.getHeight() > 256) || (folderIconBitmap.getWidth() > 256)) {
+ folderIconBitmap = Bitmap.createScaledBitmap(folderIconBitmap, 256, 256, true);
+ }
}
- // Convert `folderIconBitmap` to a byte array. `0` is for lossless compression (the only option for a PNG).
+ // Create a folder icon byte array output stream.
ByteArrayOutputStream folderIconByteArrayOutputStream = 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, folderIconByteArrayOutputStream);
+
+ // Convert the folder icon byte array stream to a byte array.
byte[] folderIconByteArray = folderIconByteArrayOutputStream.toByteArray();
// Move all the bookmarks down one in the display order.
}
@Override
- public void onCreateHomeScreenShortcut(DialogFragment dialogFragment) {
- // Get the shortcut name.
- EditText shortcutNameEditText = dialogFragment.getDialog().findViewById(R.id.shortcut_name_edittext);
- String shortcutNameString = shortcutNameEditText.getText().toString();
+ public void onSaveBookmark(DialogFragment dialogFragment, int selectedBookmarkDatabaseId) {
+ // Get handles for the views from `dialogFragment`.
+ EditText editBookmarkNameEditText = dialogFragment.getDialog().findViewById(R.id.edit_bookmark_name_edittext);
+ EditText editBookmarkUrlEditText = dialogFragment.getDialog().findViewById(R.id.edit_bookmark_url_edittext);
+ RadioButton currentBookmarkIconRadioButton = dialogFragment.getDialog().findViewById(R.id.edit_bookmark_current_icon_radiobutton);
+
+ // Store the bookmark strings.
+ String bookmarkNameString = editBookmarkNameEditText.getText().toString();
+ String bookmarkUrlString = editBookmarkUrlEditText.getText().toString();
+
+ // Update the bookmark.
+ if (currentBookmarkIconRadioButton.isChecked()) { // Update the bookmark without changing the favorite icon.
+ bookmarksDatabaseHelper.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString);
+ } else { // Update the bookmark using the `WebView` favorite icon.
+ // Get a copy of the favorite icon bitmap.
+ Bitmap favoriteIcon = favoriteIconBitmap;
+
+ // Scale the favorite icon bitmap down if it is larger than 256 x 256. Filtering uses bilinear interpolation.
+ if ((favoriteIcon.getHeight() > 256) || (favoriteIcon.getWidth() > 256)) {
+ favoriteIcon = Bitmap.createScaledBitmap(favoriteIcon, 256, 256, true);
+ }
+
+ // 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).
+ favoriteIcon.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, newFavoriteIconByteArray);
+ }
+
+ // Update the bookmarks cursor with the current contents of this folder.
+ bookmarksCursor = bookmarksDatabaseHelper.getBookmarksByDisplayOrder(currentBookmarksFolder);
+
+ // Update the list view.
+ bookmarksCursorAdapter.changeCursor(bookmarksCursor);
+ }
+
+ @Override
+ public void onSaveBookmarkFolder(DialogFragment dialogFragment, int selectedFolderDatabaseId) {
+ // Get handles for the views from `dialogFragment`.
+ EditText editFolderNameEditText = dialogFragment.getDialog().findViewById(R.id.edit_folder_name_edittext);
+ RadioButton currentFolderIconRadioButton = dialogFragment.getDialog().findViewById(R.id.edit_folder_current_icon_radiobutton);
+ RadioButton defaultFolderIconRadioButton = dialogFragment.getDialog().findViewById(R.id.edit_folder_default_icon_radiobutton);
+ ImageView defaultFolderIconImageView = dialogFragment.getDialog().findViewById(R.id.edit_folder_default_icon_imageview);
+
+ // Get the new folder name.
+ String newFolderNameString = editFolderNameEditText.getText().toString();
+
+ // Check if the favorite icon has changed.
+ if (currentFolderIconRadioButton.isChecked()) { // Only the name has changed.
+ // Update the name in the database.
+ bookmarksDatabaseHelper.updateFolder(selectedFolderDatabaseId, oldFolderNameString, newFolderNameString);
+ } else if (!currentFolderIconRadioButton.isChecked() && newFolderNameString.equals(oldFolderNameString)) { // Only the icon has changed.
+ // Create the new folder icon Bitmap.
+ Bitmap folderIconBitmap;
+
+ // Populate the new folder icon bitmap.
+ if (defaultFolderIconRadioButton.isChecked()) {
+ // Get the default folder icon drawable.
+ Drawable folderIconDrawable = defaultFolderIconImageView.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 = MainWebViewActivity.favoriteIconBitmap;
+
+ // Scale the folder icon bitmap down if it is larger than 256 x 256. Filtering uses bilinear interpolation.
+ if ((folderIconBitmap.getHeight() > 256) || (folderIconBitmap.getWidth() > 256)) {
+ folderIconBitmap = Bitmap.createScaledBitmap(folderIconBitmap, 256, 256, true);
+ }
+ }
+
+ // 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 icon in the database.
+ bookmarksDatabaseHelper.updateFolder(selectedFolderDatabaseId, newFolderIconByteArray);
+ } else { // The folder icon and the name have changed.
+ // Get the new folder icon `Bitmap`.
+ Bitmap folderIconBitmap;
+ if (defaultFolderIconRadioButton.isChecked()) {
+ // Get the default folder icon drawable.
+ Drawable folderIconDrawable = defaultFolderIconImageView.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 = MainWebViewActivity.favoriteIconBitmap;
- // Convert the favorite icon bitmap to an `Icon`. `IconCompat` is required until API >= 26.
- IconCompat favoriteIcon = IconCompat.createWithBitmap(favoriteIconBitmap);
+ // Scale the folder icon bitmap down if it is larger than 256 x 256. Filtering uses bilinear interpolation.
+ if ((folderIconBitmap.getHeight() > 256) || (folderIconBitmap.getWidth() > 256)) {
+ folderIconBitmap = Bitmap.createScaledBitmap(folderIconBitmap, 256, 256, true);
+ }
+ }
- // Setup the shortcut intent.
- Intent shortcutIntent = new Intent(Intent.ACTION_VIEW);
- shortcutIntent.setData(Uri.parse(formattedUrlString));
+ // Create a folder icon byte array output stream.
+ ByteArrayOutputStream newFolderIconByteArrayOutputStream = new ByteArrayOutputStream();
- // Create a shortcut info builder. The shortcut name becomes the shortcut ID.
- ShortcutInfoCompat.Builder shortcutInfoBuilder = new ShortcutInfoCompat.Builder(this, shortcutNameString);
+ // 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);
- // Add the required fields to the shortcut info builder.
- shortcutInfoBuilder.setIcon(favoriteIcon);
- shortcutInfoBuilder.setIntent(shortcutIntent);
- shortcutInfoBuilder.setShortLabel(shortcutNameString);
+ // Convert the folder icon byte array stream to a byte array.
+ byte[] newFolderIconByteArray = newFolderIconByteArrayOutputStream.toByteArray();
- // Request the pin. `ShortcutManagerCompat` can be switched to `ShortcutManager` once API >= 26.
- ShortcutManagerCompat.requestPinShortcut(this, shortcutInfoBuilder.build(), null);
+ // Update the folder name and icon in the database.
+ bookmarksDatabaseHelper.updateFolder(selectedFolderDatabaseId, oldFolderNameString, newFolderNameString, newFolderIconByteArray);
+ }
+
+ // Update the bookmarks cursor with the current contents of this folder.
+ bookmarksCursor = bookmarksDatabaseHelper.getBookmarksByDisplayOrder(currentBookmarksFolder);
+
+ // Update the `ListView`.
+ bookmarksCursorAdapter.changeCursor(bookmarksCursor);
}
@Override
}
}
- @Override
- public void onSaveBookmark(DialogFragment dialogFragment, int selectedBookmarkDatabaseId) {
- // Get handles for the views from `dialogFragment`.
- EditText editBookmarkNameEditText = dialogFragment.getDialog().findViewById(R.id.edit_bookmark_name_edittext);
- EditText editBookmarkUrlEditText = dialogFragment.getDialog().findViewById(R.id.edit_bookmark_url_edittext);
- RadioButton currentBookmarkIconRadioButton = dialogFragment.getDialog().findViewById(R.id.edit_bookmark_current_icon_radiobutton);
-
- // Store the bookmark strings.
- String bookmarkNameString = editBookmarkNameEditText.getText().toString();
- String bookmarkUrlString = editBookmarkUrlEditText.getText().toString();
-
- // Update the bookmark.
- if (currentBookmarkIconRadioButton.isChecked()) { // Update the bookmark without changing the favorite icon.
- bookmarksDatabaseHelper.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString);
- } else { // Update the bookmark using the `WebView` favorite icon.
- // Convert the favorite icon to a byte array. `0` is for lossless compression (the only option for a PNG).
- ByteArrayOutputStream newFavoriteIconByteArrayOutputStream = new ByteArrayOutputStream();
- favoriteIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, newFavoriteIconByteArrayOutputStream);
- byte[] newFavoriteIconByteArray = newFavoriteIconByteArrayOutputStream.toByteArray();
-
- // Update the bookmark and the favorite icon.
- bookmarksDatabaseHelper.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString, newFavoriteIconByteArray);
- }
-
- // Update the bookmarks cursor with the current contents of this folder.
- bookmarksCursor = bookmarksDatabaseHelper.getBookmarksByDisplayOrder(currentBookmarksFolder);
-
- // Update the `ListView`.
- bookmarksCursorAdapter.changeCursor(bookmarksCursor);
- }
-
- @Override
- public void onSaveBookmarkFolder(DialogFragment dialogFragment, int selectedFolderDatabaseId) {
- // Get handles for the views from `dialogFragment`.
- EditText editFolderNameEditText = dialogFragment.getDialog().findViewById(R.id.edit_folder_name_edittext);
- RadioButton currentFolderIconRadioButton = dialogFragment.getDialog().findViewById(R.id.edit_folder_current_icon_radiobutton);
- RadioButton defaultFolderIconRadioButton = dialogFragment.getDialog().findViewById(R.id.edit_folder_default_icon_radiobutton);
- ImageView folderIconImageView = dialogFragment.getDialog().findViewById(R.id.edit_folder_default_icon_imageview);
-
- // Get the new folder name.
- String newFolderNameString = editFolderNameEditText.getText().toString();
-
- // Check if the favorite icon has changed.
- if (currentFolderIconRadioButton.isChecked()) { // Only the name has changed.
- // Update the name in the database.
- bookmarksDatabaseHelper.updateFolder(selectedFolderDatabaseId, oldFolderNameString, newFolderNameString);
- } else if (!currentFolderIconRadioButton.isChecked() && newFolderNameString.equals(oldFolderNameString)) { // Only the icon has changed.
- // Get the new folder icon `Bitmap`.
- Bitmap folderIconBitmap;
- if (defaultFolderIconRadioButton.isChecked()) {
- // Get the default folder icon and convert it to a `Bitmap`.
- Drawable folderIconDrawable = folderIconImageView.getDrawable();
- BitmapDrawable folderIconBitmapDrawable = (BitmapDrawable) folderIconDrawable;
- folderIconBitmap = folderIconBitmapDrawable.getBitmap();
- } else { // Use the `WebView` favorite icon.
- folderIconBitmap = favoriteIconBitmap;
- }
-
- // Convert the folder `Bitmap` to a byte array. `0` is for lossless compression (the only option for a PNG).
- ByteArrayOutputStream folderIconByteArrayOutputStream = new ByteArrayOutputStream();
- folderIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, folderIconByteArrayOutputStream);
- byte[] folderIconByteArray = folderIconByteArrayOutputStream.toByteArray();
-
- // Update the folder icon in the database.
- bookmarksDatabaseHelper.updateFolder(selectedFolderDatabaseId, folderIconByteArray);
- } else { // The folder icon and the name have changed.
- // Get the new folder icon `Bitmap`.
- Bitmap folderIconBitmap;
- if (defaultFolderIconRadioButton.isChecked()) {
- // Get the default folder icon and convert it to a `Bitmap`.
- Drawable folderIconDrawable = folderIconImageView.getDrawable();
- BitmapDrawable folderIconBitmapDrawable = (BitmapDrawable) folderIconDrawable;
- folderIconBitmap = folderIconBitmapDrawable.getBitmap();
- } else { // Use the `WebView` favorite icon.
- folderIconBitmap = MainWebViewActivity.favoriteIconBitmap;
- }
-
- // Convert the folder `Bitmap` to a byte array. `0` is for lossless compression (the only option for a PNG).
- ByteArrayOutputStream folderIconByteArrayOutputStream = new ByteArrayOutputStream();
- folderIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, folderIconByteArrayOutputStream);
- byte[] folderIconByteArray = folderIconByteArrayOutputStream.toByteArray();
-
- // Update the folder name and icon in the database.
- bookmarksDatabaseHelper.updateFolder(selectedFolderDatabaseId, oldFolderNameString, newFolderNameString, folderIconByteArray);
- }
-
- // Update the bookmarks cursor with the current contents of this folder.
- bookmarksCursor = bookmarksDatabaseHelper.getBookmarksByDisplayOrder(currentBookmarksFolder);
-
- // Update the `ListView`.
- bookmarksCursorAdapter.changeCursor(bookmarksCursor);
- }
-
@Override
public void onHttpAuthenticationCancel() {
// Cancel the `HttpAuthHandler`.