]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java
Create a dark theme for the `AlertDialogs`.
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / helpers / OrbotProxyHelper.java
index 2e1b22b692f6fb79b75cdcd80917da76662f8cf2..ef49afe1f9fc331da9f160050460aff800451ba7 100644 (file)
@@ -95,9 +95,20 @@ public class OrbotProxyHelper {
                     privacyBrowserContext.sendBroadcast(orbotIntent);
                 }
             } catch (PackageManager.NameNotFoundException exception){  // If an exception is thrown, Orbot is not installed.
-                // Build an `AlertDialog`.  `R.style.LightAlertDialog` formats the color of the button text.
-                AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(parentActivity, 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(parentActivity, R.style.PrivacyBrowserAlertDialogDark);
+                } else {
+                    dialogBuilder = new AlertDialog.Builder(parentActivity, R.style.PrivacyBrowserAlertDialogLight);
+                }
+
+                // Set the message.
                 dialogBuilder.setMessage(R.string.orbot_proxy_not_installed);
+
+                // Set the positive button.
                 dialogBuilder.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
                     @Override
                     public void onClick(DialogInterface dialog, int which) {
@@ -105,8 +116,10 @@ public class OrbotProxyHelper {
                     }
                 });
 
-                // Convert `dialogBuilder` to `alertDialog` and display it on the screen.
+                // Convert `dialogBuilder` to `alertDialog`.
                 AlertDialog alertDialog = dialogBuilder.create();
+
+                // Make it so.
                 alertDialog.show();
             }
         }