summaryrefslogtreecommitdiff
path: root/src/de/danoeh
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/danoeh')
-rw-r--r--src/de/danoeh/antennapod/activity/MediaplayerActivity.java69
-rw-r--r--src/de/danoeh/antennapod/activity/VideoplayerActivity.java21
2 files changed, 55 insertions, 35 deletions
diff --git a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
index 0425638bd..be0179e64 100644
--- a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
+++ b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
@@ -43,7 +43,7 @@ import de.danoeh.antennapod.util.MediaPlayerError;
import de.danoeh.antennapod.util.StorageUtils;
import de.danoeh.antennapod.util.menuhandler.FeedItemMenuHandler;
-public abstract class MediaplayerActivity extends SherlockFragmentActivity {
+public abstract class MediaplayerActivity extends SherlockFragmentActivity implements OnSeekBarChangeListener{
private static final String TAG = "MediaplayerActivity";
static final int DEFAULT_SEEK_DELTA = 30000;
@@ -471,39 +471,7 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity {
// SEEKBAR SETUP
- sbPosition.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
- int duration;
- float prog;
-
- @Override
- public void onProgressChanged(SeekBar seekBar, int progress,
- boolean fromUser) {
- if (fromUser && PlaybackService.isRunning) {
- prog = progress / ((float) seekBar.getMax());
- duration = playbackService.getPlayer().getDuration();
- txtvPosition.setText(Converter
- .getDurationStringLong((int) (prog * duration)));
- }
-
- }
-
- @Override
- public void onStartTrackingTouch(SeekBar seekBar) {
- // interrupt position Observer, restart later
- if (positionObserver != null) {
- positionObserver.cancel(true);
- positionObserver = null;
- }
- }
-
- @Override
- public void onStopTrackingTouch(SeekBar seekBar) {
- if (PlaybackService.isRunning) {
- playbackService.seek((int) (prog * duration));
- setupPositionObserver();
- }
- }
- });
+ sbPosition.setOnSeekBarChangeListener(this);
// BUTTON SETUP
@@ -606,5 +574,38 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity {
return null;
}
}
+
+ // OnSeekbarChangeListener
+ private int duration;
+ private float prog;
+
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progress,
+ boolean fromUser) {
+ if (fromUser && PlaybackService.isRunning) {
+ prog = progress / ((float) seekBar.getMax());
+ duration = playbackService.getPlayer().getDuration();
+ txtvPosition.setText(Converter
+ .getDurationStringLong((int) (prog * duration)));
+ }
+
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ // interrupt position Observer, restart later
+ if (positionObserver != null) {
+ positionObserver.cancel(true);
+ positionObserver = null;
+ }
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ if (PlaybackService.isRunning) {
+ playbackService.seek((int) (prog * duration));
+ setupPositionObserver();
+ }
+ }
}
diff --git a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java
index ba1e434d0..34cb3aec9 100644
--- a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java
+++ b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java
@@ -12,9 +12,11 @@ import android.util.Log;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.View;
+import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
+import android.widget.SeekBar;
import android.widget.VideoView;
public class VideoplayerActivity extends MediaplayerActivity implements
@@ -54,6 +56,7 @@ public class VideoplayerActivity extends MediaplayerActivity implements
videoview.getHolder().addCallback(this);
videoview.setOnClickListener(playbuttonListener);
videoview.setOnTouchListener(onVideoviewTouched);
+
setupVideoControlsToggler();
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
@@ -100,7 +103,7 @@ public class VideoplayerActivity extends MediaplayerActivity implements
}
}
};
-
+
@SuppressLint("NewApi")
void setupVideoControlsToggler() {
if (videoControlsToggler != null) {
@@ -202,4 +205,20 @@ public class VideoplayerActivity extends MediaplayerActivity implements
}
}
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ super.onStartTrackingTouch(seekBar);
+ if (videoControlsToggler != null) {
+ videoControlsToggler.cancel(true);
+ }
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ super.onStopTrackingTouch(seekBar);
+ setupVideoControlsToggler();
+ }
+
+
+
}