MangaLib: Show domain warning as toast (#7012)
* MangaLib: Show domain warning as toast * MangaLib: Fix
This commit is contained in:
parent
9bbe025fd9
commit
35c574a9ca
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'MangaLib'
|
extName = 'MangaLib'
|
||||||
pkgNameSuffix = 'ru.libmanga'
|
pkgNameSuffix = 'ru.libmanga'
|
||||||
extClass = '.LibManga'
|
extClass = '.LibManga'
|
||||||
extVersionCode = 45
|
extVersionCode = 46
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.extension.ru.libmanga
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import com.github.salomonbrys.kotson.array
|
import com.github.salomonbrys.kotson.array
|
||||||
|
@ -786,13 +787,20 @@ class LibManga : ConfigurableSource, HttpSource() {
|
||||||
val domainPref = ListPreference(screen.context).apply {
|
val domainPref = ListPreference(screen.context).apply {
|
||||||
key = DOMAIN_PREF
|
key = DOMAIN_PREF
|
||||||
title = DOMAIN_PREF_Title
|
title = DOMAIN_PREF_Title
|
||||||
entries = arrayOf("mangalib.me(Основной)", "mangalib.org(Зеркало)")
|
entries = arrayOf("Основной (mangalib.me)", "Зеркало (mangalib.org)")
|
||||||
entryValues = arrayOf(baseOrig, baseMirr)
|
entryValues = arrayOf(baseOrig, baseMirr)
|
||||||
summary = "Для смены домена необходимо перезапустить приложение с полной остановкой"
|
summary = "%s"
|
||||||
setDefaultValue(baseOrig)
|
setDefaultValue(baseOrig)
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
val selected = newValue as String
|
try {
|
||||||
preferences.edit().putString(DOMAIN_PREF, selected).commit()
|
val res = preferences.edit().putString(DOMAIN_PREF, newValue as String).commit()
|
||||||
|
val warning = "Для смены домена необходимо перезапустить приложение с полной остановкой."
|
||||||
|
Toast.makeText(screen.context, warning, Toast.LENGTH_LONG).show()
|
||||||
|
res
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue