Add support for AndroidX preferences (#1971)
* Add stubs for AndroidX preferences * Update extensions for AndroidX preferences
This commit is contained in:
parent
e9d1479dd0
commit
98df581cfd
|
@ -1,10 +1,7 @@
|
||||||
package android.support.v7.preference;
|
package android.support.v7.preference;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Carlos on 5/9/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public abstract class DialogPreference extends Preference {
|
public abstract class DialogPreference extends Preference {
|
||||||
|
|
||||||
public CharSequence getDialogTitle() {
|
public CharSequence getDialogTitle() {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
@ -20,4 +17,5 @@ public abstract class DialogPreference extends Preference {
|
||||||
public void setDialogMessage(CharSequence dialogMessage) {
|
public void setDialogMessage(CharSequence dialogMessage) {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package android.support.v7.preference;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
public class EditTextPreference extends DialogPreference {
|
public class EditTextPreference extends DialogPreference {
|
||||||
|
|
||||||
public EditTextPreference(Context context) {
|
public EditTextPreference(Context context) {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
@ -14,4 +15,5 @@ public class EditTextPreference extends DialogPreference {
|
||||||
public void setText(String text) {
|
public void setText(String text) {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -2,21 +2,17 @@ package android.support.v7.preference;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Carlos on 5/9/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class ListPreference extends Preference {
|
public class ListPreference extends Preference {
|
||||||
|
|
||||||
public ListPreference(Context context) {
|
public ListPreference(Context context) {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEntries(CharSequence[] entries) {
|
public CharSequence[] getEntries() {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharSequence[] getEntries() {
|
public void setEntries(CharSequence[] entries) {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,11 +20,11 @@ public class ListPreference extends Preference {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEntryValues(CharSequence[] entryValues) {
|
public CharSequence[] getEntryValues() {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharSequence[] getEntryValues() {
|
public void setEntryValues(CharSequence[] entryValues) {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,4 +39,5 @@ public class ListPreference extends Preference {
|
||||||
public void setValue(String value) {
|
public void setValue(String value) {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
package android.support.v7.preference;
|
package android.support.v7.preference;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Carlos on 5/9/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class Preference {
|
public class Preference {
|
||||||
public interface OnPreferenceChangeListener {
|
|
||||||
boolean onPreferenceChange(Preference preference, Object newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOnPreferenceChangeListener(OnPreferenceChangeListener onPreferenceChangeListener) {
|
public void setOnPreferenceChangeListener(OnPreferenceChangeListener onPreferenceChangeListener) {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
|
@ -29,7 +22,7 @@ public class Preference {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKey(String key) {
|
public void setSummary(CharSequence summary) {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +30,7 @@ public class Preference {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSummary(CharSequence summary) {
|
public void setKey(String key) {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +38,12 @@ public class Preference {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface OnPreferenceChangeListener {
|
||||||
|
boolean onPreferenceChange(Preference preference, Object newValue);
|
||||||
|
}
|
||||||
|
|
||||||
public interface OnPreferenceClickListener {
|
public interface OnPreferenceClickListener {
|
||||||
boolean onPreferenceClick(Preference preference);
|
boolean onPreferenceClick(Preference preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,6 @@ package android.support.v7.preference;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Carlos on 5/7/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class PreferenceScreen {
|
public class PreferenceScreen {
|
||||||
|
|
||||||
public boolean addPreference(Preference preference) {
|
public boolean addPreference(Preference preference) {
|
||||||
|
@ -15,4 +11,5 @@ public class PreferenceScreen{
|
||||||
public Context getContext() {
|
public Context getContext() {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package androidx.preference;
|
||||||
|
|
||||||
|
public abstract class DialogPreference extends Preference {
|
||||||
|
|
||||||
|
public CharSequence getDialogTitle() {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDialogTitle(CharSequence dialogTitle) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public CharSequence getDialogMessage() {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDialogMessage(CharSequence dialogMessage) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package androidx.preference;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
public class EditTextPreference extends DialogPreference {
|
||||||
|
|
||||||
|
public EditTextPreference(Context context) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String text) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package androidx.preference;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
public class ListPreference extends Preference {
|
||||||
|
|
||||||
|
public ListPreference(Context context) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public CharSequence[] getEntries() {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntries(CharSequence[] entries) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public int findIndexOfValue(String value) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public CharSequence[] getEntryValues() {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntryValues(CharSequence[] entryValues) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValueIndex(int index) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package androidx.preference;
|
||||||
|
|
||||||
|
public class Preference {
|
||||||
|
|
||||||
|
public void setOnPreferenceChangeListener(OnPreferenceChangeListener onPreferenceChangeListener) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnPreferenceClickListener(OnPreferenceClickListener onPreferenceClickListener) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public CharSequence getTitle() {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(CharSequence title) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public CharSequence getSummary() {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSummary(CharSequence summary) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKey(String key) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultValue(Object defaultValue) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnPreferenceChangeListener {
|
||||||
|
boolean onPreferenceChange(Preference preference, Object newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnPreferenceClickListener {
|
||||||
|
boolean onPreferenceClick(Preference preference);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package androidx.preference;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
public class PreferenceScreen {
|
||||||
|
|
||||||
|
public boolean addPreference(Preference preference) {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Context getContext() {
|
||||||
|
throw new RuntimeException("Stub!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,13 +1,9 @@
|
||||||
package eu.kanade.tachiyomi.source;
|
package eu.kanade.tachiyomi.source;
|
||||||
|
|
||||||
import android.support.v7.preference.PreferenceScreen;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Carlos on 5/7/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface ConfigurableSource {
|
public interface ConfigurableSource {
|
||||||
|
|
||||||
void setupPreferenceScreen(PreferenceScreen screen);
|
void setupPreferenceScreen(android.support.v7.preference.PreferenceScreen screen);
|
||||||
|
|
||||||
|
void setupPreferenceScreen(androidx.preference.PreferenceScreen screen);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: Komga'
|
appName = 'Tachiyomi: Komga'
|
||||||
pkgNameSuffix = 'all.komga'
|
pkgNameSuffix = 'all.komga'
|
||||||
extClass = '.Komga'
|
extClass = '.Komga'
|
||||||
extVersionCode = 5
|
extVersionCode = 6
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -190,13 +190,41 @@ open class Komga : ConfigurableSource, HttpSource() {
|
||||||
}
|
}
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
||||||
screen.addPreference(screen.editTextPreference(ADDRESS_TITLE, ADDRESS_DEFAULT, baseUrl))
|
screen.addPreference(screen.editTextPreference(ADDRESS_TITLE, ADDRESS_DEFAULT, baseUrl))
|
||||||
screen.addPreference(screen.editTextPreference(USERNAME_TITLE, USERNAME_DEFAULT, username))
|
screen.addPreference(screen.editTextPreference(USERNAME_TITLE, USERNAME_DEFAULT, username))
|
||||||
screen.addPreference(screen.editTextPreference(PASSWORD_TITLE, PASSWORD_DEFAULT, password))
|
screen.addPreference(screen.editTextPreference(PASSWORD_TITLE, PASSWORD_DEFAULT, password))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun PreferenceScreen.editTextPreference(title: String, default: String, value: String): EditTextPreference {
|
private fun androidx.preference.PreferenceScreen.editTextPreference(title: String, default: String, value: String): androidx.preference.EditTextPreference {
|
||||||
|
return androidx.preference.EditTextPreference(context).apply {
|
||||||
|
key = title
|
||||||
|
this.title = title
|
||||||
|
summary = value
|
||||||
|
this.setDefaultValue(default)
|
||||||
|
dialogTitle = title
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
try {
|
||||||
|
val res = preferences.edit().putString(title, newValue as String).commit()
|
||||||
|
Toast.makeText(context, "Restart Tachiyomi to apply new setting."
|
||||||
|
, Toast.LENGTH_LONG).show()
|
||||||
|
res
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
|
screen.addPreference(screen.supportEditTextPreference(ADDRESS_TITLE, ADDRESS_DEFAULT, baseUrl))
|
||||||
|
screen.addPreference(screen.supportEditTextPreference(USERNAME_TITLE, USERNAME_DEFAULT, username))
|
||||||
|
screen.addPreference(screen.supportEditTextPreference(PASSWORD_TITLE, PASSWORD_DEFAULT, password))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun PreferenceScreen.supportEditTextPreference(title: String, default: String, value: String): EditTextPreference {
|
||||||
return EditTextPreference(context).apply {
|
return EditTextPreference(context).apply {
|
||||||
key = title
|
key = title
|
||||||
this.title = title
|
this.title = title
|
||||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: MangaDex'
|
appName = 'Tachiyomi: MangaDex'
|
||||||
pkgNameSuffix = 'all.mangadex'
|
pkgNameSuffix = 'all.mangadex'
|
||||||
extClass = '.MangadexFactory'
|
extClass = '.MangadexFactory'
|
||||||
extVersionCode = 73
|
extVersionCode = 74
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -581,6 +581,55 @@ abstract class Mangadex(
|
||||||
return baseUrl + attr
|
return baseUrl + attr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
||||||
|
val myPref = androidx.preference.ListPreference(screen.context).apply {
|
||||||
|
key = SHOW_R18_PREF_Title
|
||||||
|
title = SHOW_R18_PREF_Title
|
||||||
|
|
||||||
|
title = SHOW_R18_PREF_Title
|
||||||
|
entries = arrayOf("Show No R18+", "Show All", "Show Only R18+")
|
||||||
|
entryValues = arrayOf("0", "1", "2")
|
||||||
|
summary = "%s"
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
val selected = newValue as String
|
||||||
|
val index = this.findIndexOfValue(selected)
|
||||||
|
preferences.edit().putInt(SHOW_R18_PREF, index).commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val thumbsPref = androidx.preference.ListPreference(screen.context).apply {
|
||||||
|
key = SHOW_THUMBNAIL_PREF_Title
|
||||||
|
title = SHOW_THUMBNAIL_PREF_Title
|
||||||
|
entries = arrayOf("Show high quality", "Show low quality")
|
||||||
|
entryValues = arrayOf("0", "1")
|
||||||
|
summary = "%s"
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
val selected = newValue as String
|
||||||
|
val index = this.findIndexOfValue(selected)
|
||||||
|
preferences.edit().putInt(SHOW_THUMBNAIL_PREF, index).commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val serverPref = androidx.preference.ListPreference(screen.context).apply {
|
||||||
|
key = SERVER_PREF_Title
|
||||||
|
title = SERVER_PREF_Title
|
||||||
|
entries = SERVER_PREF_ENTRIES
|
||||||
|
entryValues = SERVER_PREF_ENTRY_VALUES
|
||||||
|
summary = "%s"
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
val selected = newValue as String
|
||||||
|
val index = this.findIndexOfValue(selected)
|
||||||
|
val entry = entryValues[index] as String
|
||||||
|
preferences.edit().putString(SERVER_PREF, entry).commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
screen.addPreference(myPref)
|
||||||
|
screen.addPreference(thumbsPref)
|
||||||
|
screen.addPreference(serverPref)
|
||||||
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
val myPref = ListPreference(screen.context).apply {
|
val myPref = ListPreference(screen.context).apply {
|
||||||
key = SHOW_R18_PREF_Title
|
key = SHOW_R18_PREF_Title
|
||||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: NHentai'
|
appName = 'Tachiyomi: NHentai'
|
||||||
pkgNameSuffix = 'all.nhentai'
|
pkgNameSuffix = 'all.nhentai'
|
||||||
extClass = '.NHFactory'
|
extClass = '.NHFactory'
|
||||||
extVersionCode = 15
|
extVersionCode = 16
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,29 @@ open class NHentai(
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
||||||
|
val serverPref = androidx.preference.ListPreference(screen.context).apply {
|
||||||
|
key = TITLE_PREF
|
||||||
|
title = TITLE_PREF
|
||||||
|
entries = arrayOf("Full Title", "Short Title")
|
||||||
|
entryValues = arrayOf("full", "short")
|
||||||
|
summary = "%s"
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
displayFullTitle = when(newValue){
|
||||||
|
"full" -> true
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!preferences.contains(TITLE_PREF))
|
||||||
|
preferences.edit().putString(TITLE_PREF, "full").apply()
|
||||||
|
|
||||||
|
screen.addPreference(serverPref)
|
||||||
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
val serverPref = ListPreference(screen.context).apply {
|
val serverPref = ListPreference(screen.context).apply {
|
||||||
key = TITLE_PREF
|
key = TITLE_PREF
|
||||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: WP Manga Stream'
|
appName = 'Tachiyomi: WP Manga Stream'
|
||||||
pkgNameSuffix = 'all.wpmangastream'
|
pkgNameSuffix = 'all.wpmangastream'
|
||||||
extClass = '.WPMangaStreamFactory'
|
extClass = '.WPMangaStreamFactory'
|
||||||
extVersionCode = 2
|
extVersionCode = 3
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,24 @@ abstract class WPMangaStream(override val name: String, override val baseUrl: St
|
||||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
||||||
|
val thumbsPref = androidx.preference.ListPreference(screen.context).apply {
|
||||||
|
key = SHOW_THUMBNAIL_PREF_Title
|
||||||
|
title = SHOW_THUMBNAIL_PREF_Title
|
||||||
|
entries = arrayOf("Show high quality", "Show mid quality", "Show low quality")
|
||||||
|
entryValues = arrayOf("0", "1", "2")
|
||||||
|
summary = "%s"
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
val selected = newValue as String
|
||||||
|
val index = this.findIndexOfValue(selected)
|
||||||
|
preferences.edit().putInt(SHOW_THUMBNAIL_PREF, index).commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
screen.addPreference(thumbsPref)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
val thumbsPref = ListPreference(screen.context).apply {
|
val thumbsPref = ListPreference(screen.context).apply {
|
||||||
key = SHOW_THUMBNAIL_PREF_Title
|
key = SHOW_THUMBNAIL_PREF_Title
|
||||||
title = SHOW_THUMBNAIL_PREF_Title
|
title = SHOW_THUMBNAIL_PREF_Title
|
||||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: Guya'
|
appName = 'Tachiyomi: Guya'
|
||||||
pkgNameSuffix = "en.guya"
|
pkgNameSuffix = "en.guya"
|
||||||
extClass = '.Guya'
|
extClass = '.Guya'
|
||||||
extVersionCode = 7
|
extVersionCode = 8
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,32 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
return parseManga(truncatedJSON)
|
return parseManga(truncatedJSON)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
||||||
|
val preference = androidx.preference.ListPreference(screen.context).apply {
|
||||||
|
key = "preferred_scanlator"
|
||||||
|
title = "Preferred scanlator"
|
||||||
|
entries = arrayOf<String>()
|
||||||
|
entryValues = arrayOf<String>()
|
||||||
|
for (key in Scanlators.keys()) {
|
||||||
|
entries += Scanlators.getValueFromKey(key)
|
||||||
|
entryValues += key
|
||||||
|
}
|
||||||
|
summary = "Current: %s\n\n" +
|
||||||
|
"This setting sets the scanlation group to prioritize " +
|
||||||
|
"on chapter refresh/update. It will get the next available if " +
|
||||||
|
"your preferred scanlator isn't an option (yet)."
|
||||||
|
|
||||||
|
this.setDefaultValue("1")
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener{_, newValue ->
|
||||||
|
val selected = newValue.toString()
|
||||||
|
preferences.edit().putString(SCANLATOR_PREFERENCE, selected).commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
screen.addPreference(preference)
|
||||||
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
val preference = ListPreference(screen.context).apply {
|
val preference = ListPreference(screen.context).apply {
|
||||||
key = "preferred_scanlator"
|
key = "preferred_scanlator"
|
||||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: MangaKisa'
|
appName = 'Tachiyomi: MangaKisa'
|
||||||
pkgNameSuffix = 'en.mangakisa'
|
pkgNameSuffix = 'en.mangakisa'
|
||||||
extClass = '.MangaKisa'
|
extClass = '.MangaKisa'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,39 @@ class MangaKisa : ConfigurableSource, ParsedHttpSource() {
|
||||||
))
|
))
|
||||||
|
|
||||||
// Preferences Code
|
// Preferences Code
|
||||||
|
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
||||||
|
val popularmangapref = androidx.preference.ListPreference(screen.context).apply {
|
||||||
|
key = BROWSE_PREF_Title
|
||||||
|
title = BROWSE_PREF_Title
|
||||||
|
entries = arrayOf("Weekly", "All Time")
|
||||||
|
entryValues = arrayOf("popular", "popular-alltime")
|
||||||
|
summary = "%s"
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
val selected = newValue as String
|
||||||
|
val index = this.findIndexOfValue(selected)
|
||||||
|
val entry = entryValues.get(index) as String
|
||||||
|
preferences.edit().putString(BROWSE_PREF, entry).commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val latestmangapref = androidx.preference.ListPreference(screen.context).apply {
|
||||||
|
key = LATEST_PREF_Title
|
||||||
|
title = LATEST_PREF_Title
|
||||||
|
entries = arrayOf("Popular Updates", "All Updates")
|
||||||
|
entryValues = arrayOf("latest", "all-updates/latest")
|
||||||
|
summary = "%s"
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
val selected = newValue as String
|
||||||
|
val index = this.findIndexOfValue(selected)
|
||||||
|
val entry = entryValues.get(index) as String
|
||||||
|
preferences.edit().putString(LATEST_PREF, entry).commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
screen.addPreference(popularmangapref)
|
||||||
|
screen.addPreference(latestmangapref)
|
||||||
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
val popularmangapref = ListPreference(screen.context).apply {
|
val popularmangapref = ListPreference(screen.context).apply {
|
||||||
key = BROWSE_PREF_Title
|
key = BROWSE_PREF_Title
|
||||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: LectorManga'
|
appName = 'Tachiyomi: LectorManga'
|
||||||
pkgNameSuffix = 'es.lectormanga'
|
pkgNameSuffix = 'es.lectormanga'
|
||||||
extClass = '.LectorManga'
|
extClass = '.LectorManga'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -408,6 +408,24 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preferences Code
|
// Preferences Code
|
||||||
|
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
||||||
|
val deduppref = androidx.preference.ListPreference(screen.context).apply {
|
||||||
|
key = DEDUP_PREF_Title
|
||||||
|
title = DEDUP_PREF_Title
|
||||||
|
entries = arrayOf("All scanlators", "One scanlator per chapter")
|
||||||
|
entryValues = arrayOf("all", "one")
|
||||||
|
summary = "%s"
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
val selected = newValue as String
|
||||||
|
val index = this.findIndexOfValue(selected)
|
||||||
|
val entry = entryValues.get(index) as String
|
||||||
|
preferences.edit().putString(DEDUP_PREF, entry).commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
screen.addPreference(deduppref)
|
||||||
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
val deduppref = ListPreference(screen.context).apply {
|
val deduppref = ListPreference(screen.context).apply {
|
||||||
key = DEDUP_PREF_Title
|
key = DEDUP_PREF_Title
|
||||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: TuMangaOnline'
|
appName = 'Tachiyomi: TuMangaOnline'
|
||||||
pkgNameSuffix = 'es.tumangaonline'
|
pkgNameSuffix = 'es.tumangaonline'
|
||||||
extClass = '.TuMangaOnline'
|
extClass = '.TuMangaOnline'
|
||||||
extVersionCode = 13
|
extVersionCode = 14
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -421,6 +421,24 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preferences Code
|
// Preferences Code
|
||||||
|
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
||||||
|
val deduppref = androidx.preference.ListPreference(screen.context).apply {
|
||||||
|
key = DEDUP_PREF_Title
|
||||||
|
title = DEDUP_PREF_Title
|
||||||
|
entries = arrayOf("All scanlators", "One scanlator per chapter")
|
||||||
|
entryValues = arrayOf("all", "one")
|
||||||
|
summary = "%s"
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
val selected = newValue as String
|
||||||
|
val index = this.findIndexOfValue(selected)
|
||||||
|
val entry = entryValues.get(index) as String
|
||||||
|
preferences.edit().putString(DEDUP_PREF, entry).commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
screen.addPreference(deduppref)
|
||||||
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
val deduppref = ListPreference(screen.context).apply {
|
val deduppref = ListPreference(screen.context).apply {
|
||||||
key = DEDUP_PREF_Title
|
key = DEDUP_PREF_Title
|
||||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: ManaMoa'
|
appName = 'Tachiyomi: ManaMoa'
|
||||||
pkgNameSuffix = 'ko.mangashowme'
|
pkgNameSuffix = 'ko.mangashowme'
|
||||||
extClass = '.ManaMoa'
|
extClass = '.ManaMoa'
|
||||||
extVersionCode = 14
|
extVersionCode = 15
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -267,6 +267,30 @@ class ManaMoa : ConfigurableSource, ParsedHttpSource() {
|
||||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
||||||
|
val baseUrlPref = androidx.preference.EditTextPreference(screen.context).apply {
|
||||||
|
key = BASE_URL_PREF_TITLE
|
||||||
|
title = BASE_URL_PREF_TITLE
|
||||||
|
summary = BASE_URL_PREF_SUMMARY
|
||||||
|
this.setDefaultValue(defaultBaseUrl)
|
||||||
|
dialogTitle = BASE_URL_PREF_TITLE
|
||||||
|
dialogMessage = "Default: $defaultBaseUrl"
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
try {
|
||||||
|
val res = preferences.edit().putString(BASE_URL_PREF, newValue as String).commit()
|
||||||
|
Toast.makeText(screen.context, RESTART_TACHIYOMI, Toast.LENGTH_LONG).show()
|
||||||
|
res
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
screen.addPreference(baseUrlPref)
|
||||||
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
val baseUrlPref = EditTextPreference(screen.context).apply {
|
val baseUrlPref = EditTextPreference(screen.context).apply {
|
||||||
key = BASE_URL_PREF_TITLE
|
key = BASE_URL_PREF_TITLE
|
||||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: NewToki'
|
appName = 'Tachiyomi: NewToki'
|
||||||
pkgNameSuffix = 'ko.newtoki'
|
pkgNameSuffix = 'ko.newtoki'
|
||||||
extClass = '.NewTokiFactory'
|
extClass = '.NewTokiFactory'
|
||||||
extVersionCode = 10
|
extVersionCode = 11
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,6 +198,30 @@ open class NewToki(override val name: String, private val defaultBaseUrl: String
|
||||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
||||||
|
val baseUrlPref = androidx.preference.EditTextPreference(screen.context).apply {
|
||||||
|
key = BASE_URL_PREF_TITLE
|
||||||
|
title = BASE_URL_PREF_TITLE
|
||||||
|
summary = BASE_URL_PREF_SUMMARY
|
||||||
|
this.setDefaultValue(defaultBaseUrl)
|
||||||
|
dialogTitle = BASE_URL_PREF_TITLE
|
||||||
|
dialogMessage = "Default: $defaultBaseUrl"
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
try {
|
||||||
|
val res = preferences.edit().putString(BASE_URL_PREF, newValue as String).commit()
|
||||||
|
Toast.makeText(screen.context, RESTART_TACHIYOMI, Toast.LENGTH_LONG).show()
|
||||||
|
res
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
screen.addPreference(baseUrlPref)
|
||||||
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
val baseUrlPref = EditTextPreference(screen.context).apply {
|
val baseUrlPref = EditTextPreference(screen.context).apply {
|
||||||
key = BASE_URL_PREF_TITLE
|
key = BASE_URL_PREF_TITLE
|
||||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: MangaLib'
|
appName = 'Tachiyomi: MangaLib'
|
||||||
pkgNameSuffix = 'ru.libmanga'
|
pkgNameSuffix = 'ru.libmanga'
|
||||||
extClass = '.LibManga'
|
extClass = '.LibManga'
|
||||||
extVersionCode = 8
|
extVersionCode = 9
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,29 @@ class LibManga : ConfigurableSource, HttpSource() {
|
||||||
|
|
||||||
private val jsonParser = JsonParser()
|
private val jsonParser = JsonParser()
|
||||||
|
|
||||||
|
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
||||||
|
val serverPref = androidx.preference.ListPreference(screen.context).apply {
|
||||||
|
key = SERVER_PREF
|
||||||
|
title = SERVER_PREF_Title
|
||||||
|
entries = arrayOf("Основной", "Второй")
|
||||||
|
entryValues = arrayOf("main", "alt")
|
||||||
|
summary = "%s"
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
imageServerUrl = when(newValue){
|
||||||
|
"main" -> "https://img2.mangalib.me"
|
||||||
|
else -> "https://img3.mangalib.me"
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!preferences.contains(SERVER_PREF))
|
||||||
|
preferences.edit().putString(SERVER_PREF, "main").apply()
|
||||||
|
|
||||||
|
screen.addPreference(serverPref)
|
||||||
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
val serverPref = ListPreference(screen.context).apply {
|
val serverPref = ListPreference(screen.context).apply {
|
||||||
key = SERVER_PREF
|
key = SERVER_PREF
|
||||||
|
|
|
@ -10,7 +10,6 @@ ext {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly project(':preference-stub')
|
|
||||||
compileOnly 'com.google.code.gson:gson:2.8.5'
|
compileOnly 'com.google.code.gson:gson:2.8.5'
|
||||||
compileOnly 'com.github.salomonbrys.kotson:kotson:2.5.0'
|
compileOnly 'com.github.salomonbrys.kotson:kotson:2.5.0'
|
||||||
compileOnly 'com.github.inorichi.injekt:injekt-core:65b0440'
|
compileOnly 'com.github.inorichi.injekt:injekt-core:65b0440'
|
||||||
|
|
Loading…
Reference in New Issue