Remember 'keep sorted' when selecting random sort (#7560)

This commit is contained in:
ByteHamster 2024-12-15 14:17:26 +01:00 committed by GitHub
parent 2ce260dfbb
commit 2399992944
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -548,6 +548,8 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
}
public static class QueueSortDialog extends ItemSortDialog {
boolean turnedOffKeepSortedForRandom = false;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
@ -573,9 +575,16 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
@Override
protected void onSelectionChanged() {
super.onSelectionChanged();
viewBinding.keepSortedCheckbox.setEnabled(sortOrder != SortOrder.RANDOM);
if (sortOrder == SortOrder.RANDOM) {
turnedOffKeepSortedForRandom |= viewBinding.keepSortedCheckbox.isChecked();
viewBinding.keepSortedCheckbox.setChecked(false);
viewBinding.keepSortedCheckbox.setEnabled(false);
} else {
if (turnedOffKeepSortedForRandom) {
viewBinding.keepSortedCheckbox.setChecked(true);
turnedOffKeepSortedForRandom = false;
}
viewBinding.keepSortedCheckbox.setEnabled(true);
}
UserPreferences.setQueueKeepSorted(viewBinding.keepSortedCheckbox.isChecked());
UserPreferences.setQueueKeepSortedOrder(sortOrder);