Set seek time of media keys to 30 seconds.

This commit is contained in:
daniel oeh 2013-08-03 21:42:25 +02:00
parent 4e6276c9c4
commit 8a2640e040
2 changed files with 4 additions and 17 deletions

View File

@ -54,6 +54,7 @@ import de.danoeh.antennapod.util.BitmapDecoder;
import de.danoeh.antennapod.util.flattr.FlattrUtils; import de.danoeh.antennapod.util.flattr.FlattrUtils;
import de.danoeh.antennapod.util.playback.Playable; import de.danoeh.antennapod.util.playback.Playable;
import de.danoeh.antennapod.util.playback.Playable.PlayableException; import de.danoeh.antennapod.util.playback.Playable.PlayableException;
import de.danoeh.antennapod.util.playback.PlaybackController;
/** Controls the MediaPlayer that plays a FeedMedia-file */ /** Controls the MediaPlayer that plays a FeedMedia-file */
public class PlaybackService extends Service { public class PlaybackService extends Service {
@ -433,25 +434,11 @@ public class PlaybackService extends Service {
} }
break; break;
case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: { case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: {
int currentPos = getCurrentPositionSafe(); seekDelta(PlaybackController.DEFAULT_SEEK_DELTA);
int duration = getDurationSafe();
if (currentPos != INVALID_TIME && duration != INVALID_TIME) {
if (currentPos < duration) {
seek(currentPos + 10000);
}
}
break; break;
} }
case KeyEvent.KEYCODE_MEDIA_REWIND: { case KeyEvent.KEYCODE_MEDIA_REWIND: {
int currentPos = getCurrentPositionSafe(); seekDelta(-PlaybackController.DEFAULT_SEEK_DELTA);
int duration = getDurationSafe();
if (currentPos != INVALID_TIME && duration != INVALID_TIME) {
if (currentPos > 10000) {
seek(currentPos - 10000);
}
}
break; break;
} }
} }

View File

@ -43,7 +43,7 @@ import de.danoeh.antennapod.util.playback.Playable.PlayableUtils;
public abstract class PlaybackController { public abstract class PlaybackController {
private static final String TAG = "PlaybackController"; private static final String TAG = "PlaybackController";
static final int DEFAULT_SEEK_DELTA = 30000; public static final int DEFAULT_SEEK_DELTA = 30000;
public static final int INVALID_TIME = -1; public static final int INVALID_TIME = -1;
private Activity activity; private Activity activity;