1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-10-30 06:43:00 +00:00

Update miscellaneous libraries

This commit is contained in:
TacoTheDank
2023-10-31 21:25:11 -04:00
committed by Stypox
parent ee3455e1e5
commit 4a7fda95ae
7 changed files with 20 additions and 25 deletions

View File

@@ -47,6 +47,6 @@ object Converters {
@TypeConverter
fun feedGroupIconOf(id: Int): FeedGroupIcon {
return FeedGroupIcon.values().first { it.id == id }
return FeedGroupIcon.entries.first { it.id == id }
}
}

View File

@@ -26,7 +26,7 @@ object FeedEventManager {
}
sealed class Event {
object IdleEvent : Event()
data object IdleEvent : Event()
data class ProgressEvent(val currentProgress: Int = -1, val maxProgress: Int = -1, @StringRes val progressMessage: Int = 0) : Event() {
constructor(@StringRes progressMessage: Int) : this(-1, -1, progressMessage)
}

View File

@@ -55,10 +55,10 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
private var groupSortOrder: Long = -1
sealed class ScreenState : Serializable {
object InitialScreen : ScreenState()
object IconPickerScreen : ScreenState()
object SubscriptionsPickerScreen : ScreenState()
object DeleteScreen : ScreenState()
data object InitialScreen : ScreenState()
data object IconPickerScreen : ScreenState()
data object SubscriptionsPickerScreen : ScreenState()
data object DeleteScreen : ScreenState()
}
@State @JvmField var selectedIcon: FeedGroupIcon? = null
@@ -370,7 +370,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
private fun setupIconPicker() {
val groupAdapter = GroupieAdapter()
groupAdapter.addAll(FeedGroupIcon.values().map { PickerIconItem(it) })
groupAdapter.addAll(FeedGroupIcon.entries.map { PickerIconItem(it) })
feedGroupCreateBinding.iconSelector.apply {
layoutManager = GridLayoutManager(requireContext(), 7, RecyclerView.VERTICAL, false)

View File

@@ -110,8 +110,8 @@ class FeedGroupDialogViewModel(
}
sealed class DialogEvent {
object ProcessingEvent : DialogEvent()
object SuccessEvent : DialogEvent()
data object ProcessingEvent : DialogEvent()
data object SuccessEvent : DialogEvent()
}
data class Filter(val query: String, val showOnlyUngrouped: Boolean)

View File

@@ -9,7 +9,7 @@ class FeedGroupIconTest {
fun `No gaps and repeated ids`() {
val usedIds = HashSet<Int>()
for ((shouldBeId, currentIcon) in FeedGroupIcon.values().withIndex()) {
for ((shouldBeId, currentIcon) in FeedGroupIcon.entries.withIndex()) {
val added = usedIds.add(currentIcon.id)
assertTrue("Repeated ids (current item: ${currentIcon.name} - ${currentIcon.id})", added)
@@ -24,7 +24,7 @@ class FeedGroupIconTest {
fun `No icons pointing to the same attr`() {
val usedIcons = HashSet<Int>()
for (groupIcon in FeedGroupIcon.values()) {
for (groupIcon in FeedGroupIcon.entries) {
val added = usedIcons.add(groupIcon.drawableResource)
assertTrue("Repeated icon (current item: ${groupIcon.name} - ${groupIcon.id})", added)
}