Fix a few Kotlin style issues

This commit is contained in:
TacoTheDank 2020-10-31 15:57:49 -04:00
parent 31cffa68c5
commit a48529872d
3 changed files with 5 additions and 5 deletions

View File

@ -50,7 +50,7 @@ class FeedDatabaseManager(context: Context) {
return streams.map<List<StreamInfoItem>> {
val items = ArrayList<StreamInfoItem>(it.size)
for (streamEntity in it) items.add(streamEntity.toStreamInfoItem())
it.mapTo(items) { it.toStreamInfoItem() }
return@map items
}
}

View File

@ -161,8 +161,8 @@ class FeedLoadService : Service() {
companion object {
fun wrapList(subscriptionId: Long, info: ListInfo<StreamInfoItem>): List<Throwable> {
val toReturn = ArrayList<Throwable>(info.errors.size)
for (error in info.errors) {
toReturn.add(RequestException(subscriptionId, info.serviceId.toString() + ":" + info.url, error))
info.errors.mapTo(toReturn) {
RequestException(subscriptionId, info.serviceId.toString() + ":" + info.url, it)
}
return toReturn
}

View File

@ -37,8 +37,8 @@ class FeedGroupDialogViewModel(
BiFunction { t1: String, t2: Boolean -> Filter(t1, t2) }
)
.distinctUntilChanged()
.switchMap { filter ->
subscriptionManager.getSubscriptions(groupId, filter.query, filter.showOnlyUngrouped)
.switchMap { (query, showOnlyUngrouped) ->
subscriptionManager.getSubscriptions(groupId, query, showOnlyUngrouped)
}.map { list -> list.map { PickerSubscriptionItem(it) } }
private val mutableGroupLiveData = MutableLiveData<FeedGroupEntity>()