From d17f0407ddb001f0c907c58f4700d07cec0006c9 Mon Sep 17 00:00:00 2001 From: Adrian Campos Date: Wed, 22 Mar 2017 14:25:51 -0700 Subject: [PATCH] Fixes issue #2 by removing singleinstance from MainActivity in the manifest and handling the launch in AppShortcutLauncherActivity --- app/src/main/AndroidManifest.xml | 6 +++--- .../appshortcuts/AppShortcutLauncherActivity.java | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index bb22b22b..0ff83e28 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -20,8 +20,7 @@ android:supportsRtl="true" android:theme="@style/Theme.Phonograph.Light" tools:ignore="UnusedAttribute"> - + @@ -176,7 +175,8 @@ android:label="@string/report_an_issue" /> + android:theme="@android:style/Theme.Translucent.NoTitleBar" + android:launchMode="singleInstance"/> \ No newline at end of file diff --git a/app/src/main/java/com/kabouzeid/gramophone/appshortcuts/AppShortcutLauncherActivity.java b/app/src/main/java/com/kabouzeid/gramophone/appshortcuts/AppShortcutLauncherActivity.java index 3986c3ca..d976686d 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/appshortcuts/AppShortcutLauncherActivity.java +++ b/app/src/main/java/com/kabouzeid/gramophone/appshortcuts/AppShortcutLauncherActivity.java @@ -84,6 +84,9 @@ public class AppShortcutLauncherActivity extends Activity { //Put the bundle in the intent intent.putExtras(bundle); + //If MainActivity's already running, don't launch another instance. Instead, bring it to the top and deliver the intent to onNewIntent() + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); + //Finally, start MainActivity with those extras startActivity(intent); }