-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GenzToons: Update theme and domain (#5587)
* update theme and domain * add paid chapters preference
- Loading branch information
Showing
2 changed files
with
56 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
ext { | ||
extName = 'Genz Toons' | ||
extClass = '.GenzToons' | ||
themePkg = 'mangathemesia' | ||
baseUrl = 'https://genztoons.com' | ||
overrideVersionCode = 4 | ||
themePkg = 'keyoapp' | ||
baseUrl = 'https://genzupdates.com' | ||
overrideVersionCode = 28 | ||
} | ||
|
||
apply from: "$rootDir/common.gradle" |
60 changes: 53 additions & 7 deletions
60
src/en/suryascans/src/eu/kanade/tachiyomi/extension/en/suryascans/GenzToons.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,62 @@ | ||
package eu.kanade.tachiyomi.extension.en.suryascans | ||
|
||
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia | ||
import android.app.Application | ||
import android.content.SharedPreferences | ||
import androidx.preference.PreferenceScreen | ||
import androidx.preference.SwitchPreferenceCompat | ||
import eu.kanade.tachiyomi.multisrc.keyoapp.Keyoapp | ||
import eu.kanade.tachiyomi.network.interceptor.rateLimit | ||
import eu.kanade.tachiyomi.source.ConfigurableSource | ||
import eu.kanade.tachiyomi.source.model.SChapter | ||
import org.jsoup.nodes.Element | ||
import uy.kohesive.injekt.Injekt | ||
import uy.kohesive.injekt.api.get | ||
|
||
class GenzToons : MangaThemesia( | ||
"Genz Toons", | ||
"https://genztoons.com", | ||
"en", | ||
) { | ||
override val id = 2909429739457928148 | ||
class GenzToons : | ||
Keyoapp( | ||
"Genz Toons", | ||
"https://genztoons.com", | ||
"en", | ||
), | ||
ConfigurableSource { | ||
|
||
private val preferences: SharedPreferences = | ||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000) | ||
|
||
override val client = super.client.newBuilder() | ||
.rateLimit(3) | ||
.build() | ||
|
||
override fun chapterListSelector(): String { | ||
if (!preferences.showPaidChapters) { | ||
return "#chapters > a:not(:has(.text-sm span:matches(Upcoming))):not(:has(img[src*=Coin.svg]))" | ||
} | ||
return "#chapters > a:not(:has(.text-sm span:matches(Upcoming)))" | ||
} | ||
|
||
override fun chapterFromElement(element: Element): SChapter { | ||
return super.chapterFromElement(element).apply { | ||
if (element.select("img[src*=Coin.svg]").isNotEmpty()) { | ||
name = "🔒 $name" | ||
} | ||
} | ||
} | ||
|
||
override fun setupPreferenceScreen(screen: PreferenceScreen) { | ||
SwitchPreferenceCompat(screen.context).apply { | ||
key = SHOW_PAID_CHAPTERS_PREF | ||
title = "Display paid chapters" | ||
summaryOn = "Paid chapters will appear." | ||
summaryOff = "Only free chapters will be displayed." | ||
setDefaultValue(SHOW_PAID_CHAPTERS_DEFAULT) | ||
}.also(screen::addPreference) | ||
} | ||
|
||
private val SharedPreferences.showPaidChapters: Boolean | ||
get() = getBoolean(SHOW_PAID_CHAPTERS_PREF, SHOW_PAID_CHAPTERS_DEFAULT) | ||
|
||
companion object { | ||
private const val SHOW_PAID_CHAPTERS_PREF = "pref_show_paid_chap" | ||
private const val SHOW_PAID_CHAPTERS_DEFAULT = false | ||
} | ||
} |