diff --git a/app/src/full/AndroidManifest.xml b/app/src/full/AndroidManifest.xml
index 27b0e4314..a20da813a 100644
--- a/app/src/full/AndroidManifest.xml
+++ b/app/src/full/AndroidManifest.xml
@@ -53,6 +53,7 @@
+
@@ -60,11 +61,6 @@
-
-
-
-
-
diff --git a/app/src/full/java/a/i.java b/app/src/full/java/a/i.java
deleted file mode 100644
index f4d38f50d..000000000
--- a/app/src/full/java/a/i.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package a;
-
-import com.topjohnwu.magisk.receivers.ShortcutReceiver;
-
-public class i extends ShortcutReceiver {
- /* stub */
-}
diff --git a/app/src/full/java/com/topjohnwu/magisk/ClassMap.java b/app/src/full/java/com/topjohnwu/magisk/ClassMap.java
index b819d92a7..a9e756bca 100644
--- a/app/src/full/java/com/topjohnwu/magisk/ClassMap.java
+++ b/app/src/full/java/com/topjohnwu/magisk/ClassMap.java
@@ -2,7 +2,6 @@ package com.topjohnwu.magisk;
import com.topjohnwu.magisk.components.AboutCardRow;
import com.topjohnwu.magisk.receivers.GeneralReceiver;
-import com.topjohnwu.magisk.receivers.ShortcutReceiver;
import com.topjohnwu.magisk.services.DownloadModuleService;
import com.topjohnwu.magisk.services.UpdateCheckService;
@@ -20,7 +19,6 @@ public class ClassMap {
classMap.put(FlashActivity.class, a.f.class);
classMap.put(UpdateCheckService.class, a.g.class);
classMap.put(GeneralReceiver.class, a.h.class);
- classMap.put(ShortcutReceiver.class, a.i.class);
classMap.put(DownloadModuleService.class, a.j.class);
classMap.put(AboutCardRow.class, a.l.class);
classMap.put(SuRequestActivity.class, a.m.class);
diff --git a/app/src/full/java/com/topjohnwu/magisk/SplashActivity.java b/app/src/full/java/com/topjohnwu/magisk/SplashActivity.java
index 6ddcedf2c..98cb70ac8 100644
--- a/app/src/full/java/com/topjohnwu/magisk/SplashActivity.java
+++ b/app/src/full/java/com/topjohnwu/magisk/SplashActivity.java
@@ -7,7 +7,7 @@ import android.text.TextUtils;
import com.topjohnwu.magisk.components.BaseActivity;
import com.topjohnwu.magisk.components.Notifications;
-import com.topjohnwu.magisk.receivers.ShortcutReceiver;
+import com.topjohnwu.magisk.components.Shortcuts;
import com.topjohnwu.magisk.tasks.CheckUpdates;
import com.topjohnwu.magisk.tasks.UpdateRepos;
import com.topjohnwu.magisk.utils.AppUtils;
@@ -54,7 +54,7 @@ public class SplashActivity extends BaseActivity {
AppUtils.scheduleUpdateCheck();
// Setup shortcuts
- sendBroadcast(new Intent(this, ClassMap.get(ShortcutReceiver.class)));
+ Shortcuts.setup(this);
if (Networking.checkNetworkStatus(this)) {
// Fire update check
diff --git a/app/src/full/java/com/topjohnwu/magisk/receivers/ShortcutReceiver.java b/app/src/full/java/com/topjohnwu/magisk/components/Shortcuts.java
similarity index 58%
rename from app/src/full/java/com/topjohnwu/magisk/receivers/ShortcutReceiver.java
rename to app/src/full/java/com/topjohnwu/magisk/components/Shortcuts.java
index 15786757c..31e80c4fe 100644
--- a/app/src/full/java/com/topjohnwu/magisk/receivers/ShortcutReceiver.java
+++ b/app/src/full/java/com/topjohnwu/magisk/components/Shortcuts.java
@@ -1,6 +1,5 @@
-package com.topjohnwu.magisk.receivers;
+package com.topjohnwu.magisk.components;
-import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ShortcutInfo;
@@ -8,7 +7,6 @@ import android.content.pm.ShortcutManager;
import android.graphics.drawable.Icon;
import android.os.Build;
-import com.topjohnwu.magisk.App;
import com.topjohnwu.magisk.ClassMap;
import com.topjohnwu.magisk.Config;
import com.topjohnwu.magisk.Const;
@@ -21,58 +19,58 @@ import java.util.ArrayList;
import androidx.annotation.RequiresApi;
-public class ShortcutReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
+public class Shortcuts {
+
+ public static void setup(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
ShortcutManager manager = context.getSystemService(ShortcutManager.class);
- manager.setDynamicShortcuts(getShortCuts(App.self));
+ manager.setDynamicShortcuts(getShortCuts(context));
}
}
@RequiresApi(api = Build.VERSION_CODES.N_MR1)
- private ArrayList getShortCuts(App app) {
+ private static ArrayList getShortCuts(Context context) {
ArrayList shortCuts = new ArrayList<>();
boolean root = Shell.rootAccess();
if (Utils.showSuperUser()) {
- shortCuts.add(new ShortcutInfo.Builder(app, "superuser")
- .setShortLabel(app.getString(R.string.superuser))
- .setIntent(new Intent(app, ClassMap.get(SplashActivity.class))
+ shortCuts.add(new ShortcutInfo.Builder(context, "superuser")
+ .setShortLabel(context.getString(R.string.superuser))
+ .setIntent(new Intent(context, ClassMap.get(SplashActivity.class))
.putExtra(Const.Key.OPEN_SECTION, "superuser")
.setAction(Intent.ACTION_VIEW)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
- .setIcon(Icon.createWithResource(app, R.drawable.sc_superuser))
+ .setIcon(Icon.createWithResource(context, R.drawable.sc_superuser))
.setRank(0)
.build());
}
if (root && (boolean) Config.get(Config.Key.MAGISKHIDE)) {
- shortCuts.add(new ShortcutInfo.Builder(app, "magiskhide")
- .setShortLabel(app.getString(R.string.magiskhide))
- .setIntent(new Intent(app, ClassMap.get(SplashActivity.class))
+ shortCuts.add(new ShortcutInfo.Builder(context, "magiskhide")
+ .setShortLabel(context.getString(R.string.magiskhide))
+ .setIntent(new Intent(context, ClassMap.get(SplashActivity.class))
.putExtra(Const.Key.OPEN_SECTION, "magiskhide")
.setAction(Intent.ACTION_VIEW)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
- .setIcon(Icon.createWithResource(app, R.drawable.sc_magiskhide))
+ .setIcon(Icon.createWithResource(context, R.drawable.sc_magiskhide))
.setRank(1)
.build());
}
if (!(boolean) Config.get(Config.Key.COREONLY) && root && Config.magiskVersionCode >= 0) {
- shortCuts.add(new ShortcutInfo.Builder(app, "modules")
- .setShortLabel(app.getString(R.string.modules))
- .setIntent(new Intent(app, ClassMap.get(SplashActivity.class))
+ shortCuts.add(new ShortcutInfo.Builder(context, "modules")
+ .setShortLabel(context.getString(R.string.modules))
+ .setIntent(new Intent(context, ClassMap.get(SplashActivity.class))
.putExtra(Const.Key.OPEN_SECTION, "modules")
.setAction(Intent.ACTION_VIEW)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
- .setIcon(Icon.createWithResource(app, R.drawable.sc_extension))
+ .setIcon(Icon.createWithResource(context, R.drawable.sc_extension))
.setRank(3)
.build());
- shortCuts.add(new ShortcutInfo.Builder(app, "downloads")
- .setShortLabel(app.getString(R.string.downloads))
- .setIntent(new Intent(app, ClassMap.get(SplashActivity.class))
+ shortCuts.add(new ShortcutInfo.Builder(context, "downloads")
+ .setShortLabel(context.getString(R.string.downloads))
+ .setIntent(new Intent(context, ClassMap.get(SplashActivity.class))
.putExtra(Const.Key.OPEN_SECTION, "downloads")
.setAction(Intent.ACTION_VIEW)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK))
- .setIcon(Icon.createWithResource(app, R.drawable.sc_cloud_download))
+ .setIcon(Icon.createWithResource(context, R.drawable.sc_cloud_download))
.setRank(2)
.build());
}
diff --git a/app/src/full/java/com/topjohnwu/magisk/receivers/GeneralReceiver.java b/app/src/full/java/com/topjohnwu/magisk/receivers/GeneralReceiver.java
index 9eda0b19b..c0d2ed9fe 100644
--- a/app/src/full/java/com/topjohnwu/magisk/receivers/GeneralReceiver.java
+++ b/app/src/full/java/com/topjohnwu/magisk/receivers/GeneralReceiver.java
@@ -11,6 +11,7 @@ import com.topjohnwu.magisk.Config;
import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.SuRequestActivity;
import com.topjohnwu.magisk.components.Notifications;
+import com.topjohnwu.magisk.components.Shortcuts;
import com.topjohnwu.magisk.utils.DownloadApp;
import com.topjohnwu.magisk.utils.SuConnector;
import com.topjohnwu.superuser.Shell;
@@ -75,6 +76,9 @@ public class GeneralReceiver extends BroadcastReceiver {
app.mDB.deletePolicy(pkg);
Shell.su("magiskhide --rm " + pkg).submit();
break;
+ case Intent.ACTION_LOCALE_CHANGED:
+ Shortcuts.setup(context);
+ break;
case Const.Key.BROADCAST_MANAGER_UPDATE:
Config.managerLink = intent.getStringExtra(Const.Key.INTENT_SET_LINK);
DownloadApp.upgrade(intent.getStringExtra(Const.Key.INTENT_SET_NAME));