JDK8, lint fixing (#2888)

* Use Kotlin JDK8

* Satisfy a ton of lints

* Run res/layout files (and manifest) through reformatter
This commit is contained in:
TacoTheDank
2020-04-18 14:47:22 -04:00
committed by GitHub
parent 4fc8800a37
commit 415df2357c
75 changed files with 224 additions and 229 deletions
@@ -53,9 +53,9 @@ class HistoryPresenter : BasePresenter<HistoryController>() {
val map = TreeMap<Date, MutableList<MangaChapterHistory>> { d1, d2 -> d2.compareTo(d1) }
val byDay = recents
.groupByTo(map, { it.history.last_read.toDateKey() })
byDay.flatMap {
val dateItem = DateSectionItem(it.key)
it.value.map { HistoryItem(it, dateItem) }
byDay.flatMap { entry ->
val dateItem = DateSectionItem(entry.key)
entry.value.map { HistoryItem(it, dateItem) }
}
}
.observeOn(AndroidSchedulers.mainThread())
@@ -102,7 +102,7 @@ class HistoryPresenter : BasePresenter<HistoryController>() {
}
val chapters = db.getChapters(manga).executeAsBlocking()
.sortedWith(Comparator<Chapter> { c1, c2 -> sortFunction(c1, c2) })
.sortedWith(Comparator { c1, c2 -> sortFunction(c1, c2) })
val currChapterIndex = chapters.indexOfFirst { chapter.id == it.id }
return when (manga.sorting) {
@@ -156,12 +156,12 @@ class UpdatesController : NucleusController<UpdatesControllerBinding, UpdatesPre
// Get item from position
val item = adapter.getItem(position) as? UpdatesItem ?: return false
if (actionMode != null && adapter.mode == SelectableAdapter.Mode.MULTI) {
return if (actionMode != null && adapter.mode == SelectableAdapter.Mode.MULTI) {
toggleSelection(position)
return true
true
} else {
openChapter(item)
return false
false
}
}
@@ -63,15 +63,15 @@ class UpdatesPresenter(
val map = TreeMap<Date, MutableList<MangaChapter>> { d1, d2 -> d2.compareTo(d1) }
val byDay = mangaChapters
.groupByTo(map, { it.chapter.date_fetch.toDateKey() })
byDay.flatMap {
val dateItem = DateSectionItem(it.key)
it.value
byDay.flatMap { entry ->
val dateItem = DateSectionItem(entry.key)
entry.value
.sortedWith(compareBy({ it.chapter.date_fetch }, { it.chapter.chapter_number })).asReversed()
.map { UpdatesItem(it.chapter, it.manga, dateItem) }
}
}
.doOnNext {
it.forEach { item ->
.doOnNext { list ->
list.forEach { item ->
// Find an active download for this chapter.
val download = downloadManager.queue.find { it.chapter.id == item.chapter.id }
@@ -81,8 +81,8 @@ class UpdatesPresenter(
item.download = download
}
}
setDownloadedChapters(it)
chapters = it
setDownloadedChapters(list)
chapters = list
}
}