mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-26 22:47:39 +00:00
Update settings
This commit is contained in:
parent
cd4dfc9861
commit
9bc0b7f183
@ -20,7 +20,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
incremental false
|
incremental true
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
@ -34,7 +34,7 @@ android {
|
|||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
dexOptions {
|
dexOptions {
|
||||||
preDexLibraries = false
|
preDexLibraries = true
|
||||||
}
|
}
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
|
@ -69,6 +69,7 @@ public class Global {
|
|||||||
initSuConfigs(context);
|
initSuConfigs(context);
|
||||||
// Initialize prefs
|
// Initialize prefs
|
||||||
prefs.edit()
|
prefs.edit()
|
||||||
|
.putBoolean("dark_theme", Configs.isDarkTheme)
|
||||||
.putBoolean("magiskhide", Utils.itemExist(false, "/magisk/.core/magiskhide/enable"))
|
.putBoolean("magiskhide", Utils.itemExist(false, "/magisk/.core/magiskhide/enable"))
|
||||||
.putBoolean("busybox", Utils.commandExists("busybox"))
|
.putBoolean("busybox", Utils.commandExists("busybox"))
|
||||||
.putBoolean("hosts", Utils.itemExist(false, "/magisk/.core/hosts"))
|
.putBoolean("hosts", Utils.itemExist(false, "/magisk/.core/hosts"))
|
||||||
|
@ -3,7 +3,9 @@ package com.topjohnwu.magisk;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
|
import android.preference.PreferenceCategory;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
@ -79,25 +81,42 @@ public class SettingsActivity extends AppCompatActivity {
|
|||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
addPreferencesFromResource(R.xml.app_settings);
|
addPreferencesFromResource(R.xml.app_settings);
|
||||||
PreferenceManager.setDefaultValues(getActivity(), R.xml.app_settings, false);
|
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||||
prefScreen = getPreferenceScreen();
|
prefScreen = getPreferenceScreen();
|
||||||
|
|
||||||
|
PreferenceCategory magiskCategory = (PreferenceCategory) findPreference("magisk");
|
||||||
|
PreferenceCategory suCategory = (PreferenceCategory) findPreference("superuser");
|
||||||
|
|
||||||
|
ListPreference suAccess = (ListPreference) findPreference("su_access");
|
||||||
|
ListPreference autoRes = (ListPreference) findPreference("su_auto_response");
|
||||||
|
ListPreference requestTimeout = (ListPreference) findPreference("su_request_timeout");
|
||||||
|
ListPreference suNotification = (ListPreference) findPreference("su_notification");
|
||||||
|
|
||||||
|
suAccess.setSummary(getResources()
|
||||||
|
.getStringArray(R.array.su_access)[Utils.getPrefsInt(prefs, "su_access", 3)]);
|
||||||
|
autoRes.setSummary(getResources()
|
||||||
|
.getStringArray(R.array.auto_response)[Utils.getPrefsInt(prefs, "su_auto_response", 0)]);
|
||||||
|
suNotification.setSummary(getResources()
|
||||||
|
.getStringArray(R.array.su_notification)[Utils.getPrefsInt(prefs, "su_notification", 1)]);
|
||||||
|
requestTimeout.setSummary(
|
||||||
|
getString(R.string.request_timeout_summary, prefs.getString("su_request_timeout", "10")));
|
||||||
|
|
||||||
CheckBoxPreference busyboxPreference = (CheckBoxPreference) findPreference("busybox");
|
CheckBoxPreference busyboxPreference = (CheckBoxPreference) findPreference("busybox");
|
||||||
CheckBoxPreference magiskhidePreference = (CheckBoxPreference) findPreference("magiskhide");
|
CheckBoxPreference magiskhidePreference = (CheckBoxPreference) findPreference("magiskhide");
|
||||||
SwitchPreference hostsPreference = (SwitchPreference) findPreference("hosts");
|
SwitchPreference hostsPreference = (SwitchPreference) findPreference("hosts");
|
||||||
Preference clear = findPreference("clear");
|
|
||||||
|
|
||||||
clear.setOnPreferenceClickListener((pref) -> {
|
findPreference("clear").setOnPreferenceClickListener((pref) -> {
|
||||||
ModuleHelper.clearRepoCache(getActivity());
|
ModuleHelper.clearRepoCache(getActivity());
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!Shell.rootAccess()) {
|
if (!Shell.rootAccess()) {
|
||||||
busyboxPreference.setEnabled(false);
|
prefScreen.removePreference(magiskCategory);
|
||||||
magiskhidePreference.setEnabled(false);
|
prefScreen.removePreference(suCategory);
|
||||||
hostsPreference.setEnabled(false);
|
|
||||||
} else {
|
} else {
|
||||||
|
if (!Global.Info.isSuClient) {
|
||||||
|
prefScreen.removePreference(suCategory);
|
||||||
|
}
|
||||||
if (Global.Info.magiskVersion < 9) {
|
if (Global.Info.magiskVersion < 9) {
|
||||||
hostsPreference.setEnabled(false);
|
hostsPreference.setEnabled(false);
|
||||||
busyboxPreference.setEnabled(false);
|
busyboxPreference.setEnabled(false);
|
||||||
|
@ -130,8 +130,8 @@
|
|||||||
<string name="settings_magiskhide_summary">Hide Magisk from various detections\nRequires reboot</string>
|
<string name="settings_magiskhide_summary">Hide Magisk from various detections\nRequires reboot</string>
|
||||||
<string name="settings_busybox_title">Enable BusyBox</string>
|
<string name="settings_busybox_title">Enable BusyBox</string>
|
||||||
<string name="settings_busybox_summary">Bind mount Magisk\'s built-in busybox to xbin\nRequires reboot</string>
|
<string name="settings_busybox_summary">Bind mount Magisk\'s built-in busybox to xbin\nRequires reboot</string>
|
||||||
<string name="settings_hosts_title">Enable systemless hosts</string>
|
<string name="settings_hosts_title">Systemless hosts</string>
|
||||||
<string name="settings_hosts_summary">Systemless support for Adblock apps</string>
|
<string name="settings_hosts_summary">Systemless hosts support for Adblock apps</string>
|
||||||
|
|
||||||
<string name="settings_su_app_adb">Apps and ADB</string>
|
<string name="settings_su_app_adb">Apps and ADB</string>
|
||||||
<string name="settings_su_app">Apps only</string>
|
<string name="settings_su_app">Apps only</string>
|
||||||
@ -141,6 +141,11 @@
|
|||||||
<string name="settings_su_request_20">20 seconds</string>
|
<string name="settings_su_request_20">20 seconds</string>
|
||||||
<string name="settings_su_request_30">30 seconds</string>
|
<string name="settings_su_request_30">30 seconds</string>
|
||||||
<string name="settings_su_request_60">60 seconds</string>
|
<string name="settings_su_request_60">60 seconds</string>
|
||||||
|
<string name="superuser_access">Superuser Access</string>
|
||||||
|
<string name="auto_response">Automatic Response</string>
|
||||||
|
<string name="request_timeout">Request Timeout</string>
|
||||||
|
<string name="superuser_notification">Superuser Notification</string>
|
||||||
|
<string name="request_timeout_summary">%1$s seconds</string>
|
||||||
|
|
||||||
<string name="settings_development_category">App Development</string>
|
<string name="settings_development_category">App Development</string>
|
||||||
<string name="settings_developer_logging_title">Enable advanced debug logging</string>
|
<string name="settings_developer_logging_title">Enable advanced debug logging</string>
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
android:key="magisk"
|
||||||
android:title="@string/magisk">
|
android:title="@string/magisk">
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
@ -41,29 +42,30 @@
|
|||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
android:key="superuser"
|
||||||
android:title="@string/superuser">
|
android:title="@string/superuser">
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="su_access"
|
android:key="su_access"
|
||||||
android:title="Superuser Access"
|
android:title="@string/superuser_access"
|
||||||
android:entries="@array/su_access"
|
android:entries="@array/su_access"
|
||||||
android:entryValues="@array/value_array" />
|
android:entryValues="@array/value_array" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="su_auto_response"
|
android:key="su_auto_response"
|
||||||
android:title="Automatic Response"
|
android:title="@string/auto_response"
|
||||||
android:entries="@array/auto_response"
|
android:entries="@array/auto_response"
|
||||||
android:entryValues="@array/value_array" />
|
android:entryValues="@array/value_array" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="su_request_timeout"
|
android:key="su_request_timeout"
|
||||||
android:title="Request Timeout"
|
android:title="@string/request_timeout"
|
||||||
android:entries="@array/request_timeout"
|
android:entries="@array/request_timeout"
|
||||||
android:entryValues="@array/request_timeout_value" />
|
android:entryValues="@array/request_timeout_value" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="su_notification"
|
android:key="su_notification"
|
||||||
android:title="Superuser Notification"
|
android:title="@string/superuser_notification"
|
||||||
android:entries="@array/su_notification"
|
android:entries="@array/su_notification"
|
||||||
android:entryValues="@array/value_array" />
|
android:entryValues="@array/value_array" />
|
||||||
|
|
||||||
|
@ -15,4 +15,8 @@ org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryErr
|
|||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|
||||||
|
# When set to true the Gradle daemon is used to run the build. For local developer builds this is our favorite property.
|
||||||
|
# The developer environment is optimized for speed and feedback so we nearly always run Gradle jobs with the daemon.
|
||||||
|
org.gradle.daemon=true
|
Loading…
x
Reference in New Issue
Block a user