Merge pull request #2744 from XiangRongLin/seek

Adjustable seek duration
This commit is contained in:
Tobias Groza 2019-12-13 08:47:02 +01:00 committed by GitHub
commit 88a6e5981f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 3 deletions

View File

@ -178,7 +178,6 @@ public abstract class BasePlayer implements
// Player // Player
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
protected final static int FAST_FORWARD_REWIND_AMOUNT_MILLIS = 10000; // 10 Seconds
protected final static int PLAY_PREV_ACTIVATION_LIMIT_MILLIS = 5000; // 5 seconds protected final static int PLAY_PREV_ACTIVATION_LIMIT_MILLIS = 5000; // 5 seconds
protected final static int PROGRESS_LOOP_INTERVAL_MILLIS = 500; protected final static int PROGRESS_LOOP_INTERVAL_MILLIS = 500;
protected final static int RECOVERY_SKIP_THRESHOLD_MILLIS = 3000; // 3 seconds protected final static int RECOVERY_SKIP_THRESHOLD_MILLIS = 3000; // 3 seconds
@ -954,12 +953,19 @@ public abstract class BasePlayer implements
public void onFastRewind() { public void onFastRewind() {
if (DEBUG) Log.d(TAG, "onFastRewind() called"); if (DEBUG) Log.d(TAG, "onFastRewind() called");
seekBy(-FAST_FORWARD_REWIND_AMOUNT_MILLIS); seekBy(-getSeekDuration());
} }
public void onFastForward() { public void onFastForward() {
if (DEBUG) Log.d(TAG, "onFastForward() called"); if (DEBUG) Log.d(TAG, "onFastForward() called");
seekBy(FAST_FORWARD_REWIND_AMOUNT_MILLIS); seekBy(getSeekDuration());
}
private int getSeekDuration() {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
final String key = context.getString(R.string.seek_duration_key);
final String value = prefs.getString(key, context.getString(R.string.seek_duration_default_value));
return Integer.parseInt(value);
} }
public void onPlayPrevious() { public void onPlayPrevious() {

View File

@ -28,6 +28,25 @@
<string name="screen_brightness_key" translatable="false">screen_brightness_key</string> <string name="screen_brightness_key" translatable="false">screen_brightness_key</string>
<string name="screen_brightness_timestamp_key" translatable="false">screen_brightness_timestamp_key</string> <string name="screen_brightness_timestamp_key" translatable="false">screen_brightness_timestamp_key</string>
<string name="seek_duration_key" translatable="false">seek_duration</string>
<string name="seek_duration_default_value" translatable="false">10000</string>
<string-array name="seek_duration_description" translatable="false">
<item>5 seconds</item>
<item>10 seconds</item>
<item>15 seconds</item>
<item>20 seconds</item>
<item>25 seconds</item>
<item>30 seconds</item>
</string-array>
<string-array name="seek_duration_value" translatable="false">
<item>5000</item>
<item>10000</item>
<item>15000</item>
<item>20000</item>
<item>25000</item>
<item>30000</item>
</string-array>
<string name="minimize_on_exit_key" translatable="false">minimize_on_exit_key</string> <string name="minimize_on_exit_key" translatable="false">minimize_on_exit_key</string>
<string name="minimize_on_exit_value" translatable="false">@string/minimize_on_exit_none_key</string> <string name="minimize_on_exit_value" translatable="false">@string/minimize_on_exit_none_key</string>
<string name="minimize_on_exit_none_key" translatable="false">minimize_on_exit_none_key</string> <string name="minimize_on_exit_none_key" translatable="false">minimize_on_exit_none_key</string>

View File

@ -70,6 +70,7 @@
<string name="popup_remember_size_pos_summary">Remember last size and position of popup</string> <string name="popup_remember_size_pos_summary">Remember last size and position of popup</string>
<string name="use_inexact_seek_title">Use fast inexact seek</string> <string name="use_inexact_seek_title">Use fast inexact seek</string>
<string name="use_inexact_seek_summary">Inexact seek allows the player to seek to positions faster with reduced precision</string> <string name="use_inexact_seek_summary">Inexact seek allows the player to seek to positions faster with reduced precision</string>
<string name="seek_duration_title">Fast-forward/-rewind seek duration</string>
<string name="download_thumbnail_title">Load thumbnails</string> <string name="download_thumbnail_title">Load thumbnails</string>
<string name="show_comments_title">Show comments</string> <string name="show_comments_title">Show comments</string>
<string name="show_comments_summary">Disable to stop showing comments</string> <string name="show_comments_summary">Disable to stop showing comments</string>

View File

@ -146,5 +146,14 @@
android:key="@string/use_inexact_seek_key" android:key="@string/use_inexact_seek_key"
android:summary="@string/use_inexact_seek_summary" android:summary="@string/use_inexact_seek_summary"
android:title="@string/use_inexact_seek_title"/> android:title="@string/use_inexact_seek_title"/>
<ListPreference
app:iconSpaceReserved="false"
android:defaultValue="@string/seek_duration_default_value"
android:entries="@array/seek_duration_description"
android:entryValues="@array/seek_duration_value"
android:key="@string/seek_duration_key"
android:summary="%s"
android:title="@string/seek_duration_title"/>
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>