mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 19:57:43 +00:00
parent
c38533e0f8
commit
7fb4777c1c
@ -123,19 +123,23 @@ public class SettingsActivity extends BaseActivity implements Topic.Subscriber {
|
||||
SwitchPreference reauth = (SwitchPreference) findPreference(Const.Key.SU_REAUTH);
|
||||
SwitchPreference fingerprint = (SwitchPreference) findPreference(Const.Key.SU_FINGERPRINT);
|
||||
|
||||
updateChannel.setOnPreferenceChangeListener((pref, o) -> {
|
||||
Data.updateChannel = Integer.parseInt((String) o);
|
||||
if (Data.updateChannel == Const.Value.CUSTOM_CHANNEL) {
|
||||
updateChannel.setOnPreferenceChangeListener((p, o) -> {
|
||||
String prev =String.valueOf(Data.updateChannel);
|
||||
int channel = Integer.parseInt((String) o);
|
||||
if (channel == Const.Value.CUSTOM_CHANNEL) {
|
||||
View v = LayoutInflater.from(requireActivity()).inflate(R.layout.custom_channel_dialog, null);
|
||||
EditText url = v.findViewById(R.id.custom_url);
|
||||
url.setText(mm.prefs.getString(Const.Key.CUSTOM_CHANNEL, ""));
|
||||
url.setText(prefs.getString(Const.Key.CUSTOM_CHANNEL, ""));
|
||||
new AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.settings_update_custom)
|
||||
.setView(v)
|
||||
.setPositiveButton(R.string.ok, (d, i) ->
|
||||
prefs.edit().putString(Const.Key.CUSTOM_CHANNEL,
|
||||
url.getText().toString()).apply())
|
||||
.setNegativeButton(R.string.close, null)
|
||||
.setNegativeButton(R.string.close, (d, i) ->
|
||||
prefs.edit().putString(Const.Key.UPDATE_CHANNEL, prev).apply())
|
||||
.setOnCancelListener(d ->
|
||||
prefs.edit().putString(Const.Key.UPDATE_CHANNEL, prev).apply())
|
||||
.show();
|
||||
}
|
||||
return true;
|
||||
@ -287,6 +291,7 @@ public class SettingsActivity extends BaseActivity implements Topic.Subscriber {
|
||||
Topic.publish(false, Topic.RELOAD_ACTIVITY);
|
||||
break;
|
||||
case Const.Key.UPDATE_CHANNEL:
|
||||
case Const.Key.CUSTOM_CHANNEL:
|
||||
CheckUpdates.check();
|
||||
break;
|
||||
case Const.Key.CHECK_UPDATES:
|
||||
@ -321,7 +326,7 @@ public class SettingsActivity extends BaseActivity implements Topic.Subscriber {
|
||||
|
||||
@Override
|
||||
public int[] getSubscribedTopics() {
|
||||
return new int[] {Topic.LOCAL_FETCH_DONE};
|
||||
return new int[] {Topic.LOCALE_FETCH_DONE};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class LocaleManager {
|
||||
}
|
||||
|
||||
Collections.sort(locales, (a, b) -> a.getDisplayName(a).compareTo(b.getDisplayName(b)));
|
||||
Topic.publish(Topic.LOCAL_FETCH_DONE);
|
||||
Topic.publish(Topic.LOCALE_FETCH_DONE);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,10 @@ public class Topic {
|
||||
public static final int REPO_LOAD_DONE = 3;
|
||||
public static final int UPDATE_CHECK_DONE = 4;
|
||||
public static final int SNET_CHECK_DONE = 5;
|
||||
public static final int LOCAL_FETCH_DONE = 6;
|
||||
public static final int LOCALE_FETCH_DONE = 6;
|
||||
|
||||
@IntDef({MAGISK_HIDE_DONE, RELOAD_ACTIVITY, MODULE_LOAD_DONE, REPO_LOAD_DONE,
|
||||
UPDATE_CHECK_DONE, SNET_CHECK_DONE, LOCAL_FETCH_DONE})
|
||||
UPDATE_CHECK_DONE, SNET_CHECK_DONE, LOCALE_FETCH_DONE})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface TopicID {}
|
||||
|
||||
|
@ -7,7 +7,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.3'
|
||||
classpath 'com.android.tools.build:gradle:3.1.4'
|
||||
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
Loading…
x
Reference in New Issue
Block a user