/*
- * Copyright 2016-2017 Soren Stoutner <soren@stoutner.com>.
+ * Copyright © 2016-2017 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
*
import android.widget.TextView;
import com.stoutner.privacybrowser.R;
+import com.stoutner.privacybrowser.activities.MainWebViewActivity;
import java.util.Locale;
// Get the activity's layout inflater.
LayoutInflater layoutInflater = getActivity().getLayoutInflater();
- // Use `AlertDialog.Builder` to create the `AlertDialog`. `R.style.lightAlertDialog` 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.save_as);
// Set the text for `downloadFileSizeTextView`.
TextView downloadFileSizeTextView = (TextView) alertDialog.findViewById(R.id.download_file_size);
- assert downloadFileSizeTextView != null; // Remove the warning on the following line that `downloadFileSizeTextView` might be `null`.
downloadFileSizeTextView.setText(fileSize);
// Set the text for `downloadFileNameTextView`.
EditText downloadFileNameTextView = (EditText) alertDialog.findViewById(R.id.download_file_name);
- assert downloadFileNameTextView != null; // Remove the warning on the following line that `downloadFileNameTextView` might be `null`.
downloadFileNameTextView.setText(downloadFileName);
// Allow the `enter` key on the keyboard to save the file from `downloadFileNameTextView`.