Extract getting of seek duration into a function
This commit is contained in:
parent
17146c2c13
commit
949c01b37f
1 changed files with 7 additions and 6 deletions
|
@ -954,20 +954,21 @@ 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");
|
||||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
final int duration = getSeekDuration();
|
||||||
final String key = context.getString(R.string.seek_duration_key);
|
|
||||||
final String value = prefs.getString(key, FAST_FORWARD_REWIND_DEFAULT_AMOUNT_MILLIS);
|
|
||||||
final int duration = Integer.parseInt(value);
|
|
||||||
seekBy(-duration);
|
seekBy(-duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFastForward() {
|
public void onFastForward() {
|
||||||
if (DEBUG) Log.d(TAG, "onFastForward() called");
|
if (DEBUG) Log.d(TAG, "onFastForward() called");
|
||||||
|
final int duration = getSeekDuration();
|
||||||
|
seekBy(duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getSeekDuration() {
|
||||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
final String key = context.getString(R.string.seek_duration_key);
|
final String key = context.getString(R.string.seek_duration_key);
|
||||||
final String value = prefs.getString(key, FAST_FORWARD_REWIND_DEFAULT_AMOUNT_MILLIS);
|
final String value = prefs.getString(key, FAST_FORWARD_REWIND_DEFAULT_AMOUNT_MILLIS);
|
||||||
final int duration = Integer.parseInt(value);
|
return Integer.parseInt(value);
|
||||||
seekBy(duration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPlayPrevious() {
|
public void onPlayPrevious() {
|
||||||
|
|
Loading…
Reference in a new issue