Minor typo fix and code cleanup
This commit is contained in:
parent
6bfddb3ece
commit
72504ca53f
@ -33,7 +33,6 @@ import io.realm.RealmConfiguration
|
|||||||
import io.realm.RealmResults
|
import io.realm.RealmResults
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.Scheduler
|
import rx.Scheduler
|
||||||
@ -194,7 +193,7 @@ class Hitomi(private val context: Context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
||||||
return urlImportFetchSearchManga(query, {
|
return urlImportFetchSearchManga(query) {
|
||||||
trySearch(page, query).map {
|
trySearch(page, query).map {
|
||||||
val res = it.map {
|
val res = it.map {
|
||||||
SManga.create().apply {
|
SManga.create().apply {
|
||||||
@ -210,7 +209,7 @@ class Hitomi(private val context: Context)
|
|||||||
|
|
||||||
MangasPage(res, it.isNotEmpty())
|
MangasPage(res, it.isNotEmpty())
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
|
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
|
||||||
@ -309,8 +308,8 @@ class Hitomi(private val context: Context)
|
|||||||
val loc = "$BASE_URL/galleries/$hlId.html"
|
val loc = "$BASE_URL/galleries/$hlId.html"
|
||||||
val req = GET(loc)
|
val req = GET(loc)
|
||||||
|
|
||||||
return client.newCall(req).asObservableSuccess().map {
|
return client.newCall(req).asObservableSuccess().map { response ->
|
||||||
val doc = it.asJsoup()
|
val doc = response.asJsoup()
|
||||||
|
|
||||||
Duktape.create().use { duck ->
|
Duktape.create().use { duck ->
|
||||||
val thumbs = doc.getElementsByTag("script").find {
|
val thumbs = doc.getElementsByTag("script").find {
|
||||||
@ -351,10 +350,10 @@ class Hitomi(private val context: Context)
|
|||||||
|
|
||||||
uploadDate = DATE_FORMAT.parse(doc.select(".date").text()).time
|
uploadDate = DATE_FORMAT.parse(doc.select(".date").text()).time
|
||||||
|
|
||||||
galleryParent.select(".gallery-info tr").forEach {
|
galleryParent.select(".gallery-info tr").forEach { element ->
|
||||||
val content = it.child(1)
|
val content = element.child(1)
|
||||||
|
|
||||||
when(it.child(0).text().toLowerCase()) {
|
when(element.child(0).text().toLowerCase()) {
|
||||||
"group" -> group = content.text().trim()
|
"group" -> group = content.text().trim()
|
||||||
"type" -> type = content.text().trim()
|
"type" -> type = content.text().trim()
|
||||||
"language" -> {
|
"language" -> {
|
||||||
@ -429,8 +428,8 @@ class Hitomi(private val context: Context)
|
|||||||
it.insert(newPages)
|
it.insert(newPages)
|
||||||
}
|
}
|
||||||
|
|
||||||
(0 .. 1).map { getCacheRealm(it) }.forEach {
|
(0 .. 1).map { getCacheRealm(it) }.forEach { realm ->
|
||||||
it.useTrans {
|
realm.useTrans {
|
||||||
// Delete old meta
|
// Delete old meta
|
||||||
it.where(HitomiSkeletonGalleryMetadata::class.java)
|
it.where(HitomiSkeletonGalleryMetadata::class.java)
|
||||||
.equalTo(HitomiSkeletonGalleryMetadata::hlId.name, hlId)
|
.equalTo(HitomiSkeletonGalleryMetadata::hlId.name, hlId)
|
||||||
|
@ -43,7 +43,7 @@ class SettingsHlController : SettingsController() {
|
|||||||
|
|
||||||
preference {
|
preference {
|
||||||
title = "Force refresh search database now"
|
title = "Force refresh search database now"
|
||||||
summary = "Delete the local copy of the hitomi.la search database and download the new database now. Hitomi.la search will not working in the ~10mins that it takes to refresh the search database"
|
summary = "Delete the local copy of the hitomi.la search database and download the new database now. Hitomi.la search will not work in the ~10mins that it takes to refresh the search database"
|
||||||
isPersistent = false
|
isPersistent = false
|
||||||
|
|
||||||
onClick {
|
onClick {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user