mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-06-13 05:37:47 +02:00
@ -18,6 +18,7 @@ import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.topjohnwu.magisk.utils.Logger;
|
||||
import com.topjohnwu.magisk.utils.Utils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -45,7 +46,7 @@ public class AboutActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
String theme = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("theme", "");
|
||||
Logger.dev("AboutActivity: Theme is " + theme);
|
||||
if (theme.equals("Dark")) {
|
||||
if (Utils.isDarkTheme(theme, this)) {
|
||||
setTheme(R.style.AppTheme_dh);
|
||||
}
|
||||
setContentView(R.layout.activity_about);
|
||||
@ -76,7 +77,7 @@ public class AboutActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
appChangelog.removeSummary();
|
||||
if (theme.equals("Dark")) {
|
||||
if (Utils.isDarkTheme(theme, this)) {
|
||||
builder = new AlertDialog.Builder(this, R.style.AlertDialog_dh);
|
||||
} else {
|
||||
builder = new AlertDialog.Builder(this);
|
||||
|
@ -27,6 +27,7 @@ import android.view.View;
|
||||
import com.topjohnwu.magisk.utils.CallbackHandler;
|
||||
import com.topjohnwu.magisk.utils.Logger;
|
||||
import com.topjohnwu.magisk.utils.Shell;
|
||||
import com.topjohnwu.magisk.utils.Utils;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
@ -55,7 +56,7 @@ public class MainActivity extends AppCompatActivity
|
||||
|
||||
String theme = prefs.getString("theme", "");
|
||||
Logger.dev("MainActivity: Theme is " + theme);
|
||||
if (theme.equals("Dark")) {
|
||||
if (Utils.isDarkTheme(theme, this)) {
|
||||
setTheme(R.style.AppTheme_dh);
|
||||
alertBuilder = new AlertDialog.Builder(this, R.style.AlertDialog_dh);
|
||||
} else {
|
||||
|
@ -30,7 +30,7 @@ public class SettingsActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
String theme = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("theme", "");
|
||||
Logger.dev("AboutActivity: Theme is " + theme);
|
||||
if (theme.equals("Dark")) {
|
||||
if (Utils.isDarkTheme(theme, this)) {
|
||||
setTheme(R.style.AppTheme_dh);
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ public class SettingsActivity extends AppCompatActivity {
|
||||
String theme = prefs.getString(key, "");
|
||||
|
||||
themePreference.setSummary(theme);
|
||||
if (theme.equals("Dark")) {
|
||||
if (Utils.isDarkTheme(theme, getActivity())) {
|
||||
getActivity().getApplication().setTheme(R.style.AppTheme_dh);
|
||||
} else {
|
||||
getActivity().getApplication().setTheme(R.style.AppTheme);
|
||||
|
@ -17,7 +17,7 @@ public class SplashActivity extends AppCompatActivity {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplication());
|
||||
if (prefs.getString("theme", "").equals("Dark")) {
|
||||
if (Utils.isDarkTheme(prefs.getString("theme", null), this)) {
|
||||
setTheme(R.style.AppTheme_dh);
|
||||
}
|
||||
|
||||
|
@ -164,6 +164,10 @@ 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 class ByteArrayInOutStream extends ByteArrayOutputStream {
|
||||
public ByteArrayInputStream getInputStream() {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(buf, 0, count);
|
||||
|
@ -14,7 +14,7 @@ public class WebWindow {
|
||||
public WebWindow(String title, String url, Context context) {
|
||||
AlertDialog.Builder alert;
|
||||
String theme = PreferenceManager.getDefaultSharedPreferences(context).getString("theme", "");
|
||||
if (theme.equals("Dark")) {
|
||||
if (Utils.isDarkTheme(theme, context)) {
|
||||
alert = new AlertDialog.Builder(context, R.style.AlertDialog_dh);
|
||||
} else {
|
||||
alert = new AlertDialog.Builder(context);
|
||||
|
Reference in New Issue
Block a user