diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/modloaders/modpacks/api/NotificationDownloadListener.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/modloaders/modpacks/api/NotificationDownloadListener.java index 11615d14d..0dba723be 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/modloaders/modpacks/api/NotificationDownloadListener.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/modloaders/modpacks/api/NotificationDownloadListener.java @@ -14,19 +14,20 @@ import java.io.File; public class NotificationDownloadListener implements ModloaderDownloadListener { private final Context mContext; + private final Intent mIntent; private final ModLoader mModLoader; public NotificationDownloadListener(Context context, ModLoader modLoader) { mModLoader = modLoader; mContext = context.getApplicationContext(); + mIntent = new Intent(mContext, LauncherActivity.class); } @Override public void onDownloadFinished(File downloadedFile) { if(mModLoader.requiresGuiInstallation()) { ModloaderInstallTracker.saveModLoader(mContext, mModLoader, downloadedFile); - Intent mainActivityIntent = new Intent(mContext, LauncherActivity.class); - sendIntentNotification(mainActivityIntent, R.string.modpack_install_notification_success); + sendIntentNotification(R.string.modpack_install_notification_success); } } @@ -40,11 +41,11 @@ public class NotificationDownloadListener implements ModloaderDownloadListener { Tools.showErrorRemote(mContext, R.string.modpack_install_modloader_download_failed, e); } - private void sendIntentNotification(Intent intent, int localeString) { + private void sendIntentNotification(int localeString) { Tools.runOnUiThread(() -> NotificationUtils.sendBasicNotification(mContext, R.string.modpack_install_notification_title, localeString, - intent, + mIntent, NotificationUtils.PENDINGINTENT_CODE_DOWNLOAD_SERVICE, NotificationUtils.NOTIFICATION_ID_DOWNLOAD_LISTENER )); @@ -54,7 +55,7 @@ public class NotificationDownloadListener implements ModloaderDownloadListener { Tools.runOnUiThread(()->NotificationUtils.sendBasicNotification(mContext, R.string.modpack_install_notification_title, localeString, - null, + mIntent, NotificationUtils.PENDINGINTENT_CODE_DOWNLOAD_SERVICE, NotificationUtils.NOTIFICATION_ID_DOWNLOAD_LISTENER ));