import android.net.http.SslError;
import android.os.Bundle;
import android.support.annotation.NonNull;
-// We have to use `AppCompatDialogFragment` instead of `DialogFragment` or an error is produced on API <= 22.
+// `AppCompatDialogFragment` is used instead of `DialogFragment` to avoid an error on API <=22.
import android.support.v7.app.AppCompatDialogFragment;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
public class SslCertificateErrorDialog extends AppCompatDialogFragment {
+ // The private variables are used in `onCreate()` and `onCreateDialog()`.
private int primaryErrorInt;
private String urlWithError;
private String issuedToCName;
// Use `AlertDialog.Builder` to create the `AlertDialog`.
AlertDialog.Builder dialogBuilder;
- // Set the style according to the theme.
+ // Set the style and icon according to the theme.
if (MainWebViewActivity.darkTheme) {
+ // Set the style.
dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
+
+ // Set the icon.
+ dialogBuilder.setIcon(R.drawable.ssl_certificate_enabled_dark);
} else {
+ // Set the style.
dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight);
+
+ // Set the icon.
+ dialogBuilder.setIcon(R.drawable.ssl_certificate_enabled_light);
}
// Set the title.