diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.kt b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.kt index 82162e1e4ad..254fa425aa4 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.kt +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.kt @@ -62,11 +62,7 @@ data class PlaylistRemoteEntity( orderingName = playlistInfo.name, url = playlistInfo.url, thumbnailUrl = ImageStrategy.imageListToDbUrl( - if (playlistInfo.thumbnails.isEmpty()) { - playlistInfo.uploaderAvatars - } else { - playlistInfo.thumbnails - } + playlistInfo.thumbnails.ifEmpty { playlistInfo.uploaderAvatars } ), uploader = playlistInfo.uploaderName, streamCount = playlistInfo.streamCount diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/FeedViewModel.kt b/app/src/main/java/org/schabi/newpipe/local/feed/FeedViewModel.kt index 7e781b30f7d..58ec818f3bd 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/FeedViewModel.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/FeedViewModel.kt @@ -129,8 +129,7 @@ class FeedViewModel( fun setSaveShowPlayedItems(showPlayedItems: Boolean) { this.showPlayedItems.onNext(showPlayedItems) PreferenceManager.getDefaultSharedPreferences(application).edit { - this.putBoolean(application.getString(R.string.feed_show_watched_items_key), showPlayedItems) - this.apply() + putBoolean(application.getString(R.string.feed_show_watched_items_key), showPlayedItems) } } @@ -139,8 +138,7 @@ class FeedViewModel( fun setSaveShowPartiallyPlayedItems(showPartiallyPlayedItems: Boolean) { this.showPartiallyPlayedItems.onNext(showPartiallyPlayedItems) PreferenceManager.getDefaultSharedPreferences(application).edit { - this.putBoolean(application.getString(R.string.feed_show_partially_watched_items_key), showPartiallyPlayedItems) - this.apply() + putBoolean(application.getString(R.string.feed_show_partially_watched_items_key), showPartiallyPlayedItems) } } @@ -149,8 +147,7 @@ class FeedViewModel( fun setSaveShowFutureItems(showFutureItems: Boolean) { this.showFutureItems.onNext(showFutureItems) PreferenceManager.getDefaultSharedPreferences(application).edit { - this.putBoolean(application.getString(R.string.feed_show_future_items_key), showFutureItems) - this.apply() + putBoolean(application.getString(R.string.feed_show_future_items_key), showFutureItems) } } diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt index ab856278f7e..7a256c16601 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt @@ -327,7 +327,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable { groupIcon = feedGroupEntity?.icon groupSortOrder = feedGroupEntity?.sortOrder ?: -1 - val feedGroupIcon = if (selectedIcon == null) icon else selectedIcon!! + val feedGroupIcon = selectedIcon ?: icon feedGroupCreateBinding.iconPreview.setImageResource(feedGroupIcon.getDrawableRes()) if (feedGroupCreateBinding.groupNameInput.text.isNullOrBlank()) { diff --git a/app/src/main/java/org/schabi/newpipe/settings/preferencesearch/PreferenceSearchItem.kt b/app/src/main/java/org/schabi/newpipe/settings/preferencesearch/PreferenceSearchItem.kt index 750e40eae03..82bbe7b232a 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/preferencesearch/PreferenceSearchItem.kt +++ b/app/src/main/java/org/schabi/newpipe/settings/preferencesearch/PreferenceSearchItem.kt @@ -26,14 +26,13 @@ data class PreferenceSearchItem( val breadcrumbs: String, @XmlRes val searchIndexItemResId: Int ) { + val allRelevantSearchFields: List + get() = listOf(title, summary, entries, breadcrumbs) + fun hasData(): Boolean { return !key.isEmpty() && !title.isEmpty() } - fun getAllRelevantSearchFields(): MutableList { - return mutableListOf(title, summary, entries, breadcrumbs) - } - override fun toString(): String { return "PreferenceItem: $title $summary $key" }