Merge branch 'seek' of git://github.com/dreiss/AntennaPod into dreiss-seek
This commit is contained in:
commit
cdf663ffa5
@ -1,6 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
|
<string-array name="seek_delta_values">
|
||||||
|
<item>5</item>
|
||||||
|
<item>10</item>
|
||||||
|
<item>15</item>
|
||||||
|
<item>20</item>
|
||||||
|
<item>30</item>
|
||||||
|
<item>45</item>
|
||||||
|
<item>60</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<string-array name="update_intervall_options">
|
<string-array name="update_intervall_options">
|
||||||
<item>Manual</item>
|
<item>Manual</item>
|
||||||
<item>1 hour</item>
|
<item>1 hour</item>
|
||||||
|
@ -147,6 +147,7 @@
|
|||||||
<string name="position_default_label">00:00:00</string>
|
<string name="position_default_label">00:00:00</string>
|
||||||
<string name="player_buffering_msg">Buffering</string>
|
<string name="player_buffering_msg">Buffering</string>
|
||||||
<string name="playbackservice_notification_title">Playing podcast</string>
|
<string name="playbackservice_notification_title">Playing podcast</string>
|
||||||
|
<string name="unknown_media_key">AntennaPod - Unknown media key: %1$d</string>
|
||||||
|
|
||||||
<!-- Queue operations -->
|
<!-- Queue operations -->
|
||||||
<string name="clear_queue_label">Clear queue</string>
|
<string name="clear_queue_label">Clear queue</string>
|
||||||
@ -242,6 +243,8 @@
|
|||||||
<string name="pref_gpodnet_setlogin_information_sum">Change the login information for your gpodder.net account.</string>
|
<string name="pref_gpodnet_setlogin_information_sum">Change the login information for your gpodder.net account.</string>
|
||||||
<string name="pref_playback_speed_title">Playback Speeds</string>
|
<string name="pref_playback_speed_title">Playback Speeds</string>
|
||||||
<string name="pref_playback_speed_sum">Customize the speeds available for variable speed audio playback</string>
|
<string name="pref_playback_speed_sum">Customize the speeds available for variable speed audio playback</string>
|
||||||
|
<string name="pref_seek_delta_title">Seek Time</string>
|
||||||
|
<string name="pref_seek_delta_sum">Seek this many seconds when rewinding or fast-forwarding</string>
|
||||||
<string name="pref_gpodnet_sethostname_title">Set hostname</string>
|
<string name="pref_gpodnet_sethostname_title">Set hostname</string>
|
||||||
<string name="pref_gpodnet_sethostname_use_default_host">Use default host</string>
|
<string name="pref_gpodnet_sethostname_use_default_host">Use default host</string>
|
||||||
|
|
||||||
|
@ -34,6 +34,15 @@
|
|||||||
android:key="prefPauseForFocusLoss"
|
android:key="prefPauseForFocusLoss"
|
||||||
android:summary="@string/pref_pausePlaybackForFocusLoss_sum"
|
android:summary="@string/pref_pausePlaybackForFocusLoss_sum"
|
||||||
android:title="@string/pref_pausePlaybackForFocusLoss_title" />
|
android:title="@string/pref_pausePlaybackForFocusLoss_title" />
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="30"
|
||||||
|
android:entries="@array/seek_delta_values"
|
||||||
|
android:entryValues="@array/seek_delta_values"
|
||||||
|
android:key="prefSeekDeltaSecs"
|
||||||
|
android:summary="@string/pref_seek_delta_sum"
|
||||||
|
android:title="@string/pref_seek_delta_title" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/network_pref">
|
<PreferenceCategory android:title="@string/network_pref">
|
||||||
<ListPreference
|
<ListPreference
|
||||||
|
@ -48,6 +48,7 @@ public class UserPreferences implements
|
|||||||
private static final String PREF_PLAYBACK_SPEED = "prefPlaybackSpeed";
|
private static final String PREF_PLAYBACK_SPEED = "prefPlaybackSpeed";
|
||||||
private static final String PREF_PLAYBACK_SPEED_ARRAY = "prefPlaybackSpeedArray";
|
private static final String PREF_PLAYBACK_SPEED_ARRAY = "prefPlaybackSpeedArray";
|
||||||
public static final String PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS = "prefPauseForFocusLoss";
|
public static final String PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS = "prefPauseForFocusLoss";
|
||||||
|
private static final String PREF_SEEK_DELTA_SECS = "prefSeekDeltaSecs";
|
||||||
|
|
||||||
// TODO: Make this value configurable
|
// TODO: Make this value configurable
|
||||||
private static final double PLAYED_DURATION_AUTOFLATTR_THRESHOLD = 0.8;
|
private static final double PLAYED_DURATION_AUTOFLATTR_THRESHOLD = 0.8;
|
||||||
@ -74,6 +75,7 @@ public class UserPreferences implements
|
|||||||
private String playbackSpeed;
|
private String playbackSpeed;
|
||||||
private String[] playbackSpeedArray;
|
private String[] playbackSpeedArray;
|
||||||
private boolean pauseForFocusLoss;
|
private boolean pauseForFocusLoss;
|
||||||
|
private int seekDeltaSecs;
|
||||||
private boolean isFreshInstall;
|
private boolean isFreshInstall;
|
||||||
|
|
||||||
private UserPreferences(Context context) {
|
private UserPreferences(Context context) {
|
||||||
@ -129,6 +131,7 @@ public class UserPreferences implements
|
|||||||
playbackSpeedArray = readPlaybackSpeedArray(sp.getString(
|
playbackSpeedArray = readPlaybackSpeedArray(sp.getString(
|
||||||
PREF_PLAYBACK_SPEED_ARRAY, null));
|
PREF_PLAYBACK_SPEED_ARRAY, null));
|
||||||
pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
|
pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
|
||||||
|
seekDeltaSecs = Integer.valueOf(sp.getString(PREF_SEEK_DELTA_SECS, "30"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int readThemeValue(String valueFromPrefs) {
|
private int readThemeValue(String valueFromPrefs) {
|
||||||
@ -263,6 +266,11 @@ public class UserPreferences implements
|
|||||||
return instance.playbackSpeedArray;
|
return instance.playbackSpeedArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getSeekDeltaMs() {
|
||||||
|
instanceAvailable();
|
||||||
|
return 1000 * instance.seekDeltaSecs;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the capacity of the episode cache. This method will return the
|
* Returns the capacity of the episode cache. This method will return the
|
||||||
* negative integer EPISODE_CACHE_SIZE_UNLIMITED if the cache size is set to
|
* negative integer EPISODE_CACHE_SIZE_UNLIMITED if the cache size is set to
|
||||||
@ -336,6 +344,8 @@ public class UserPreferences implements
|
|||||||
PREF_PLAYBACK_SPEED_ARRAY, null));
|
PREF_PLAYBACK_SPEED_ARRAY, null));
|
||||||
} else if (key.equals(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS)) {
|
} else if (key.equals(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS)) {
|
||||||
pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
|
pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
|
||||||
|
} else if (key.equals(PREF_SEEK_DELTA_SECS)) {
|
||||||
|
seekDeltaSecs = Integer.valueOf(sp.getString(PREF_SEEK_DELTA_SECS, "30"));
|
||||||
} else if (key.equals(PREF_PAUSE_ON_HEADSET_DISCONNECT)) {
|
} else if (key.equals(PREF_PAUSE_ON_HEADSET_DISCONNECT)) {
|
||||||
pauseOnHeadsetDisconnect = sp.getBoolean(PREF_PAUSE_ON_HEADSET_DISCONNECT, true);
|
pauseOnHeadsetDisconnect = sp.getBoolean(PREF_PAUSE_ON_HEADSET_DISCONNECT, true);
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import android.util.Log;
|
|||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.SurfaceHolder;
|
import android.view.SurfaceHolder;
|
||||||
|
import android.widget.Toast;
|
||||||
import de.danoeh.antennapod.BuildConfig;
|
import de.danoeh.antennapod.BuildConfig;
|
||||||
import de.danoeh.antennapod.PodcastApp;
|
import de.danoeh.antennapod.PodcastApp;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
@ -41,7 +42,6 @@ import de.danoeh.antennapod.util.BitmapDecoder;
|
|||||||
import de.danoeh.antennapod.util.QueueAccess;
|
import de.danoeh.antennapod.util.QueueAccess;
|
||||||
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.PlaybackController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -310,14 +310,18 @@ public class PlaybackService extends Service {
|
|||||||
mediaPlayer.pause(true, true);
|
mediaPlayer.pause(true, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: {
|
case KeyEvent.KEYCODE_MEDIA_NEXT:
|
||||||
mediaPlayer.seekDelta(PlaybackController.DEFAULT_SEEK_DELTA);
|
case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
|
||||||
|
mediaPlayer.seekDelta(UserPreferences.getSeekDeltaMs());
|
||||||
break;
|
break;
|
||||||
}
|
case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
|
||||||
case KeyEvent.KEYCODE_MEDIA_REWIND: {
|
case KeyEvent.KEYCODE_MEDIA_REWIND:
|
||||||
mediaPlayer.seekDelta(-PlaybackController.DEFAULT_SEEK_DELTA);
|
mediaPlayer.seekDelta(-UserPreferences.getSeekDeltaMs());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
String message = String.format(getResources().getString(R.string.unknown_media_key), keycode);
|
||||||
|
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import de.danoeh.antennapod.feed.Chapter;
|
|||||||
import de.danoeh.antennapod.feed.FeedMedia;
|
import de.danoeh.antennapod.feed.FeedMedia;
|
||||||
import de.danoeh.antennapod.feed.MediaType;
|
import de.danoeh.antennapod.feed.MediaType;
|
||||||
import de.danoeh.antennapod.preferences.PlaybackPreferences;
|
import de.danoeh.antennapod.preferences.PlaybackPreferences;
|
||||||
|
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.service.playback.PlaybackService;
|
import de.danoeh.antennapod.service.playback.PlaybackService;
|
||||||
import de.danoeh.antennapod.service.playback.PlaybackServiceMediaPlayer;
|
import de.danoeh.antennapod.service.playback.PlaybackServiceMediaPlayer;
|
||||||
import de.danoeh.antennapod.service.playback.PlayerStatus;
|
import de.danoeh.antennapod.service.playback.PlayerStatus;
|
||||||
@ -37,7 +38,6 @@ import java.util.concurrent.*;
|
|||||||
public abstract class PlaybackController {
|
public abstract class PlaybackController {
|
||||||
private static final String TAG = "PlaybackController";
|
private static final String TAG = "PlaybackController";
|
||||||
|
|
||||||
public static final int DEFAULT_SEEK_DELTA = 30000;
|
|
||||||
public static final int INVALID_TIME = -1;
|
public static final int INVALID_TIME = -1;
|
||||||
|
|
||||||
private final Activity activity;
|
private final Activity activity;
|
||||||
@ -605,7 +605,7 @@ public abstract class PlaybackController {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (status == PlayerStatus.PLAYING) {
|
if (status == PlayerStatus.PLAYING) {
|
||||||
playbackService.seekDelta(-DEFAULT_SEEK_DELTA);
|
playbackService.seekDelta(-UserPreferences.getSeekDeltaMs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -616,7 +616,7 @@ public abstract class PlaybackController {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (status == PlayerStatus.PLAYING) {
|
if (status == PlayerStatus.PLAYING) {
|
||||||
playbackService.seekDelta(DEFAULT_SEEK_DELTA);
|
playbackService.seekDelta(UserPreferences.getSeekDeltaMs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user