X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fdialogs%2FCreateBookmarkFolderDialog.java;h=dfa2fc63fe884248639d7a782dc89abc630b7a4c;hb=5bcf4ca90f27512b94fb7aca4fad37b4e4774655;hp=2b6986c1a695b46c7a24a3cf9ed0a2eb8cb0dcb0;hpb=61a76e491469916f2f30aebb47b98cda7cceb557;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java index 2b6986c1..dfa2fc63 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 Soren Stoutner . + * Copyright © 2016-2017 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -62,10 +62,20 @@ public class CreateBookmarkFolderDialog extends AppCompatDialogFragment { @Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { - // Use `AlertDialog.Builder` to create the `AlertDialog`. The style formats the color of the button text. - final 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.create_folder); - // The parent view is `null` because it will be assigned by the `AlertDialog`. + + // Set the view. The parent view is `null` because it will be assigned by the `AlertDialog`. dialogBuilder.setView(getActivity().getLayoutInflater().inflate(R.layout.create_bookmark_folder_dialog, null)); // Set an `onClick()` listener for the negative button. @@ -100,7 +110,6 @@ public class CreateBookmarkFolderDialog extends AppCompatDialogFragment { // Allow the `enter` key on the keyboard to create the folder from `create_folder_name_edittext`. EditText createFolderNameEditText = (EditText) alertDialog.findViewById(R.id.create_folder_name_edittext); - assert createFolderNameEditText != null; // Remove the warning below that `createFolderNameEditText` might be `null`. createFolderNameEditText.setOnKeyListener(new View.OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down on the `enter` key, select the `PositiveButton` `Create`. @@ -119,8 +128,7 @@ public class CreateBookmarkFolderDialog extends AppCompatDialogFragment { // Display the current favorite icon. ImageView webPageIconImageView = (ImageView) alertDialog.findViewById(R.id.create_folder_web_page_icon); - assert webPageIconImageView != null; // Remove the warning that `webPageIconImageView` may be null. - webPageIconImageView.setImageBitmap(MainWebViewActivity.favoriteIcon); + webPageIconImageView.setImageBitmap(MainWebViewActivity.favoriteIconBitmap); // `onCreateDialog()` requires the return of an `AlertDialog`. return alertDialog;