Some cleanups
This commit is contained in:
parent
863b9a410f
commit
e90c555c18
@ -52,9 +52,7 @@ public class Data {
|
|||||||
public static int suResponseType;
|
public static int suResponseType;
|
||||||
public static int suNotificationType;
|
public static int suNotificationType;
|
||||||
public static int suNamespaceMode;
|
public static int suNamespaceMode;
|
||||||
public static String localeConfig;
|
|
||||||
public static int updateChannel;
|
public static int updateChannel;
|
||||||
public static String bootFormat;
|
|
||||||
public static int repoOrder;
|
public static int repoOrder;
|
||||||
|
|
||||||
public static void loadMagiskInfo() {
|
public static void loadMagiskInfo() {
|
||||||
@ -154,8 +152,7 @@ public class Data {
|
|||||||
// config
|
// config
|
||||||
isDarkTheme = mm.prefs.getBoolean(Const.Key.DARK_THEME, false);
|
isDarkTheme = mm.prefs.getBoolean(Const.Key.DARK_THEME, false);
|
||||||
updateChannel = Utils.getPrefsInt(mm.prefs, Const.Key.UPDATE_CHANNEL, Const.Value.STABLE_CHANNEL);
|
updateChannel = Utils.getPrefsInt(mm.prefs, Const.Key.UPDATE_CHANNEL, Const.Value.STABLE_CHANNEL);
|
||||||
bootFormat = mm.prefs.getString(Const.Key.BOOT_FORMAT, ".img");
|
repoOrder = mm.prefs.getInt(Const.Key.REPO_ORDER, Const.Value.ORDER_DATE);
|
||||||
repoOrder = mm.prefs.getInt(Const.Key.REPO_ORDER, Const.Value.ORDER_NAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void writeConfig() {
|
public static void writeConfig() {
|
||||||
@ -171,8 +168,6 @@ public class Data {
|
|||||||
.putString(Const.Key.SU_MULTIUSER_MODE, String.valueOf(multiuserMode))
|
.putString(Const.Key.SU_MULTIUSER_MODE, String.valueOf(multiuserMode))
|
||||||
.putString(Const.Key.SU_MNT_NS, String.valueOf(suNamespaceMode))
|
.putString(Const.Key.SU_MNT_NS, String.valueOf(suNamespaceMode))
|
||||||
.putString(Const.Key.UPDATE_CHANNEL, String.valueOf(updateChannel))
|
.putString(Const.Key.UPDATE_CHANNEL, String.valueOf(updateChannel))
|
||||||
.putString(Const.Key.LOCALE, localeConfig)
|
|
||||||
.putString(Const.Key.BOOT_FORMAT, bootFormat)
|
|
||||||
.putInt(Const.Key.UPDATE_SERVICE_VER, Const.UPDATE_SERVICE_VER)
|
.putInt(Const.Key.UPDATE_SERVICE_VER, Const.UPDATE_SERVICE_VER)
|
||||||
.putInt(Const.Key.REPO_ORDER, repoOrder)
|
.putInt(Const.Key.REPO_ORDER, repoOrder)
|
||||||
.apply();
|
.apply();
|
||||||
|
@ -44,7 +44,6 @@ public class MagiskManager extends ContainerApp {
|
|||||||
|
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
mDB = MagiskDatabaseHelper.getInstance(this);
|
mDB = MagiskDatabaseHelper.getInstance(this);
|
||||||
LocaleManager.locale = LocaleManager.defaultLocale = Locale.getDefault();
|
|
||||||
|
|
||||||
String pkg = mDB.getStrings(Const.Key.SU_MANAGER, null);
|
String pkg = mDB.getStrings(Const.Key.SU_MANAGER, null);
|
||||||
if (pkg != null && getPackageName().equals(Const.ORIG_PKG_NAME)) {
|
if (pkg != null && getPackageName().equals(Const.ORIG_PKG_NAME)) {
|
||||||
|
@ -231,10 +231,11 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
|
|||||||
private void outputBoot(File patched) throws IOException {
|
private void outputBoot(File patched) throws IOException {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case PATCH_MODE:
|
case PATCH_MODE:
|
||||||
File dest = new File(Download.EXTERNAL_PATH, "patched_boot" + Data.bootFormat);
|
String fmt = mm.prefs.getString(Const.Key.BOOT_FORMAT, ".img");
|
||||||
|
File dest = new File(Download.EXTERNAL_PATH, "patched_boot" + fmt);
|
||||||
dest.getParentFile().mkdirs();
|
dest.getParentFile().mkdirs();
|
||||||
OutputStream out;
|
OutputStream out;
|
||||||
switch (Data.bootFormat) {
|
switch (fmt) {
|
||||||
case ".img.tar":
|
case ".img.tar":
|
||||||
out = new TarOutputStream(new BufferedOutputStream(new FileOutputStream(dest)));
|
out = new TarOutputStream(new BufferedOutputStream(new FileOutputStream(dest)));
|
||||||
((TarOutputStream) out).putNextEntry(new TarEntry(patched, "boot.img"));
|
((TarOutputStream) out).putNextEntry(new TarEntry(patched, "boot.img"));
|
||||||
|
@ -17,20 +17,20 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class LocaleManager {
|
public class LocaleManager {
|
||||||
public static Locale locale;
|
public static Locale locale = Locale.getDefault();
|
||||||
public static Locale defaultLocale;
|
public final static Locale defaultLocale = Locale.getDefault();
|
||||||
public static List<Locale> locales;
|
public static List<Locale> locales;
|
||||||
|
|
||||||
public static void setLocale() {
|
public static void setLocale() {
|
||||||
MagiskManager mm = Data.MM();
|
MagiskManager mm = Data.MM();
|
||||||
Data.localeConfig = mm.prefs.getString(Const.Key.LOCALE, "");
|
String localeConfig = mm.prefs.getString(Const.Key.LOCALE, "");
|
||||||
if (Data.localeConfig.isEmpty()) {
|
if (localeConfig.isEmpty()) {
|
||||||
locale = defaultLocale;
|
locale = defaultLocale;
|
||||||
} else {
|
} else {
|
||||||
locale = Locale.forLanguageTag(Data.localeConfig);
|
locale = Locale.forLanguageTag(localeConfig);
|
||||||
}
|
}
|
||||||
Resources res = mm.getResources();
|
Resources res = mm.getResources();
|
||||||
Configuration config = new Configuration(res.getConfiguration());
|
Configuration config = res.getConfiguration();
|
||||||
config.setLocale(locale);
|
config.setLocale(locale);
|
||||||
res.updateConfiguration(config, res.getDisplayMetrics());
|
res.updateConfiguration(config, res.getDisplayMetrics());
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="locale"
|
android:key="locale"
|
||||||
|
android:defaultValue="@string/empty"
|
||||||
android:title="@string/language"/>
|
android:title="@string/language"/>
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
@ -52,6 +53,7 @@
|
|||||||
android:title="@string/settings_boot_format_title"
|
android:title="@string/settings_boot_format_title"
|
||||||
android:entries="@array/boot_formats"
|
android:entries="@array/boot_formats"
|
||||||
android:entryValues="@array/boot_formats"
|
android:entryValues="@array/boot_formats"
|
||||||
|
android:defaultValue=".img"
|
||||||
android:summary="@string/settings_boot_format_summary"/>
|
android:summary="@string/settings_boot_format_summary"/>
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<string name="app_name" translatable="false">Magisk Manager</string>
|
<string name="app_name" translatable="false">Magisk Manager</string>
|
||||||
<string name="magisk" translatable="false">Magisk</string>
|
<string name="magisk" translatable="false">Magisk</string>
|
||||||
<string name="magiskhide" translatable="false">Magisk Hide</string>
|
<string name="magiskhide" translatable="false">Magisk Hide</string>
|
||||||
|
<string name="empty" translatable="false"/>
|
||||||
|
|
||||||
<!--Used in both stub and full app-->
|
<!--Used in both stub and full app-->
|
||||||
<string name="download_file_error">Error downloading file</string>
|
<string name="download_file_error">Error downloading file</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user