]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateErrorDialog.java
Combine the light and dark Guide and About pages. https://redmine.stoutner.com/issue...
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / dialogs / SslCertificateErrorDialog.java
index 9e329434c002609cacb9d47ff8b535f80ea3f73a..c34faaad610a377668436f5a49bd3b30df4ce4a1 100644 (file)
@@ -96,7 +96,7 @@ public class SslCertificateErrorDialog extends DialogFragment {
         return thisSslCertificateErrorDialog;
     }
 
-    // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`.
+    // `@SuppressLint("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`.
     @SuppressLint("InflateParams")
     @Override
     @NonNull
@@ -264,12 +264,12 @@ public class SslCertificateErrorDialog extends DialogFragment {
         ForegroundColorSpan redColorSpan;
 
         // Set the color spans according to the theme.  The deprecated `getResources()` must be used until the minimum API >= 23.
-        if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
-            blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_400));
-            redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_900));
-        } else {
+        if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
             blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_700));
             redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_a700));
+        } else {
+            blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.violet_700));
+            redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_900));
         }
 
         // Setup the spans to display the certificate information in blue.  `SPAN_INCLUSIVE_INCLUSIVE` allows the span to grow in either direction.
@@ -373,8 +373,8 @@ public class SslCertificateErrorDialog extends DialogFragment {
     // This must run asynchronously because it involves a network request.  `String` declares the parameters.  `Void` does not declare progress units.  `SpannableStringBuilder` contains the results.
     private static class GetIpAddresses extends AsyncTask<String, Void, SpannableStringBuilder> {
         // The weak references are used to determine if the activity or the alert dialog have disappeared while the AsyncTask is running.
-        private WeakReference<Activity> activityWeakReference;
-        private WeakReference<AlertDialog> alertDialogWeakReference;
+        private final WeakReference<Activity> activityWeakReference;
+        private final WeakReference<AlertDialog> alertDialogWeakReference;
 
         GetIpAddresses(Activity activity, AlertDialog alertDialog) {
             // Populate the weak references.
@@ -403,16 +403,14 @@ public class SslCertificateErrorDialog extends DialogFragment {
 
                 // Add each IP address to the string builder.
                 for (InetAddress inetAddress : inetAddressesArray) {
-                    if (ipAddresses.length() == 0) {  // This is the first IP address.
-                        // Add the IP Address to the string builder.
-                        ipAddresses.append(inetAddress.getHostAddress());
-                    } else {  // This is not the first IP address.
+                    // Check to see if this is not the first IP address.
+                    if (ipAddresses.length() > 0) {
                         // Add a line break to the string builder first.
                         ipAddresses.append("\n");
-
-                        // Add the IP address to the string builder.
-                        ipAddresses.append(inetAddress.getHostAddress());
                     }
+
+                    // Add the IP Address to the string builder.
+                    ipAddresses.append(inetAddress.getHostAddress());
                 }
             } catch (UnknownHostException exception) {
                 // Do nothing.
@@ -432,7 +430,7 @@ public class SslCertificateErrorDialog extends DialogFragment {
 
             // Set the blue color span according to the theme.  The deprecated `getColor()` must be used until the minimum API >= 23.
             if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
-                blueColorSpan = new ForegroundColorSpan(activity.getResources().getColor(R.color.blue_400));
+                blueColorSpan = new ForegroundColorSpan(activity.getResources().getColor(R.color.violet_500));
             } else {
                 blueColorSpan = new ForegroundColorSpan(activity.getResources().getColor(R.color.blue_700));
             }