Add default category list
Fix default language list
This commit is contained in:
parent
bf4887d0b4
commit
5e7ffa3285
@ -248,4 +248,6 @@ object PreferenceKeys {
|
|||||||
const val eh_watched_list_default_state = "eh_watched_list_default_state"
|
const val eh_watched_list_default_state = "eh_watched_list_default_state"
|
||||||
|
|
||||||
const val eh_settings_languages = "eh_settings_languages"
|
const val eh_settings_languages = "eh_settings_languages"
|
||||||
|
|
||||||
|
const val eh_enabled_categories = "eh_enabled_categories"
|
||||||
}
|
}
|
||||||
|
@ -353,5 +353,7 @@ class PreferencesHelper(val context: Context) {
|
|||||||
|
|
||||||
fun eh_watchedListDefaultState() = flowPrefs.getBoolean(Keys.eh_watched_list_default_state, false)
|
fun eh_watchedListDefaultState() = flowPrefs.getBoolean(Keys.eh_watched_list_default_state, false)
|
||||||
|
|
||||||
fun eh_settingsLanguages() = flowPrefs.getString(Keys.eh_settings_languages, "false,false,false\nfalse,false,false\nfalse,false,false\nfalse,false,false\nfalse,false,false\nfalse,false,false\nfalse,false,false\nfalse,false,false\nfalse,false,false\nfalse,false,false\nfalse,false,false\nfalse,false,false\nfalse,false,false\nfalse,false,false\nfalse,false,false\nfalse,false,false\nfalse,false,false")
|
fun eh_settingsLanguages() = flowPrefs.getString(Keys.eh_settings_languages, "false*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false")
|
||||||
|
|
||||||
|
fun eh_EnabledCategories() = flowPrefs.getString(Keys.eh_enabled_categories, "false,false,false,false,false,false,false,false,false,false")
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,16 @@ import exh.util.await
|
|||||||
import exh.util.trans
|
import exh.util.trans
|
||||||
import humanize.Humanize
|
import humanize.Humanize
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
import kotlinx.android.synthetic.main.eh_dialog_categories.view.artist_cg_checkbox
|
||||||
|
import kotlinx.android.synthetic.main.eh_dialog_categories.view.asian_porn_checkbox
|
||||||
|
import kotlinx.android.synthetic.main.eh_dialog_categories.view.cosplay_checkbox
|
||||||
|
import kotlinx.android.synthetic.main.eh_dialog_categories.view.doujinshi_checkbox
|
||||||
|
import kotlinx.android.synthetic.main.eh_dialog_categories.view.game_cg_checkbox
|
||||||
|
import kotlinx.android.synthetic.main.eh_dialog_categories.view.image_set_checkbox
|
||||||
|
import kotlinx.android.synthetic.main.eh_dialog_categories.view.manga_checkbox
|
||||||
|
import kotlinx.android.synthetic.main.eh_dialog_categories.view.misc_checkbox
|
||||||
|
import kotlinx.android.synthetic.main.eh_dialog_categories.view.non_h_checkbox
|
||||||
|
import kotlinx.android.synthetic.main.eh_dialog_categories.view.western_checkbox
|
||||||
import kotlinx.android.synthetic.main.eh_dialog_languages.view.chinese_original
|
import kotlinx.android.synthetic.main.eh_dialog_languages.view.chinese_original
|
||||||
import kotlinx.android.synthetic.main.eh_dialog_languages.view.chinese_rewrite
|
import kotlinx.android.synthetic.main.eh_dialog_languages.view.chinese_rewrite
|
||||||
import kotlinx.android.synthetic.main.eh_dialog_languages.view.chinese_translated
|
import kotlinx.android.synthetic.main.eh_dialog_languages.view.chinese_translated
|
||||||
@ -414,6 +424,57 @@ class SettingsEhController : SettingsController() {
|
|||||||
}
|
}
|
||||||
}.dependency = PreferenceKeys.eh_enableExHentai
|
}.dependency = PreferenceKeys.eh_enableExHentai
|
||||||
|
|
||||||
|
preference {
|
||||||
|
title = "Front Page Categories"
|
||||||
|
summary = "What categories would you like to show by default on the front page and in searches? They can still be enabled by enabling their filters"
|
||||||
|
|
||||||
|
onClick {
|
||||||
|
MaterialDialog(activity!!)
|
||||||
|
.title(text = "Front Page Categories")
|
||||||
|
.message(text = "What categories would you like to show by default on the front page and in searches? They can still be enabled by enabling their filters")
|
||||||
|
.customView(R.layout.eh_dialog_categories, scrollable = true)
|
||||||
|
.positiveButton {
|
||||||
|
val customView = it.view.contentLayout.customView!!
|
||||||
|
|
||||||
|
with(customView) {
|
||||||
|
preferences.eh_EnabledCategories().set(
|
||||||
|
listOf(
|
||||||
|
(!doujinshi_checkbox.isChecked).toString(),
|
||||||
|
(!manga_checkbox.isChecked).toString(),
|
||||||
|
(!artist_cg_checkbox.isChecked).toString(),
|
||||||
|
(!game_cg_checkbox.isChecked).toString(),
|
||||||
|
(!western_checkbox.isChecked).toString(),
|
||||||
|
(!non_h_checkbox.isChecked).toString(),
|
||||||
|
(!image_set_checkbox.isChecked).toString(),
|
||||||
|
(!cosplay_checkbox.isChecked).toString(),
|
||||||
|
(!asian_porn_checkbox.isChecked).toString(),
|
||||||
|
(!misc_checkbox.isChecked).toString()
|
||||||
|
).joinToString(",")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
preferences.eh_EnabledCategories().reconfigure()
|
||||||
|
}
|
||||||
|
.show {
|
||||||
|
val customView = this.view.contentLayout.customView!!
|
||||||
|
|
||||||
|
with(customView) {
|
||||||
|
val list = preferences.eh_EnabledCategories().get().split(",").map { !it.toBoolean() }
|
||||||
|
doujinshi_checkbox.isChecked = list[0]
|
||||||
|
manga_checkbox.isChecked = list[1]
|
||||||
|
artist_cg_checkbox.isChecked = list[2]
|
||||||
|
game_cg_checkbox.isChecked = list[3]
|
||||||
|
western_checkbox.isChecked = list[4]
|
||||||
|
non_h_checkbox.isChecked = list[5]
|
||||||
|
image_set_checkbox.isChecked = list[6]
|
||||||
|
cosplay_checkbox.isChecked = list[7]
|
||||||
|
asian_porn_checkbox.isChecked = list[8]
|
||||||
|
misc_checkbox.isChecked = list[9]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.dependency = PreferenceKeys.eh_enableExHentai
|
||||||
|
|
||||||
switchPreference {
|
switchPreference {
|
||||||
defaultValue = false
|
defaultValue = false
|
||||||
key = PreferenceKeys.eh_watched_list_default_state
|
key = PreferenceKeys.eh_watched_list_default_state
|
||||||
|
@ -65,6 +65,8 @@ class EhUConfigBuilder {
|
|||||||
|
|
||||||
configItems += Entry.LanguageSystem().getLanguages(prefs.eh_settingsLanguages().get().split("\n"))
|
configItems += Entry.LanguageSystem().getLanguages(prefs.eh_settingsLanguages().get().split("\n"))
|
||||||
|
|
||||||
|
configItems += Entry.Categories().categoryConfigs(prefs.eh_EnabledCategories().get().split(",").map { it.toBoolean() })
|
||||||
|
|
||||||
// Actually build form body
|
// Actually build form body
|
||||||
val formBody = FormBody.Builder()
|
val formBody = FormBody.Builder()
|
||||||
configItems.forEach {
|
configItems.forEach {
|
||||||
@ -154,6 +156,65 @@ object Entry {
|
|||||||
override val value = "$value"
|
override val value = "$value"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Categories() {
|
||||||
|
|
||||||
|
fun categoryConfigs(list: List<Boolean>): List<ConfigItem> {
|
||||||
|
return listOf(
|
||||||
|
Doujinshi(list[0]),
|
||||||
|
Manga(list[1]),
|
||||||
|
ArtistCG(list[2]),
|
||||||
|
GameCG(list[3]),
|
||||||
|
Western(list[4]),
|
||||||
|
NonH(list[5]),
|
||||||
|
ImageSet(list[6]),
|
||||||
|
Cosplay(list[7]),
|
||||||
|
AsianPorn(list[8]),
|
||||||
|
Misc(list[9])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
class Doujinshi(exclude: Boolean) : ConfigItem {
|
||||||
|
override val value = if (exclude) "1" else "0"
|
||||||
|
override val key = "ct_doujinshi"
|
||||||
|
}
|
||||||
|
class Manga(exclude: Boolean) : ConfigItem {
|
||||||
|
override val value = if (exclude) "1" else "0"
|
||||||
|
override val key = "ct_manga"
|
||||||
|
}
|
||||||
|
class ArtistCG(exclude: Boolean) : ConfigItem {
|
||||||
|
override val value = if (exclude) "1" else "0"
|
||||||
|
override val key = "ct_artistcg"
|
||||||
|
}
|
||||||
|
class GameCG(exclude: Boolean) : ConfigItem {
|
||||||
|
override val value = if (exclude) "1" else "0"
|
||||||
|
override val key = "ct_gamecg"
|
||||||
|
}
|
||||||
|
class Western(exclude: Boolean) : ConfigItem {
|
||||||
|
override val value = if (exclude) "1" else "0"
|
||||||
|
override val key = "ct_western"
|
||||||
|
}
|
||||||
|
class NonH(exclude: Boolean) : ConfigItem {
|
||||||
|
override val value = if (exclude) "1" else "0"
|
||||||
|
override val key = "ct_non-h"
|
||||||
|
}
|
||||||
|
class ImageSet(exclude: Boolean) : ConfigItem {
|
||||||
|
override val value = if (exclude) "1" else "0"
|
||||||
|
override val key = "ct_imageset"
|
||||||
|
}
|
||||||
|
class Cosplay(exclude: Boolean) : ConfigItem {
|
||||||
|
override val value = if (exclude) "1" else "0"
|
||||||
|
override val key = "ct_cosplay"
|
||||||
|
}
|
||||||
|
class AsianPorn(exclude: Boolean) : ConfigItem {
|
||||||
|
override val value = if (exclude) "1" else "0"
|
||||||
|
override val key = "ct_asianporn"
|
||||||
|
}
|
||||||
|
class Misc(exclude: Boolean) : ConfigItem {
|
||||||
|
override val value = if (exclude) "1" else "0"
|
||||||
|
override val key = "ct_misc_div"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class LanguageSystem {
|
class LanguageSystem {
|
||||||
|
|
||||||
fun getLanguages(values: List<String>): List<ConfigItem> {
|
fun getLanguages(values: List<String>): List<ConfigItem> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user