Various small changes

This commit is contained in:
topjohnwu
2017-01-10 22:30:05 +08:00
parent fa73b41fa7
commit 742055c43b
11 changed files with 36 additions and 53 deletions
@@ -13,7 +13,6 @@ import android.widget.Toast;
import com.topjohnwu.magisk.InstallFragment;
import com.topjohnwu.magisk.MagiskHideFragment;
import com.topjohnwu.magisk.MainActivity;
import com.topjohnwu.magisk.ModulesFragment;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ReposFragment;
@@ -292,7 +291,7 @@ public class Async {
StatusFragment.updateCheckDone.trigger();
new LoadModules().exec();
MainActivity.alertBuilder
Utils.getAlertDialogBuilder(mContext)
.setTitle(R.string.reboot_title)
.setMessage(R.string.reboot_msg)
.setPositiveButton(R.string.reboot, (dialogInterface1, i) -> Shell.sh("su -c reboot"))
@@ -1,6 +1,7 @@
package com.topjohnwu.magisk.utils;
import android.Manifest;
import android.app.AlertDialog;
import android.app.DownloadManager;
import android.content.Context;
import android.content.IntentFilter;
@@ -34,6 +35,7 @@ import javax.crypto.spec.DESKeySpec;
public class Utils {
public static boolean isDownloading = false;
public static boolean isDarkTheme;
private static final String cryptoPass = "MagiskRox666";
private static final String secret = "GTYybRBTYf5his9kQ16ZNO7qgkBJ/5MyVe4CGceAOIoXgSnnk8FTd4F1dE9p5Eus";
@@ -164,8 +166,12 @@ public class Utils {
return null;
}
public static boolean isDarkTheme(String theme, Context resources) {
return theme != null && theme.equalsIgnoreCase(resources.getString(R.string.theme_dark_value));
public static AlertDialog.Builder getAlertDialogBuilder(Context context) {
if (isDarkTheme) {
return new AlertDialog.Builder(context, R.style.AlertDialog_dh);
} else {
return new AlertDialog.Builder(context);
}
}
public static class ByteArrayInOutStream extends ByteArrayOutputStream {
@@ -1,24 +1,15 @@
package com.topjohnwu.magisk.utils;
import android.app.AlertDialog;
import android.content.Context;
import android.preference.PreferenceManager;
import android.support.v7.app.AlertDialog;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.topjohnwu.magisk.R;
public class WebWindow {
public WebWindow(String title, String url, Context context) {
AlertDialog.Builder alert;
String theme = PreferenceManager.getDefaultSharedPreferences(context).getString("theme", "");
if (Utils.isDarkTheme(theme, context)) {
alert = new AlertDialog.Builder(context, R.style.AlertDialog_dh);
} else {
alert = new AlertDialog.Builder(context);
}
AlertDialog.Builder alert = Utils.getAlertDialogBuilder(context);
alert.setTitle(title);
Logger.dev("WebView: URL = " + url);