#2652 (part of): Expose keep in-progress at front as a preference
(in Playback > Queue section)
This commit is contained in:
parent
30f104f40b
commit
17e61335db
@ -63,6 +63,20 @@ public class PlaybackPreferencesFragment extends PreferenceFragmentCompat {
|
||||
behaviour.setEntries(R.array.video_background_behavior_options_without_pip);
|
||||
behaviour.setEntryValues(R.array.video_background_behavior_values_without_pip);
|
||||
}
|
||||
|
||||
findPreference(UserPreferences.PREF_QUEUE_ADD_TO_FRONT).setOnPreferenceChangeListener(
|
||||
(preference, newValue) -> {
|
||||
if (newValue instanceof Boolean) {
|
||||
boolean enableKeepInProgressAtFront = ((Boolean) newValue);
|
||||
checkKeepInProgressAtFrontItemVisibility(enableKeepInProgressAtFront);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
checkKeepInProgressAtFrontItemVisibility(UserPreferences.enqueueAtFront());
|
||||
}
|
||||
|
||||
private void checkKeepInProgressAtFrontItemVisibility(boolean enabled) {
|
||||
findPreference(UserPreferences.PREF_QUEUE_KEEP_IN_PROGESS_AT_FRONT).setEnabled(enabled);
|
||||
}
|
||||
|
||||
private void buildSmartMarkAsPlayedPreference() {
|
||||
|
@ -96,6 +96,12 @@
|
||||
android:key="prefQueueAddToFront"
|
||||
android:summary="@string/pref_queueAddToFront_sum"
|
||||
android:title="@string/pref_queueAddToFront_title"/>
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:enabled="false"
|
||||
android:key="prefQueueKeepInProgressAtFront"
|
||||
android:summary="@string/pref_queueKeepInProgressAtFront_sum"
|
||||
android:title="@string/pref_queueKeepInProgressAtFront_title"/>
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:enabled="true"
|
||||
|
@ -62,7 +62,8 @@ public class UserPreferences {
|
||||
private static final String PREF_BACK_BUTTON_GO_TO_PAGE = "prefBackButtonGoToPage";
|
||||
|
||||
// Queue
|
||||
private static final String PREF_QUEUE_ADD_TO_FRONT = "prefQueueAddToFront";
|
||||
public static final String PREF_QUEUE_ADD_TO_FRONT = "prefQueueAddToFront";
|
||||
public static final String PREF_QUEUE_KEEP_IN_PROGESS_AT_FRONT = "prefQueueKeepInProgressAtFront";
|
||||
public static final String PREF_QUEUE_KEEP_SORTED = "prefQueueKeepSorted";
|
||||
public static final String PREF_QUEUE_KEEP_SORTED_ORDER = "prefQueueKeepSortedOrder";
|
||||
|
||||
@ -288,6 +289,16 @@ public class UserPreferences {
|
||||
return prefs.getBoolean(PREF_QUEUE_ADD_TO_FRONT, false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {@code true} if in enqueuing items/podcast episodes, when the existing front item is
|
||||
* in-progress, i.e., the user has played part of it, such item remains at the front of the
|
||||
* queue; {@code false} otherwise.
|
||||
*/
|
||||
public static boolean keepInProgressAtFront() {
|
||||
return prefs.getBoolean(PREF_QUEUE_KEEP_IN_PROGESS_AT_FRONT, false);
|
||||
}
|
||||
|
||||
public static boolean isPauseOnHeadsetDisconnect() {
|
||||
return prefs.getBoolean(PREF_PAUSE_ON_HEADSET_DISCONNECT, true);
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ public class DBWriter {
|
||||
new ItemEnqueuePositionCalculator(
|
||||
new ItemEnqueuePositionCalculator.Options()
|
||||
.setEnqueueAtFront(UserPreferences.enqueueAtFront())
|
||||
.setKeepInProgressAtFront(true) // TODO: to expose with preference
|
||||
.setKeepInProgressAtFront(UserPreferences.keepInProgressAtFront())
|
||||
);
|
||||
|
||||
for (int i = 0; i < itemIds.length; i++) {
|
||||
|
@ -456,6 +456,8 @@
|
||||
<string name="pref_expand_notify_unsupport_toast">Android versions before 4.1 do not support expanded notifications.</string>
|
||||
<string name="pref_queueAddToFront_sum">Add new episodes to the front of the queue.</string>
|
||||
<string name="pref_queueAddToFront_title">Enqueue at Front</string>
|
||||
<string name="pref_queueKeepInProgressAtFront_title">Keep In-progress Episode at Front</string>
|
||||
<string name="pref_queueKeepInProgressAtFront_sum">If the episode at front is in-progress, i.e., you have listened to part of it, keep it at the front of the queue.</string>
|
||||
<string name="pref_smart_mark_as_played_disabled">Disabled</string>
|
||||
<string name="pref_image_cache_size_title">Image Cache Size</string>
|
||||
<string name="pref_image_cache_size_sum">Size of the disk cache for images.</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user