Allow choosing hitomi.la thumbnail quality
This commit is contained in:
parent
2a60c828d7
commit
f6a8b23498
@ -194,4 +194,6 @@ object PreferenceKeys {
|
|||||||
const val eh_autoUpdateStats = "eh_auto_update_stats"
|
const val eh_autoUpdateStats = "eh_auto_update_stats"
|
||||||
|
|
||||||
const val eh_aggressivePageLoading = "eh_aggressive_page_loading"
|
const val eh_aggressivePageLoading = "eh_aggressive_page_loading"
|
||||||
|
|
||||||
|
const val eh_hl_useHighQualityThumbs = "eh_hl_hq_thumbs"
|
||||||
}
|
}
|
||||||
|
@ -267,4 +267,6 @@ class PreferencesHelper(val context: Context) {
|
|||||||
fun eh_autoUpdateStats() = rxPrefs.getString(Keys.eh_autoUpdateStats, "")
|
fun eh_autoUpdateStats() = rxPrefs.getString(Keys.eh_autoUpdateStats, "")
|
||||||
|
|
||||||
fun eh_aggressivePageLoading() = rxPrefs.getBoolean(Keys.eh_aggressivePageLoading, false)
|
fun eh_aggressivePageLoading() = rxPrefs.getBoolean(Keys.eh_aggressivePageLoading, false)
|
||||||
|
|
||||||
|
fun eh_hl_useHighQualityThumbs() = rxPrefs.getBoolean(Keys.eh_hl_useHighQualityThumbs, false)
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import com.github.salomonbrys.kotson.array
|
|||||||
import com.github.salomonbrys.kotson.get
|
import com.github.salomonbrys.kotson.get
|
||||||
import com.github.salomonbrys.kotson.string
|
import com.github.salomonbrys.kotson.string
|
||||||
import com.google.gson.JsonParser
|
import com.google.gson.JsonParser
|
||||||
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
|
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||||
import eu.kanade.tachiyomi.source.model.*
|
import eu.kanade.tachiyomi.source.model.*
|
||||||
@ -27,6 +29,7 @@ import org.vepta.vdm.ByteCursor
|
|||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.Single
|
import rx.Single
|
||||||
import rx.schedulers.Schedulers
|
import rx.schedulers.Schedulers
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@ -34,6 +37,7 @@ import java.util.*
|
|||||||
* Man, I hate this source :(
|
* Man, I hate this source :(
|
||||||
*/
|
*/
|
||||||
class Hitomi : HttpSource(), LewdSource<HitomiSearchMetadata, Document> {
|
class Hitomi : HttpSource(), LewdSource<HitomiSearchMetadata, Document> {
|
||||||
|
private val prefs: PreferencesHelper by injectLazy()
|
||||||
private val jsonParser by lazy { JsonParser() }
|
private val jsonParser by lazy { JsonParser() }
|
||||||
|
|
||||||
override val id = HITOMI_SOURCE_ID
|
override val id = HITOMI_SOURCE_ID
|
||||||
@ -289,9 +293,11 @@ class Hitomi : HttpSource(), LewdSource<HitomiSearchMetadata, Document> {
|
|||||||
return SManga.create().apply {
|
return SManga.create().apply {
|
||||||
val titleElement = doc.selectFirst("h1")
|
val titleElement = doc.selectFirst("h1")
|
||||||
title = titleElement.text()
|
title = titleElement.text()
|
||||||
// TODO High/low quality thumbnail toggle
|
thumbnail_url = "https:" + if(prefs.eh_hl_useHighQualityThumbs().getOrDefault()) {
|
||||||
// thumbnail_url = "https:" + doc.selectFirst("img").attr("data-srcset").substringBefore(' ')
|
doc.selectFirst("img").attr("data-srcset").substringBefore(' ')
|
||||||
thumbnail_url = "https:" + doc.selectFirst("img").attr("data-src")
|
} else {
|
||||||
|
doc.selectFirst("img").attr("data-src")
|
||||||
|
}
|
||||||
url = titleElement.child(0).attr("href")
|
url = titleElement.child(0).attr("href")
|
||||||
|
|
||||||
// TODO Parse tags and stuff
|
// TODO Parse tags and stuff
|
||||||
|
@ -17,6 +17,11 @@ class SettingsHlController : SettingsController() {
|
|||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
|
||||||
title = "hitomi.la"
|
title = "hitomi.la"
|
||||||
|
|
||||||
// TODO Thumbnail quality chooser
|
switchPreference {
|
||||||
|
title = "Use high-quality thumbnails"
|
||||||
|
summary = "May slow down search results"
|
||||||
|
key = PreferenceKeys.eh_hl_useHighQualityThumbs
|
||||||
|
defaultValue = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user