diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-05-05 15:12:25 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-05-05 15:12:25 -0700 |
commit | 9a556cde9e3c430245d32422f3e797b742ed1574 (patch) | |
tree | 0282383c8ec338e6629ffb973b2bc3452276073b /subsonic-android | |
parent | 7d44c64368d9fb016db622a3817b3ecf0ebd5fa2 (diff) | |
download | dsub-9a556cde9e3c430245d32422f3e797b742ed1574.tar.gz dsub-9a556cde9e3c430245d32422f3e797b742ed1574.tar.bz2 dsub-9a556cde9e3c430245d32422f3e797b742ed1574.zip |
Always make sure main activity is on back stack when entering app
Diffstat (limited to 'subsonic-android')
3 files changed, 10 insertions, 3 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java index 32ddaad8..e3d6d46c 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java @@ -46,7 +46,11 @@ public class MainActivity extends SubsonicActivity { if (getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_EXIT)) { stopService(new Intent(this, DownloadServiceImpl.class)); finish(); - } + } else if(getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD)) { + Intent intent = new Intent(); + intent.setClass(this, DownloadActivity.class); + startActivity(intent); + } setContentView(R.layout.main); View bottomBar = findViewById(R.id.bottom_bar); diff --git a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java index 57d305a7..878324b7 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java @@ -50,6 +50,7 @@ public final class Constants { public static final String INTENT_EXTRA_NAME_REFRESH = "subsonic.refresh"; public static final String INTENT_EXTRA_REQUEST_SEARCH = "subsonic.requestsearch"; public static final String INTENT_EXTRA_NAME_EXIT = "subsonic.exit" ; + public static final String INTENT_EXTRA_NAME_DOWNLOAD = "subsonic.download"; // Notification IDs. public static final int NOTIFICATION_ID_PLAYING = 100; diff --git a/subsonic-android/src/github/daneren2005/dsub/util/Util.java b/subsonic-android/src/github/daneren2005/dsub/util/Util.java index 8fc03879..5ace632b 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/Util.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/Util.java @@ -52,7 +52,7 @@ import android.widget.RemoteViews; import android.widget.TextView; import android.widget.Toast; import github.daneren2005.dsub.R; -import github.daneren2005.dsub.activity.DownloadActivity; +import github.daneren2005.dsub.activity.MainActivity; import github.daneren2005.dsub.domain.MusicDirectory; import github.daneren2005.dsub.domain.PlayerState; import github.daneren2005.dsub.domain.RepeatMode; @@ -659,7 +659,9 @@ public final class Util { setupViews(smallContentView, context, song, playing); notification.contentView = smallContentView; - Intent notificationIntent = new Intent(context, DownloadActivity.class); + Intent notificationIntent = new Intent(context, MainActivity.class); + notificationIntent.putExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD, true); + notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); notification.contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0); handler.post(new Runnable() { |