aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/activity/SettingsActivity.java2
-rw-r--r--src/github/daneren2005/dsub/fragments/DownloadFragment.java43
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java12
-rw-r--r--src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java1
-rw-r--r--src/github/daneren2005/dsub/view/AlbumView.java9
5 files changed, 57 insertions, 10 deletions
diff --git a/src/github/daneren2005/dsub/activity/SettingsActivity.java b/src/github/daneren2005/dsub/activity/SettingsActivity.java
index 375e8505..7cebdbdd 100644
--- a/src/github/daneren2005/dsub/activity/SettingsActivity.java
+++ b/src/github/daneren2005/dsub/activity/SettingsActivity.java
@@ -369,7 +369,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
final EditTextPreference serverInternalUrlPreference = new EditTextPreference(this);
serverInternalUrlPreference.setKey(Constants.PREFERENCES_KEY_SERVER_INTERNAL_URL + instance);
serverInternalUrlPreference.getEditText().setInputType(InputType.TYPE_TEXT_VARIATION_URI);
- serverInternalUrlPreference.setDefaultValue("http://");
+ serverInternalUrlPreference.setDefaultValue("");
serverInternalUrlPreference.setTitle(R.string.settings_server_internal_address);
serverInternalUrlPreference.setDialogTitle(R.string.settings_server_internal_address);
serverInternalUrlPreference.setSummary(serverInternalUrlPreference.getText());
diff --git a/src/github/daneren2005/dsub/fragments/DownloadFragment.java b/src/github/daneren2005/dsub/fragments/DownloadFragment.java
index ea8e8c3c..e58de995 100644
--- a/src/github/daneren2005/dsub/fragments/DownloadFragment.java
+++ b/src/github/daneren2005/dsub/fragments/DownloadFragment.java
@@ -880,10 +880,33 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe
protected void startTimer() {
View dialogView = context.getLayoutInflater().inflate(R.layout.start_timer, null);
- final EditText lengthBox = (EditText)dialogView.findViewById(R.id.timer_length);
+ // Setup length label
+ final TextView lengthBox = (TextView) dialogView.findViewById(R.id.timer_length_label);
final SharedPreferences prefs = Util.getPreferences(context);
- lengthBox.setText(prefs.getString(Constants.PREFERENCES_KEY_SLEEP_TIMER_DURATION, ""));
+ String lengthString = prefs.getString(Constants.PREFERENCES_KEY_SLEEP_TIMER_DURATION, "5");
+ int length = Integer.parseInt(lengthString);
+ lengthBox.setText(Util.formatDuration(length));
+
+ // Setup length slider
+ final SeekBar lengthBar = (SeekBar) dialogView.findViewById(R.id.timer_length_bar);
+ lengthBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ if(fromUser) {
+ int length = getMinutes(progress);
+ lengthBox.setText(Util.formatDuration(length));
+ }
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ }
+ });
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.menu_set_timer)
@@ -891,13 +914,13 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe
.setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
- String length = lengthBox.getText().toString();
+ int length = getMinutes(lengthBar.getProgress());
SharedPreferences.Editor editor = prefs.edit();
- editor.putString(Constants.PREFERENCES_KEY_SLEEP_TIMER_DURATION, length);
+ editor.putString(Constants.PREFERENCES_KEY_SLEEP_TIMER_DURATION, Integer.toString(length));
editor.commit();
- getDownloadService().setSleepTimerDuration(Integer.parseInt(length));
+ getDownloadService().setSleepTimerDuration(length);
getDownloadService().startSleepTimer();
context.supportInvalidateOptionsMenu();
}
@@ -907,6 +930,16 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe
dialog.show();
}
+ private int getMinutes(int progress) {
+ if(progress < 30) {
+ return progress + 1;
+ } else if(progress < 61) {
+ return (progress - 30) * 5 + getMinutes(29);
+ } else {
+ return (progress - 61) * 15 + getMinutes(60);
+ }
+ }
+
private void toggleFullscreenAlbumArt() {
if (playlistFlipper.getDisplayedChild() == 1) {
playlistFlipper.setInAnimation(AnimationUtils.loadAnimation(context, R.anim.push_down_in));
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index f96bf578..9e7d93fa 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -165,7 +165,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
if(licenseValid == null) {
menuInflater.inflate(R.menu.empty, menu);
}
- else if(hideButtons) {
+ else if(hideButtons && !showAll) {
if(albumListType != null) {
menuInflater.inflate(R.menu.select_album_list, menu);
} else {
@@ -1028,6 +1028,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
int songCount = 0;
Set<String> artists = new HashSet<String>();
+ Set<Integer> years = new HashSet<Integer>();
Integer totalDuration = 0;
for (MusicDirectory.Entry entry : entries) {
if (!entry.isDirectory()) {
@@ -1035,6 +1036,9 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
if (entry.getArtist() != null) {
artists.add(entry.getArtist());
}
+ if(entry.getYear() != null) {
+ years.add(entry.getYear());
+ }
Integer duration = entry.getDuration();
if(duration != null) {
totalDuration += duration;
@@ -1048,7 +1052,11 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
artistView.setSingleLine(false);
artistView.setLines(5);
} else if (artists.size() == 1) {
- artistView.setText(artists.iterator().next());
+ String artistText = artists.iterator().next();
+ if(years.size() == 1) {
+ artistText += " - " + years.iterator().next();
+ }
+ artistView.setText(artistText);
artistView.setVisibility(View.VISIBLE);
} else {
artistView.setVisibility(View.GONE);
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
index 021c214a..7b285953 100644
--- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
+++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
@@ -222,7 +222,6 @@ public class DownloadServiceLifecycleSupport {
executorService.shutdown();
eventLooper.quit();
serializeDownloadQueueNow();
- downloadService.clear(false);
downloadService.unregisterReceiver(ejectEventReceiver);
downloadService.unregisterReceiver(headsetEventReceiver);
downloadService.unregisterReceiver(intentReceiver);
diff --git a/src/github/daneren2005/dsub/view/AlbumView.java b/src/github/daneren2005/dsub/view/AlbumView.java
index 5083ef0b..3d0eb382 100644
--- a/src/github/daneren2005/dsub/view/AlbumView.java
+++ b/src/github/daneren2005/dsub/view/AlbumView.java
@@ -71,7 +71,14 @@ public class AlbumView extends UpdateView {
protected void setObjectImpl(Object obj1, Object obj2) {
this.album = (MusicDirectory.Entry) obj1;
titleView.setText(album.getTitle());
- artistView.setText(album.getArtist());
+ String artist = album.getArtist();
+ if(artist == null) {
+ artist = "";
+ }
+ if(album.getYear() != null) {
+ artist += " - " + album.getYear();
+ }
+ artistView.setText(artist);
artistView.setVisibility(album.getArtist() == null ? View.GONE : View.VISIBLE);
((ImageLoader)obj2).loadImage(coverArtView, album, false, true);
file = null;