From 21f446a78e749a9c8611e91d95efb4d86938bd62 Mon Sep 17 00:00:00 2001 From: "Yevhen Babiichuk (DustDFG)" Date: Mon, 9 Feb 2026 17:04:55 +0200 Subject: [PATCH 1/4] Refactor settings/preferencesearch/PreferenceSearchItem#allRelevantSearchFields It doesn't need to return mutable list --- .../settings/preferencesearch/PreferenceSearchItem.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 750e40eae..82bbe7b23 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" } From 289d22eed7798d39e5b0be2ef52a6863df93c3d8 Mon Sep 17 00:00:00 2001 From: "Yevhen Babiichuk (DustDFG)" Date: Mon, 9 Feb 2026 17:10:59 +0200 Subject: [PATCH 2/4] Utilize kotlins ifEmpty --- .../newpipe/database/playlist/model/PlaylistRemoteEntity.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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 82162e1e4..254fa425a 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 From 451409fc3baefea8138dfff44e415cad64f784ee Mon Sep 17 00:00:00 2001 From: "Yevhen Babiichuk (DustDFG)" Date: Mon, 9 Feb 2026 22:54:28 +0200 Subject: [PATCH 3/4] SharedPreferences.edit applies changes automatically --- .../java/org/schabi/newpipe/local/feed/FeedViewModel.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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 7e781b30f..58ec818f3 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) } } From edfdbe805ff098e1b000020fbc98400dc71df57d Mon Sep 17 00:00:00 2001 From: "Yevhen Babiichuk (DustDFG)" Date: Mon, 9 Feb 2026 23:19:32 +0200 Subject: [PATCH 4/4] Uitilize kotlin elvis operator --- .../schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ab856278f..7a256c166 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()) {