diff --git a/app/src/full/java/com/topjohnwu/magisk/MainActivity.java b/app/src/full/java/com/topjohnwu/magisk/MainActivity.java index 2042d3acd..b03dbaefe 100644 --- a/app/src/full/java/com/topjohnwu/magisk/MainActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/MainActivity.java @@ -110,11 +110,6 @@ public class MainActivity extends BaseActivity return true; } - @Override - public int[] getSubscribedTopics() { - return new int[] {Topic.RELOAD_ACTIVITY}; - } - @Override public void onPublish(int topic, Object[] result) { recreate(); diff --git a/app/src/full/java/com/topjohnwu/magisk/components/FlavorActivity.java b/app/src/full/java/com/topjohnwu/magisk/components/FlavorActivity.java index 6b01555c0..cf50c224f 100644 --- a/app/src/full/java/com/topjohnwu/magisk/components/FlavorActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/components/FlavorActivity.java @@ -43,11 +43,11 @@ public abstract class FlavorActivity extends AppCompatActivity implements Topic. @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); Topic.subscribe(this); if (Data.isDarkTheme && getDarkTheme() != -1) { setTheme(getDarkTheme()); } + super.onCreate(savedInstanceState); } @Override diff --git a/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java index 2c2b10c66..2768b219b 100644 --- a/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java @@ -222,7 +222,7 @@ public class SettingsFragment extends PreferenceFragmentCompat setSummary(); switch (key) { case Const.Key.DARK_THEME: - Topic.publish(false, Topic.RELOAD_ACTIVITY); + requireActivity().recreate(); break; case Const.Key.COREONLY: if (prefs.getBoolean(key, false)) { @@ -254,7 +254,7 @@ public class SettingsFragment extends PreferenceFragmentCompat break; case Const.Key.LOCALE: LocaleManager.setLocale(mm); - Topic.publish(false, Topic.RELOAD_ACTIVITY); + requireActivity().recreate(); break; case Const.Key.UPDATE_CHANNEL: case Const.Key.CUSTOM_CHANNEL: diff --git a/app/src/full/java/com/topjohnwu/magisk/utils/Topic.java b/app/src/full/java/com/topjohnwu/magisk/utils/Topic.java index e1aab2115..ee22a5913 100644 --- a/app/src/full/java/com/topjohnwu/magisk/utils/Topic.java +++ b/app/src/full/java/com/topjohnwu/magisk/utils/Topic.java @@ -12,20 +12,19 @@ import androidx.annotation.IntDef; public class Topic { public static final int MAGISK_HIDE_DONE = 0; - public static final int RELOAD_ACTIVITY = 1; - public static final int MODULE_LOAD_DONE = 2; - 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 LOCALE_FETCH_DONE = 6; + public static final int MODULE_LOAD_DONE = 1; + public static final int REPO_LOAD_DONE = 2; + public static final int UPDATE_CHECK_DONE = 3; + public static final int SNET_CHECK_DONE = 4; + public static final int LOCALE_FETCH_DONE = 5; - @IntDef({MAGISK_HIDE_DONE, RELOAD_ACTIVITY, MODULE_LOAD_DONE, REPO_LOAD_DONE, + @IntDef({MAGISK_HIDE_DONE, MODULE_LOAD_DONE, REPO_LOAD_DONE, UPDATE_CHECK_DONE, SNET_CHECK_DONE, LOCALE_FETCH_DONE}) @Retention(RetentionPolicy.SOURCE) public @interface TopicID {} // We will not dynamically add topics, so use arrays instead of hash tables - private static Store[] topicList = new Store[7]; + private static Store[] topicList = new Store[6]; public static void subscribe(Subscriber sub, @TopicID int... topics) { for (int topic : topics) {