Merge pull request #13224 from dustdfg/kotlin_idiomatic
Kotlin misc idiomatic refactor
This commit is contained in:
commit
cc32a9a637
4 changed files with 8 additions and 16 deletions
|
|
@ -62,11 +62,7 @@ data class PlaylistRemoteEntity(
|
||||||
orderingName = playlistInfo.name,
|
orderingName = playlistInfo.name,
|
||||||
url = playlistInfo.url,
|
url = playlistInfo.url,
|
||||||
thumbnailUrl = ImageStrategy.imageListToDbUrl(
|
thumbnailUrl = ImageStrategy.imageListToDbUrl(
|
||||||
if (playlistInfo.thumbnails.isEmpty()) {
|
playlistInfo.thumbnails.ifEmpty { playlistInfo.uploaderAvatars }
|
||||||
playlistInfo.uploaderAvatars
|
|
||||||
} else {
|
|
||||||
playlistInfo.thumbnails
|
|
||||||
}
|
|
||||||
),
|
),
|
||||||
uploader = playlistInfo.uploaderName,
|
uploader = playlistInfo.uploaderName,
|
||||||
streamCount = playlistInfo.streamCount
|
streamCount = playlistInfo.streamCount
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,7 @@ class FeedViewModel(
|
||||||
fun setSaveShowPlayedItems(showPlayedItems: Boolean) {
|
fun setSaveShowPlayedItems(showPlayedItems: Boolean) {
|
||||||
this.showPlayedItems.onNext(showPlayedItems)
|
this.showPlayedItems.onNext(showPlayedItems)
|
||||||
PreferenceManager.getDefaultSharedPreferences(application).edit {
|
PreferenceManager.getDefaultSharedPreferences(application).edit {
|
||||||
this.putBoolean(application.getString(R.string.feed_show_watched_items_key), showPlayedItems)
|
putBoolean(application.getString(R.string.feed_show_watched_items_key), showPlayedItems)
|
||||||
this.apply()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -139,8 +138,7 @@ class FeedViewModel(
|
||||||
fun setSaveShowPartiallyPlayedItems(showPartiallyPlayedItems: Boolean) {
|
fun setSaveShowPartiallyPlayedItems(showPartiallyPlayedItems: Boolean) {
|
||||||
this.showPartiallyPlayedItems.onNext(showPartiallyPlayedItems)
|
this.showPartiallyPlayedItems.onNext(showPartiallyPlayedItems)
|
||||||
PreferenceManager.getDefaultSharedPreferences(application).edit {
|
PreferenceManager.getDefaultSharedPreferences(application).edit {
|
||||||
this.putBoolean(application.getString(R.string.feed_show_partially_watched_items_key), showPartiallyPlayedItems)
|
putBoolean(application.getString(R.string.feed_show_partially_watched_items_key), showPartiallyPlayedItems)
|
||||||
this.apply()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -149,8 +147,7 @@ class FeedViewModel(
|
||||||
fun setSaveShowFutureItems(showFutureItems: Boolean) {
|
fun setSaveShowFutureItems(showFutureItems: Boolean) {
|
||||||
this.showFutureItems.onNext(showFutureItems)
|
this.showFutureItems.onNext(showFutureItems)
|
||||||
PreferenceManager.getDefaultSharedPreferences(application).edit {
|
PreferenceManager.getDefaultSharedPreferences(application).edit {
|
||||||
this.putBoolean(application.getString(R.string.feed_show_future_items_key), showFutureItems)
|
putBoolean(application.getString(R.string.feed_show_future_items_key), showFutureItems)
|
||||||
this.apply()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
|
||||||
groupIcon = feedGroupEntity?.icon
|
groupIcon = feedGroupEntity?.icon
|
||||||
groupSortOrder = feedGroupEntity?.sortOrder ?: -1
|
groupSortOrder = feedGroupEntity?.sortOrder ?: -1
|
||||||
|
|
||||||
val feedGroupIcon = if (selectedIcon == null) icon else selectedIcon!!
|
val feedGroupIcon = selectedIcon ?: icon
|
||||||
feedGroupCreateBinding.iconPreview.setImageResource(feedGroupIcon.getDrawableRes())
|
feedGroupCreateBinding.iconPreview.setImageResource(feedGroupIcon.getDrawableRes())
|
||||||
|
|
||||||
if (feedGroupCreateBinding.groupNameInput.text.isNullOrBlank()) {
|
if (feedGroupCreateBinding.groupNameInput.text.isNullOrBlank()) {
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,13 @@ data class PreferenceSearchItem(
|
||||||
val breadcrumbs: String,
|
val breadcrumbs: String,
|
||||||
@XmlRes val searchIndexItemResId: Int
|
@XmlRes val searchIndexItemResId: Int
|
||||||
) {
|
) {
|
||||||
|
val allRelevantSearchFields: List<String>
|
||||||
|
get() = listOf(title, summary, entries, breadcrumbs)
|
||||||
|
|
||||||
fun hasData(): Boolean {
|
fun hasData(): Boolean {
|
||||||
return !key.isEmpty() && !title.isEmpty()
|
return !key.isEmpty() && !title.isEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAllRelevantSearchFields(): MutableList<String?> {
|
|
||||||
return mutableListOf(title, summary, entries, breadcrumbs)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "PreferenceItem: $title $summary $key"
|
return "PreferenceItem: $title $summary $key"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue