Allow each notification slot to contain any possible action
This commit is contained in:
parent
aab6580195
commit
9fb8125655
4 changed files with 48 additions and 43 deletions
|
|
@ -20,6 +20,7 @@ import org.schabi.newpipe.App;
|
|||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.player.notification.NotificationConstants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
|
|
@ -67,8 +68,8 @@ public class NotificationActionsPreference extends Preference {
|
|||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void setupActions(@NonNull final View view) {
|
||||
compactSlots = NotificationConstants.getCompactSlotsFromPreferences(getContext(),
|
||||
getSharedPreferences(), 5);
|
||||
compactSlots = new ArrayList<>(NotificationConstants.getCompactSlotsFromPreferences(
|
||||
getContext(), getSharedPreferences()));
|
||||
notificationSlots = IntStream.range(0, 5)
|
||||
.mapToObj(i -> new NotificationSlot(getContext(), getSharedPreferences(), i, view,
|
||||
compactSlots.contains(i), this::onToggleCompactSlot))
|
||||
|
|
|
|||
|
|
@ -130,13 +130,13 @@ class NotificationSlot {
|
|||
.create();
|
||||
|
||||
final View.OnClickListener radioButtonsClickListener = v -> {
|
||||
selectedAction = NotificationConstants.SLOT_ALLOWED_ACTIONS[i][v.getId()];
|
||||
selectedAction = NotificationConstants.ALL_ACTIONS[v.getId()];
|
||||
updateInfo();
|
||||
alertDialog.dismiss();
|
||||
};
|
||||
|
||||
for (int id = 0; id < NotificationConstants.SLOT_ALLOWED_ACTIONS[i].length; ++id) {
|
||||
final int action = NotificationConstants.SLOT_ALLOWED_ACTIONS[i][id];
|
||||
for (int id = 0; id < NotificationConstants.ALL_ACTIONS.length; ++id) {
|
||||
final int action = NotificationConstants.ALL_ACTIONS[id];
|
||||
final RadioButton radioButton = ListRadioIconItemBinding.inflate(inflater)
|
||||
.getRoot();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue