X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fdialogs%2FEditBookmarkFolderDialog.java;h=ae56135478b5ada5a96ce0922557af5602f3a945;hb=5bcf4ca90f27512b94fb7aca4fad37b4e4774655;hp=a2a71152feb9449a7b6554b501c9f651a2f64934;hpb=61a76e491469916f2f30aebb47b98cda7cceb557;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java index a2a71152..ae561354 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Soren Stoutner . + * Copyright © 2016 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -75,10 +75,20 @@ public class EditBookmarkFolderDialog extends AppCompatDialogFragment { Cursor bookmarkCursor = BookmarksActivity.bookmarksDatabaseHelper.getBookmarkCursor(selectedBookmarkDatabaseId); bookmarkCursor.moveToFirst(); - // Use `AlertDialog.Builder` to create the `AlertDialog`. The style formats the color of the button text. - AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog); + // Use `AlertDialog.Builder` to create the `AlertDialog`. + AlertDialog.Builder dialogBuilder; + + // Set the style according to the theme. + if (MainWebViewActivity.darkTheme) { + dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark); + } else { + dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight); + } + + // Set the title. dialogBuilder.setTitle(R.string.edit_folder); - // The parent view is `null` because it will be assigned by `AlertDialog`. + + // Set the view. The parent view is `null` because it will be assigned by `AlertDialog`. dialogBuilder.setView(getActivity().getLayoutInflater().inflate(R.layout.edit_bookmark_folder_dialog, null)); // Set an `onClick()` listener for the negative button. @@ -117,17 +127,14 @@ public class EditBookmarkFolderDialog extends AppCompatDialogFragment { Bitmap currentIconBitmap = BitmapFactory.decodeByteArray(currentIconByteArray, 0, currentIconByteArray.length); // Display `currentIconBitmap` in `edit_folder_current_icon`. ImageView currentIconImageView = (ImageView) alertDialog.findViewById(R.id.edit_folder_current_icon); - assert currentIconImageView != null; // Remove the warning below that `currentIconImageView` might be null. currentIconImageView.setImageBitmap(currentIconBitmap); // Get a `Bitmap` of the favorite icon from `MainWebViewActivity` and display it in `edit_folder_web_page_favorite_icon`. ImageView webPageFavoriteIconImageView = (ImageView) alertDialog.findViewById(R.id.edit_folder_web_page_favorite_icon); - assert webPageFavoriteIconImageView != null; // Remove the warning below that `webPageFavoriteIcon` might be null. - webPageFavoriteIconImageView.setImageBitmap(MainWebViewActivity.favoriteIcon); + webPageFavoriteIconImageView.setImageBitmap(MainWebViewActivity.favoriteIconBitmap); // Load the text for `edit_folder_name_edittext`. EditText folderNameEditText = (EditText) alertDialog.findViewById(R.id.edit_folder_name_edittext); - assert folderNameEditText != null; // Remove the warning below that `bookmarkNameEditText` might be null. folderNameEditText.setText(bookmarkCursor.getString(bookmarkCursor.getColumnIndex(BookmarksDatabaseHelper.BOOKMARK_NAME))); // Allow the `enter` key on the keyboard to save the bookmark from `edit_bookmark_name_edittext`.