Merge pull request #8724 from Isira-Seneviratne/toArray_improvements
Use toArray() with zero-length arrays.
This commit is contained in:
commit
6f86e21605
7 changed files with 16 additions and 29 deletions
|
|
@ -14,7 +14,6 @@ import org.schabi.newpipe.util.Localization;
|
|||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
|
@ -115,7 +114,7 @@ public final class NotificationConstants {
|
|||
};
|
||||
|
||||
|
||||
public static final Integer[] SLOT_COMPACT_DEFAULTS = {0, 1, 2};
|
||||
public static final List<Integer> SLOT_COMPACT_DEFAULTS = List.of(0, 1, 2);
|
||||
|
||||
public static final int[] SLOT_COMPACT_PREF_KEYS = {
|
||||
R.string.notification_slot_compact_0_key,
|
||||
|
|
@ -181,7 +180,7 @@ public final class NotificationConstants {
|
|||
|
||||
if (compactSlot == Integer.MAX_VALUE) {
|
||||
// settings not yet populated, return default values
|
||||
return new ArrayList<>(Arrays.asList(SLOT_COMPACT_DEFAULTS));
|
||||
return new ArrayList<>(SLOT_COMPACT_DEFAULTS);
|
||||
}
|
||||
|
||||
// a negative value (-1) is set when the user does not want a particular compact slot
|
||||
|
|
|
|||
|
|
@ -99,10 +99,7 @@ public final class NotificationUtil {
|
|||
// build the compact slot indices array (need code to convert from Integer... because Java)
|
||||
final List<Integer> compactSlotList = NotificationConstants.getCompactSlotsFromPreferences(
|
||||
player.getContext(), player.getPrefs(), nonNothingSlotCount);
|
||||
final int[] compactSlots = new int[compactSlotList.size()];
|
||||
for (int i = 0; i < compactSlotList.size(); i++) {
|
||||
compactSlots[i] = compactSlotList.get(i);
|
||||
}
|
||||
final int[] compactSlots = compactSlotList.stream().mapToInt(Integer::intValue).toArray();
|
||||
|
||||
builder.setStyle(new androidx.media.app.NotificationCompat.MediaStyle()
|
||||
.setMediaSession(player.getMediaSessionManager().getSessionToken())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue