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>> { return streams.map<List<StreamInfoItem>> {
val items = ArrayList<StreamInfoItem>(it.size) val items = ArrayList<StreamInfoItem>(it.size)
for (streamEntity in it) items.add(streamEntity.toStreamInfoItem()) it.mapTo(items) { it.toStreamInfoItem() }
return@map items return@map items
} }
} }

View file

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

View file

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