X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fdialogs%2FMoveToFolderDialog.java;h=6eb09a31aa1134ff0c853331b5469f331e3bd70e;hb=5bcf4ca90f27512b94fb7aca4fad37b4e4774655;hp=bf86344498977e6c98d59d53f59d3f941eadbf63;hpb=61a76e491469916f2f30aebb47b98cda7cceb557;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java index bf863444..6eb09a31 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 Soren Stoutner . + * Copyright © 2016-2017 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -46,6 +46,7 @@ import android.widget.TextView; import com.stoutner.privacybrowser.R; import com.stoutner.privacybrowser.activities.BookmarksActivity; +import com.stoutner.privacybrowser.activities.MainWebViewActivity; import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper; import java.io.ByteArrayOutputStream; @@ -78,10 +79,20 @@ public class MoveToFolderDialog 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. - 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.move_to_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.move_to_folder_dialog, null)); // Set an `onClick()` listener for the negative button. @@ -159,7 +170,6 @@ public class MoveToFolderDialog extends AppCompatDialogFragment { Bitmap folderIconBitmap = BitmapFactory.decodeByteArray(folderIconByteArray, 0, folderIconByteArray.length); // Display `folderIconBitmap` in `move_to_folder_icon`. ImageView folderIconImageView = (ImageView) view.findViewById(R.id.move_to_folder_icon); - assert folderIconImageView != null; // Remove the warning below that `currentIconImageView` might be null; folderIconImageView.setImageBitmap(folderIconBitmap); // Get the folder name from `cursor` and display it in `move_to_folder_name_textview`. @@ -227,7 +237,6 @@ public class MoveToFolderDialog extends AppCompatDialogFragment { Bitmap folderIconBitmap = BitmapFactory.decodeByteArray(folderIconByteArray, 0, folderIconByteArray.length); // Display `folderIconBitmap` in `move_to_folder_icon`. ImageView folderIconImageView = (ImageView) view.findViewById(R.id.move_to_folder_icon); - assert folderIconImageView != null; // Remove the warning below that `currentIconImageView` might be null; folderIconImageView.setImageBitmap(folderIconBitmap); // Get the folder name from `cursor` and display it in `move_to_folder_name_textview`. @@ -240,7 +249,6 @@ public class MoveToFolderDialog extends AppCompatDialogFragment { // Display the ListView ListView foldersListView = (ListView) alertDialog.findViewById(R.id.move_to_folder_listview); - assert foldersListView != null; // Remove the warning below that `foldersListView` might be null. foldersListView.setAdapter(foldersCursorAdapter); // `onCreateDialog` requires the return of an `AlertDialog`.