aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-07-15 21:48:08 -0700
committerScott Jackson <daneren2005@gmail.com>2013-07-15 21:48:08 -0700
commit0bf64a87059807f821415424d70190bec1d859f0 (patch)
treea7a4aa7dc2b0f0f94b8e231e4ec17a74f2c66936 /subsonic-android/src
parentfd585a4ae94be0d6549d0309cb5ae77ed59dd0ae (diff)
downloaddsub-0bf64a87059807f821415424d70190bec1d859f0.tar.gz
dsub-0bf64a87059807f821415424d70190bec1d859f0.tar.bz2
dsub-0bf64a87059807f821415424d70190bec1d859f0.zip
Use default system slider which looks nicer
Diffstat (limited to 'subsonic-android/src')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java53
1 files changed, 30 insertions, 23 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java
index 5e1b503c..4ef20391 100644
--- a/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java
+++ b/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java
@@ -33,6 +33,7 @@ import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
+import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.ViewFlipper;
import com.actionbarsherlock.view.Menu;
@@ -78,7 +79,7 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe
private TextView positionTextView;
private TextView durationTextView;
private TextView statusTextView;
- private HorizontalSlider progressBar;
+ private SeekBar progressBar;
private AutoRepeatButton previousButton;
private AutoRepeatButton nextButton;
private View pauseButton;
@@ -134,7 +135,7 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe
positionTextView = (TextView)rootView.findViewById(R.id.download_position);
durationTextView = (TextView)rootView.findViewById(R.id.download_duration);
statusTextView = (TextView)rootView.findViewById(R.id.download_status);
- progressBar = (HorizontalSlider)rootView.findViewById(R.id.download_progress_bar);
+ progressBar = (SeekBar)rootView.findViewById(R.id.download_progress_bar);
playlistView = (DragSortListView)rootView.findViewById(R.id.download_list);
previousButton = (AutoRepeatButton)rootView.findViewById(R.id.download_previous);
nextButton = (AutoRepeatButton)rootView.findViewById(R.id.download_next);
@@ -365,26 +366,32 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe
}
});
- progressBar.setOnSliderChangeListener(new HorizontalSlider.OnSliderChangeListener() {
- @Override
- public void onSliderChanged(View view, final int position, boolean inProgress) {
- Util.toast(context, Util.formatDuration(position / 1000), true);
- if (!inProgress) {
- new SilentBackgroundTask<Void>(context) {
- @Override
- protected Void doInBackground() throws Throwable {
- getDownloadService().seekTo(position);
- return null;
- }
+ progressBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+ @Override
+ public void onStopTrackingTouch(final SeekBar seekBar) {
+ new SilentBackgroundTask<Void>(context) {
+ @Override
+ protected Void doInBackground() throws Throwable {
+ getDownloadService().seekTo(progressBar.getProgress());
+ return null;
+ }
- @Override
- protected void done(Void result) {
- onProgressChanged();
- }
- }.execute();
- }
- setControlsVisible(true);
- }
+ @Override
+ protected void done(Void result) {
+ DownloadFragment.this.onProgressChanged();
+ }
+ }.execute();
+ }
+
+ @Override
+ public void onStartTrackingTouch(final SeekBar seekBar) {
+
+ }
+
+ @Override
+ public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
+
+ }
});
playlistView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
@@ -970,12 +977,12 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe
durationTextView.setText(Util.formatDuration(millisTotal / 1000));
progressBar.setMax(millisTotal == 0 ? 100 : millisTotal); // Work-around for apparent bug.
progressBar.setProgress(millisPlayed);
- progressBar.setSlidingEnabled(currentPlaying.isWorkDone() || isJukeboxEnabled);
+ progressBar.setEnabled(currentPlaying.isWorkDone() || isJukeboxEnabled);
} else {
positionTextView.setText("0:00");
durationTextView.setText("-:--");
progressBar.setProgress(0);
- progressBar.setSlidingEnabled(false);
+ progressBar.setEnabled(false);
}
switch (playerState) {