aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-10-20 20:18:55 -0700
committerScott Jackson <daneren2005@gmail.com>2014-10-20 20:18:55 -0700
commit08c7e436bdd25e72a386b45e2bdbb719ffde8f3c (patch)
tree5be77dc181b75076c691dd832847520b231b5c16 /src
parentb943aabed7828afb92162f52f44788d732d14811 (diff)
downloaddsub-08c7e436bdd25e72a386b45e2bdbb719ffde8f3c.tar.gz
dsub-08c7e436bdd25e72a386b45e2bdbb719ffde8f3c.tar.bz2
dsub-08c7e436bdd25e72a386b45e2bdbb719ffde8f3c.zip
#386 Finish up tasker additions
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/activity/EditPlayActionActivity.java6
-rw-r--r--src/github/daneren2005/dsub/receiver/PlayActionReceiver.java4
-rw-r--r--src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java22
3 files changed, 20 insertions, 12 deletions
diff --git a/src/github/daneren2005/dsub/activity/EditPlayActionActivity.java b/src/github/daneren2005/dsub/activity/EditPlayActionActivity.java
index 64439289..e1f2cad3 100644
--- a/src/github/daneren2005/dsub/activity/EditPlayActionActivity.java
+++ b/src/github/daneren2005/dsub/activity/EditPlayActionActivity.java
@@ -174,9 +174,9 @@ public class EditPlayActionActivity extends SubsonicActivity {
genreButton.setText(genre);
}
- short offline = extras.getShort(Constants.PREFERENCES_KEY_OFFLINE, (short) 0);
+ int offline = extras.getInt(Constants.PREFERENCES_KEY_OFFLINE, 0);
if(offline != 0) {
- offlineSpinner.setSelection((int) offline);
+ offlineSpinner.setSelection(offline);
}
}
@@ -231,7 +231,7 @@ public class EditPlayActionActivity extends SubsonicActivity {
int offline = offlineSpinner.getSelectedItemPosition();
if(offline != 0) {
- data.putShort(Constants.PREFERENCES_KEY_OFFLINE, (short) offline);
+ data.putInt(Constants.PREFERENCES_KEY_OFFLINE, offline);
}
intent.putExtra(Constants.TASKER_EXTRA_BUNDLE, data);
diff --git a/src/github/daneren2005/dsub/receiver/PlayActionReceiver.java b/src/github/daneren2005/dsub/receiver/PlayActionReceiver.java
index 60814cc6..2c04d829 100644
--- a/src/github/daneren2005/dsub/receiver/PlayActionReceiver.java
+++ b/src/github/daneren2005/dsub/receiver/PlayActionReceiver.java
@@ -36,6 +36,10 @@ public class PlayActionReceiver extends BroadcastReceiver {
Intent start = new Intent(context, DownloadService.class);
start.setAction(DownloadService.START_PLAY);
start.putExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE, startShuffled);
+ start.putExtra(Constants.PREFERENCES_KEY_SHUFFLE_START_YEAR, data.getString(Constants.PREFERENCES_KEY_SHUFFLE_START_YEAR));
+ start.putExtra(Constants.PREFERENCES_KEY_SHUFFLE_END_YEAR, data.getString(Constants.PREFERENCES_KEY_SHUFFLE_END_YEAR));
+ start.putExtra(Constants.PREFERENCES_KEY_SHUFFLE_GENRE, data.getString(Constants.PREFERENCES_KEY_SHUFFLE_GENRE));
+ start.putExtra(Constants.PREFERENCES_KEY_OFFLINE, data.getInt(Constants.PREFERENCES_KEY_OFFLINE));
context.startService(start);
}
}
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
index 32919aff..0a1e2cdd 100644
--- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
+++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
@@ -168,27 +168,31 @@ public class DownloadServiceLifecycleSupport {
lock.unlock();
}
- short offline = intent.getShortExtra(Constants.INTENT_EXTRA_OFFLINE, 0);
- if(offline != 0) {
- boolean offline = (offline == 2);
- Util.setOffline(context, offline);
- downloadService.setOnline(!offline);
+ int offlinePref = intent.getIntExtra(Constants.PREFERENCES_KEY_OFFLINE, 0);
+ if(offlinePref != 0) {
+ boolean offline = (offlinePref == 2);
+ Util.setOffline(downloadService, offline);
+ if (offline) {
+ downloadService.clearIncomplete();
+ } else {
+ downloadService.checkDownloads();
+ }
}
if(intent.getBooleanExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE, false)) {
// Add shuffle parameters
- SharedPreferences.Editor editor = Util.getPreferences(context).edit();
- String startYear = intent.getStringExtra(Constants.PREFERENCES_KEY_SHUFFLE_START_YEAR, null);
+ SharedPreferences.Editor editor = Util.getPreferences(downloadService).edit();
+ String startYear = intent.getStringExtra(Constants.PREFERENCES_KEY_SHUFFLE_START_YEAR);
if(startYear != null) {
editor.putString(Constants.PREFERENCES_KEY_SHUFFLE_START_YEAR, startYear);
}
- String endYear = intent.getStringExtra(Constants.PREFERENCES_KEY_SHUFFLE_END_YEAR, null);
+ String endYear = intent.getStringExtra(Constants.PREFERENCES_KEY_SHUFFLE_END_YEAR);
if(endYear != null) {
editor.putString(Constants.PREFERENCES_KEY_SHUFFLE_END_YEAR, endYear);
}
- String genre = intent.getStringExtra(Constants.PREFERENCES_KEY_SHUFFLE_GENRE, null);
+ String genre = intent.getStringExtra(Constants.PREFERENCES_KEY_SHUFFLE_GENRE);
if(genre != null) {
editor.putString(Constants.PREFERENCES_KEY_SHUFFLE_GENRE, genre);
}