From 7e8a48fc4e0fb31af944c867c9e2c1e133f4a451 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sat, 20 Apr 2013 21:19:35 -0700 Subject: Fix a few DownloadFragment functions + added up on DownloadActivity --- .../daneren2005/dsub/activity/DownloadActivity.java | 21 +++++++++++++++++++-- .../dsub/fragments/DownloadFragment.java | 6 +++--- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'subsonic-android/src/github/daneren2005') diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java index b43bb58a..2204cb64 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java @@ -30,8 +30,9 @@ import java.text.SimpleDateFormat; import java.util.Date; import android.app.AlertDialog; import android.content.DialogInterface; +import android.content.Intent; import android.view.View; -import android.view.ViewGroup; +import com.actionbarsherlock.view.MenuItem; import github.daneren2005.dsub.domain.MusicDirectory; import github.daneren2005.dsub.service.DownloadFile; import github.daneren2005.dsub.service.MusicService; @@ -58,6 +59,22 @@ public class DownloadActivity extends SubsonicActivity { fragment = new DownloadFragment(); getSupportFragmentManager().beginTransaction().add(R.id.download_container, fragment).commit(); } + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeButtonEnabled(true); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if(item.getItemId() == android.R.id.home) { + Intent i = new Intent(); + i.setClass(this, MainActivity.class); + i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + startActivity(i); + return true; + } else { + return false; + } } @Override @@ -114,7 +131,7 @@ public class DownloadActivity extends SubsonicActivity { } } } - + private void savePlaylistInBackground(final String playlistName) { Util.toast(this, getResources().getString(R.string.download_playlist_saving, playlistName)); getDownloadService().setSuggestedPlaylistName(playlistName); diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java index 68140328..a38f9fcd 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java @@ -154,7 +154,7 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe DownloadFile currentDownload = getDownloadService().getCurrentPlaying(); if (currentDownload != null) { MusicDirectory.Entry currentSong = currentDownload.getSong(); - // toggleStarred(currentSong); + toggleStarred(currentSong); starButton.setImageResource(currentSong.isStarred() ? android.R.drawable.btn_star_big_on : android.R.drawable.btn_star_big_off); } } @@ -424,11 +424,11 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe registerForContextMenu(playlistView); DownloadService downloadService = getDownloadService(); - /*if (downloadService != null && getIntent().getBooleanExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE, false)) { + if (downloadService != null && context.getIntent().getBooleanExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE, false)) { context.getIntent().removeExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE); warnIfNetworkOrStorageUnavailable(); downloadService.setShufflePlayEnabled(true); - }*/ + } boolean visualizerAvailable = downloadService != null && downloadService.getVisualizerAvailable(); boolean equalizerAvailable = downloadService != null && downloadService.getEqualizerAvailable(); -- cgit v1.2.3