aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src/github
diff options
context:
space:
mode:
Diffstat (limited to 'subsonic-android/src/github')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java5
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java24
2 files changed, 21 insertions, 8 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
index 9930d2b0..cc4d93ed 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
@@ -23,6 +23,7 @@ import github.daneren2005.dsub.fragments.SelectArtistFragment;
import github.daneren2005.dsub.fragments.SelectPlaylistFragment;
import github.daneren2005.dsub.service.DownloadFile;
import github.daneren2005.dsub.service.DownloadServiceImpl;
+import github.daneren2005.dsub.util.Constants;
import github.daneren2005.dsub.util.SilentBackgroundTask;
import github.daneren2005.dsub.util.Util;
import java.util.concurrent.Executors;
@@ -42,6 +43,10 @@ public class MainActivity extends SubsonicActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ if (getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_EXIT)) {
+ stopService(new Intent(this, DownloadServiceImpl.class));
+ finish();
+ }
setContentView(R.layout.main);
View bottomBar = findViewById(R.id.bottom_bar);
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
index 043c7373..4b52196f 100644
--- a/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
+++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
@@ -39,6 +39,7 @@ import com.actionbarsherlock.app.SherlockFragment;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.activity.DownloadActivity;
import github.daneren2005.dsub.activity.HelpActivity;
+import github.daneren2005.dsub.activity.MainActivity;
import github.daneren2005.dsub.activity.SettingsActivity;
import github.daneren2005.dsub.activity.SubsonicActivity;
import github.daneren2005.dsub.domain.Artist;
@@ -116,13 +117,13 @@ public class SubsonicFragment extends SherlockFragment {
return false;
}
-
+
public boolean onContextItemSelected(MenuItem menuItem, Object selectedItem) {
Artist artist = selectedItem instanceof Artist ? (Artist) selectedItem : null;
MusicDirectory.Entry entry = selectedItem instanceof MusicDirectory.Entry ? (MusicDirectory.Entry) selectedItem : null;
List<MusicDirectory.Entry> songs = new ArrayList<MusicDirectory.Entry>(10);
songs.add(entry);
-
+
switch (menuItem.getItemId()) {
case R.id.album_menu_play_now:
downloadRecursively(entry.getId(), false, false, true, false, false);
@@ -186,7 +187,7 @@ public class SubsonicFragment extends SherlockFragment {
default:
return false;
}
-
+
return true;
}
@@ -202,8 +203,15 @@ public class SubsonicFragment extends SherlockFragment {
}
protected void exit() {
- context.stopService(new Intent(context, DownloadServiceImpl.class));
- context.finish();
+ if(context.getClass() != MainActivity.class) {
+ Intent intent = new Intent(context, MainActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ intent.putExtra(Constants.INTENT_EXTRA_NAME_EXIT, true);
+ Util.startActivityWithoutTransition(context, intent);
+ } else {
+ context.stopService(new Intent(context, DownloadServiceImpl.class));
+ context.finish();
+ }
}
public void setProgressVisible(boolean visible) {
@@ -558,7 +566,7 @@ public class SubsonicFragment extends SherlockFragment {
.setMessage(msg)
.show();
}
-
+
protected void playWebView(MusicDirectory.Entry entry) {
int maxBitrate = Util.getMaxVideoBitrate(context);
@@ -597,12 +605,12 @@ public class SubsonicFragment extends SherlockFragment {
Util.toast(context, R.string.download_no_streaming_player);
}
}
-
+
protected boolean entryExists(MusicDirectory.Entry entry) {
DownloadFile check = new DownloadFile(context, entry, false);
return check.isCompleteFileAvailable();
}
-
+
public void deleteRecursively(MusicDirectory.Entry album) {
File dir = FileUtil.getAlbumDirectory(context, album);
Util.recursiveDelete(dir);