mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-10 12:47:26 +01:00
Rewrite preferences with a modified support library v7
This commit is contained in:
parent
cd92569355
commit
9beeca652f
@ -94,8 +94,6 @@ dependencies {
|
||||
compile "com.android.support:design:$support_library_version"
|
||||
compile "com.android.support:recyclerview-v7:$support_library_version"
|
||||
compile "com.android.support:support-annotations:$support_library_version"
|
||||
compile "com.android.support:preference-v7:$support_library_version"
|
||||
compile "com.android.support:preference-v14:$support_library_version"
|
||||
compile "com.android.support:customtabs:$support_library_version"
|
||||
|
||||
// ReactiveX
|
||||
@ -162,6 +160,7 @@ dependencies {
|
||||
compile 'com.nononsenseapps:filepicker:2.5.2'
|
||||
compile 'com.github.amulyakhare:TextDrawable:558677e'
|
||||
compile 'com.afollestad.material-dialogs:core:0.8.5.9'
|
||||
compile 'net.xpece.android:support-preference:0.8.1'
|
||||
|
||||
// Tests
|
||||
testCompile 'junit:junit:4.12'
|
||||
|
@ -61,7 +61,7 @@ class ChaptersFragment : BaseRxFragment<ChaptersPresenter>(), ActionMode.Callbac
|
||||
return inflater.inflate(R.layout.fragment_manga_chapters, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
override fun onViewCreated(view: View, savedState: Bundle?) {
|
||||
// Init RecyclerView and adapter
|
||||
adapter = ChaptersAdapter(this)
|
||||
|
||||
|
@ -64,9 +64,9 @@ class RecentChaptersFragment
|
||||
/**
|
||||
* Called when view is created
|
||||
* @param view created view
|
||||
* @param savedInstanceState status of saved sate
|
||||
* @param savedState status of saved sate
|
||||
*/
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
override fun onViewCreated(view: View, savedState: Bundle?) {
|
||||
// Init RecyclerView and adapter
|
||||
recycler.layoutManager = NpaLinearLayoutManager(activity)
|
||||
recycler.addItemDecoration(DividerItemDecoration(context.theme.getResourceDrawable(R.attr.divider_drawable)))
|
||||
|
@ -54,9 +54,9 @@ class RecentlyReadFragment : BaseRxFragment<RecentlyReadPresenter>() {
|
||||
* Called when view is created
|
||||
*
|
||||
* @param view created view
|
||||
* @param savedInstanceState status of saved sate
|
||||
* @param savedState status of saved sate
|
||||
*/
|
||||
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
|
||||
override fun onViewCreated(view: View?, savedState: Bundle?) {
|
||||
// Initialize adapter
|
||||
recycler.layoutManager = NpaLinearLayoutManager(activity)
|
||||
adapter = RecentlyReadAdapter(this)
|
||||
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.setting
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.v7.preference.SwitchPreferenceCompat
|
||||
import android.support.v7.preference.XpPreferenceFragment
|
||||
import android.view.View
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
@ -17,7 +18,7 @@ import java.text.ParseException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
class SettingsAboutFragment : SettingsNestedFragment() {
|
||||
class SettingsAboutFragment : SettingsFragment() {
|
||||
/**
|
||||
* Checks for new releases
|
||||
*/
|
||||
@ -33,15 +34,16 @@ class SettingsAboutFragment : SettingsNestedFragment() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun newInstance(resourcePreference: Int, resourceTitle: Int): SettingsNestedFragment {
|
||||
val fragment = SettingsAboutFragment()
|
||||
fragment.setArgs(resourcePreference, resourceTitle)
|
||||
return fragment
|
||||
fun newInstance(rootKey: String): SettingsAboutFragment {
|
||||
val args = Bundle()
|
||||
args.putString(XpPreferenceFragment.ARG_PREFERENCE_ROOT, rootKey)
|
||||
return SettingsAboutFragment().apply { arguments = args }
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
override fun onViewCreated(view: View, savedState: Bundle?) {
|
||||
super.onViewCreated(view, savedState)
|
||||
|
||||
val version = findPreference(getString(R.string.pref_version))
|
||||
val buildTime = findPreference(getString(R.string.pref_build_time))
|
||||
|
||||
|
@ -1,97 +1,63 @@
|
||||
package eu.kanade.tachiyomi.ui.setting
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.v14.preference.PreferenceFragment
|
||||
import android.support.v7.preference.PreferenceFragmentCompat
|
||||
import android.support.v7.preference.PreferenceScreen
|
||||
import android.view.MenuItem
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.cache.ChapterCache
|
||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.mangasync.MangaSyncManager
|
||||
import eu.kanade.tachiyomi.data.network.NetworkHelper
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.source.SourceManager
|
||||
import eu.kanade.tachiyomi.ui.base.activity.BaseActivity
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import net.xpece.android.support.preference.PreferenceScreenNavigationStrategy
|
||||
import net.xpece.android.support.preference.PreferenceScreenNavigationStrategy.ReplaceFragment
|
||||
|
||||
class SettingsActivity : BaseActivity() {
|
||||
class SettingsActivity : BaseActivity(),
|
||||
PreferenceFragmentCompat.OnPreferenceStartScreenCallback,
|
||||
PreferenceScreenNavigationStrategy.ReplaceFragment.Callbacks {
|
||||
|
||||
val preferences: PreferencesHelper by injectLazy()
|
||||
val chapterCache: ChapterCache by injectLazy()
|
||||
val db: DatabaseHelper by injectLazy()
|
||||
val sourceManager: SourceManager by injectLazy()
|
||||
val syncManager: MangaSyncManager by injectLazy()
|
||||
val networkHelper: NetworkHelper by injectLazy()
|
||||
private lateinit var replaceFragmentStrategy: ReplaceFragment
|
||||
|
||||
override fun onCreate(savedState: Bundle?) {
|
||||
setAppTheme()
|
||||
super.onCreate(savedState)
|
||||
setContentView(R.layout.activity_preferences)
|
||||
|
||||
setupToolbar(toolbar)
|
||||
replaceFragmentStrategy = ReplaceFragment(this,
|
||||
R.anim.abc_fade_in, R.anim.abc_fade_out,
|
||||
R.anim.abc_fade_in, R.anim.abc_fade_out)
|
||||
|
||||
if (savedState == null) {
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.settings_content, SettingsMainFragment())
|
||||
.commit()
|
||||
supportFragmentManager.beginTransaction()
|
||||
.add(R.id.settings_content, SettingsFragment.newInstance(null), "Settings")
|
||||
.commit()
|
||||
}
|
||||
|
||||
setupToolbar(toolbar, backNavigation = false)
|
||||
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> onBackPressed()
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onBuildPreferenceFragment(key: String?): PreferenceFragmentCompat {
|
||||
return when (key) {
|
||||
"general_screen" -> SettingsGeneralFragment.newInstance(key)
|
||||
"downloads_screen" -> SettingsDownloadsFragment.newInstance(key)
|
||||
"sources_screen" -> SettingsSourcesFragment.newInstance(key)
|
||||
"sync_screen" -> SettingsSyncFragment.newInstance(key)
|
||||
"advanced_screen" -> SettingsAdvancedFragment.newInstance(key)
|
||||
"about_screen" -> SettingsAboutFragment.newInstance(key)
|
||||
else -> SettingsFragment.newInstance(key)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
if (!fragmentManager.popBackStackImmediate()) {
|
||||
super.onBackPressed()
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsMainFragment : PreferenceFragment() {
|
||||
|
||||
override fun onCreatePreferences(savedState: Bundle?, s: String?) {
|
||||
addPreferencesFromResource(R.xml.pref_main)
|
||||
|
||||
registerSubpreference(R.string.pref_category_general_key) {
|
||||
SettingsGeneralFragment.newInstance(R.xml.pref_general, R.string.pref_category_general)
|
||||
}
|
||||
|
||||
registerSubpreference(R.string.pref_category_reader_key) {
|
||||
SettingsNestedFragment.newInstance(R.xml.pref_reader, R.string.pref_category_reader)
|
||||
}
|
||||
|
||||
registerSubpreference(R.string.pref_category_downloads_key) {
|
||||
SettingsDownloadsFragment.newInstance(R.xml.pref_downloads, R.string.pref_category_downloads)
|
||||
}
|
||||
|
||||
registerSubpreference(R.string.pref_category_sources_key) {
|
||||
SettingsSourcesFragment.newInstance(R.xml.pref_sources, R.string.pref_category_sources)
|
||||
}
|
||||
|
||||
registerSubpreference(R.string.pref_category_sync_key) {
|
||||
SettingsSyncFragment.newInstance(R.xml.pref_sync, R.string.pref_category_sync)
|
||||
}
|
||||
|
||||
registerSubpreference(R.string.pref_category_advanced_key) {
|
||||
SettingsAdvancedFragment.newInstance(R.xml.pref_advanced, R.string.pref_category_advanced)
|
||||
}
|
||||
|
||||
registerSubpreference(R.string.pref_category_about_key) {
|
||||
SettingsAboutFragment.newInstance(R.xml.pref_about, R.string.pref_category_about)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
(activity as BaseActivity).setToolbarTitle(getString(R.string.label_settings))
|
||||
}
|
||||
|
||||
private fun registerSubpreference(preferenceResource: Int, func: () -> PreferenceFragment) {
|
||||
findPreference(getString(preferenceResource)).setOnPreferenceClickListener {
|
||||
val fragment = func()
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.settings_content, fragment)
|
||||
.addToBackStack(fragment.javaClass.simpleName)
|
||||
.commit()
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPreferenceStartScreen(p0: PreferenceFragmentCompat, p1: PreferenceScreen): Boolean {
|
||||
replaceFragmentStrategy.onPreferenceStartScreen(supportFragmentManager, p0, p1)
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,38 +1,46 @@
|
||||
package eu.kanade.tachiyomi.ui.setting
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.v7.preference.XpPreferenceFragment
|
||||
import android.view.View
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.cache.ChapterCache
|
||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.network.NetworkHelper
|
||||
import eu.kanade.tachiyomi.util.plusAssign
|
||||
import eu.kanade.tachiyomi.util.toast
|
||||
import rx.Observable
|
||||
import rx.Subscription
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.schedulers.Schedulers
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
class SettingsAdvancedFragment : SettingsNestedFragment() {
|
||||
class SettingsAdvancedFragment : SettingsFragment() {
|
||||
|
||||
companion object {
|
||||
|
||||
fun newInstance(resourcePreference: Int, resourceTitle: Int): SettingsNestedFragment {
|
||||
val fragment = SettingsAdvancedFragment()
|
||||
fragment.setArgs(resourcePreference, resourceTitle)
|
||||
return fragment
|
||||
fun newInstance(rootKey: String): SettingsAdvancedFragment {
|
||||
val args = Bundle()
|
||||
args.putString(XpPreferenceFragment.ARG_PREFERENCE_ROOT, rootKey)
|
||||
return SettingsAdvancedFragment().apply { arguments = args }
|
||||
}
|
||||
}
|
||||
|
||||
private val network: NetworkHelper by injectLazy()
|
||||
|
||||
private val chapterCache: ChapterCache by injectLazy()
|
||||
|
||||
private val db: DatabaseHelper by injectLazy()
|
||||
|
||||
private val clearCache by lazy { findPreference(getString(R.string.pref_clear_chapter_cache_key)) }
|
||||
|
||||
private val clearDatabase by lazy { findPreference(getString(R.string.pref_clear_database_key)) }
|
||||
|
||||
private val clearCookies by lazy { findPreference(getString(R.string.pref_clear_cookies_key)) }
|
||||
|
||||
private var clearCacheSubscription: Subscription? = null
|
||||
override fun onViewCreated(view: View, savedState: Bundle?) {
|
||||
super.onViewCreated(view, savedState)
|
||||
|
||||
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
|
||||
clearCache.setOnPreferenceClickListener {
|
||||
clearChapterCache()
|
||||
true
|
||||
@ -40,7 +48,7 @@ class SettingsAdvancedFragment : SettingsNestedFragment() {
|
||||
clearCache.summary = getString(R.string.used_cache, chapterCache.readableSize)
|
||||
|
||||
clearCookies.setOnPreferenceClickListener {
|
||||
settingsActivity.networkHelper.cookies.removeAll()
|
||||
network.cookies.removeAll()
|
||||
activity.toast(R.string.cookies_cleared)
|
||||
true
|
||||
}
|
||||
@ -51,11 +59,6 @@ class SettingsAdvancedFragment : SettingsNestedFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
clearCacheSubscription?.unsubscribe()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
private fun clearChapterCache() {
|
||||
val deletedFiles = AtomicInteger()
|
||||
|
||||
@ -67,9 +70,7 @@ class SettingsAdvancedFragment : SettingsNestedFragment() {
|
||||
.cancelable(false)
|
||||
.show()
|
||||
|
||||
clearCacheSubscription?.unsubscribe()
|
||||
|
||||
clearCacheSubscription = Observable.defer { Observable.from(files) }
|
||||
subscriptions += Observable.defer { Observable.from(files) }
|
||||
.concatMap { file ->
|
||||
if (chapterCache.removeFileFromCache(file.name)) {
|
||||
deletedFiles.incrementAndGet()
|
||||
@ -102,10 +103,4 @@ class SettingsAdvancedFragment : SettingsNestedFragment() {
|
||||
.show()
|
||||
}
|
||||
|
||||
private val chapterCache: ChapterCache
|
||||
get() = settingsActivity.chapterCache
|
||||
|
||||
private val db: DatabaseHelper
|
||||
get() = settingsActivity.db
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.support.v7.preference.XpPreferenceFragment
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -14,29 +15,32 @@ import com.nononsenseapps.filepicker.FilePickerActivity
|
||||
import com.nononsenseapps.filepicker.FilePickerFragment
|
||||
import com.nononsenseapps.filepicker.LogicHandler
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.util.inflate
|
||||
import rx.Subscription
|
||||
import eu.kanade.tachiyomi.util.plusAssign
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.io.File
|
||||
|
||||
class SettingsDownloadsFragment : SettingsNestedFragment() {
|
||||
class SettingsDownloadsFragment : SettingsFragment() {
|
||||
|
||||
companion object {
|
||||
|
||||
val DOWNLOAD_DIR_CODE = 103
|
||||
|
||||
fun newInstance(resourcePreference: Int, resourceTitle: Int): SettingsNestedFragment {
|
||||
val fragment = SettingsDownloadsFragment()
|
||||
fragment.setArgs(resourcePreference, resourceTitle)
|
||||
return fragment
|
||||
fun newInstance(rootKey: String): SettingsDownloadsFragment {
|
||||
val args = Bundle()
|
||||
args.putString(XpPreferenceFragment.ARG_PREFERENCE_ROOT, rootKey)
|
||||
return SettingsDownloadsFragment().apply { arguments = args }
|
||||
}
|
||||
}
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
|
||||
val downloadDirPref by lazy { findPreference(getString(R.string.pref_download_directory_key)) }
|
||||
|
||||
var downloadDirSubscription: Subscription? = null
|
||||
|
||||
override fun onViewCreated(view: View, savedState: Bundle?) {
|
||||
super.onViewCreated(view, savedState)
|
||||
|
||||
downloadDirPref.setOnPreferenceClickListener {
|
||||
|
||||
val currentDir = preferences.downloadsDirectory().getOrDefault()
|
||||
@ -66,15 +70,10 @@ class SettingsDownloadsFragment : SettingsNestedFragment() {
|
||||
true
|
||||
}
|
||||
|
||||
downloadDirSubscription = preferences.downloadsDirectory().asObservable()
|
||||
subscriptions += preferences.downloadsDirectory().asObservable()
|
||||
.subscribe { downloadDirPref.summary = it }
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
downloadDirSubscription?.unsubscribe()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
fun getExternalFilesDirs(): List<File> {
|
||||
val defaultDir = Environment.getExternalStorageDirectory().absolutePath +
|
||||
File.separator + getString(R.string.app_name) +
|
||||
|
@ -0,0 +1,55 @@
|
||||
package eu.kanade.tachiyomi.ui.setting
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.annotation.CallSuper
|
||||
import android.support.v7.preference.XpPreferenceFragment
|
||||
import android.view.View
|
||||
import eu.kanade.tachiyomi.R
|
||||
import net.xpece.android.support.preference.PreferenceScreenNavigationStrategy
|
||||
import rx.subscriptions.CompositeSubscription
|
||||
|
||||
open class SettingsFragment : XpPreferenceFragment() {
|
||||
|
||||
companion object {
|
||||
fun newInstance(rootKey: String?): SettingsFragment {
|
||||
val args = Bundle()
|
||||
args.putString(XpPreferenceFragment.ARG_PREFERENCE_ROOT, rootKey)
|
||||
return SettingsFragment().apply { arguments = args }
|
||||
}
|
||||
}
|
||||
|
||||
lateinit var subscriptions: CompositeSubscription
|
||||
|
||||
override final fun onCreatePreferences2(savedState: Bundle?, rootKey: String?) {
|
||||
subscriptions = CompositeSubscription()
|
||||
|
||||
addPreferencesFromResource(R.xml.pref_general)
|
||||
addPreferencesFromResource(R.xml.pref_reader)
|
||||
addPreferencesFromResource(R.xml.pref_downloads)
|
||||
addPreferencesFromResource(R.xml.pref_sources)
|
||||
addPreferencesFromResource(R.xml.pref_sync)
|
||||
addPreferencesFromResource(R.xml.pref_advanced)
|
||||
addPreferencesFromResource(R.xml.pref_about)
|
||||
|
||||
// Setup root preference title.
|
||||
preferenceScreen.title = activity.title
|
||||
|
||||
PreferenceScreenNavigationStrategy.ReplaceFragment.onCreatePreferences(this, rootKey)
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
override fun onViewCreated(view: View, savedState: Bundle?) {
|
||||
listView.isFocusable = false
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
activity.title = preferenceScreen.title
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
subscriptions.unsubscribe()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
}
|
@ -2,29 +2,37 @@ package eu.kanade.tachiyomi.ui.setting
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.support.v14.preference.MultiSelectListPreference
|
||||
import android.support.v4.app.TaskStackBuilder
|
||||
import android.support.v7.preference.Preference
|
||||
import android.support.v7.preference.PreferenceFragmentCompat
|
||||
import android.support.v7.preference.XpPreferenceFragment
|
||||
import android.view.View
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateAlarm
|
||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.util.plusAssign
|
||||
import eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
import eu.kanade.tachiyomi.widget.preference.LibraryColumnsDialog
|
||||
import eu.kanade.tachiyomi.widget.preference.SimpleDialogPreference
|
||||
import net.xpece.android.support.preference.MultiSelectListPreference
|
||||
import rx.Observable
|
||||
import rx.Subscription
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class SettingsGeneralFragment : SettingsFragment(),
|
||||
PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback {
|
||||
|
||||
class SettingsGeneralFragment : SettingsNestedFragment() {
|
||||
|
||||
companion object {
|
||||
fun newInstance(resourcePreference: Int, resourceTitle: Int): SettingsGeneralFragment {
|
||||
val fragment = SettingsGeneralFragment();
|
||||
fragment.setArgs(resourcePreference, resourceTitle);
|
||||
return fragment;
|
||||
fun newInstance(rootKey: String): SettingsGeneralFragment {
|
||||
val args = Bundle()
|
||||
args.putString(XpPreferenceFragment.ARG_PREFERENCE_ROOT, rootKey)
|
||||
return SettingsGeneralFragment().apply { arguments = args }
|
||||
}
|
||||
}
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
|
||||
|
||||
val columnsPreference by lazy {
|
||||
findPreference(getString(R.string.pref_library_columns_dialog_key)) as SimpleDialogPreference
|
||||
}
|
||||
@ -41,15 +49,13 @@ class SettingsGeneralFragment : SettingsNestedFragment() {
|
||||
findPreference(getString(R.string.pref_theme_key)) as IntListPreference
|
||||
}
|
||||
|
||||
var updateIntervalSubscription: Subscription? = null
|
||||
override fun onViewCreated(view: View, savedState: Bundle?) {
|
||||
super.onViewCreated(view, savedState)
|
||||
|
||||
var columnsSubscription: Subscription? = null
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
updateIntervalSubscription = preferences.libraryUpdateInterval().asObservable()
|
||||
subscriptions += preferences.libraryUpdateInterval().asObservable()
|
||||
.subscribe { updateRestriction.isVisible = it > 0 }
|
||||
|
||||
columnsSubscription = Observable.combineLatest(
|
||||
subscriptions += Observable.combineLatest(
|
||||
preferences.portraitColumns().asObservable(),
|
||||
preferences.landscapeColumns().asObservable())
|
||||
{ portraitColumns, landscapeColumns -> Pair(portraitColumns, landscapeColumns) }
|
||||
@ -62,29 +68,21 @@ class SettingsGeneralFragment : SettingsNestedFragment() {
|
||||
|
||||
themePreference.setOnPreferenceChangeListener { preference, newValue ->
|
||||
// Rebuild activity's to apply themes.
|
||||
TaskStackBuilder.create(activity)
|
||||
.addNextIntent(Intent(activity, MainActivity::class.java))
|
||||
.addNextIntent(activity.intent)
|
||||
TaskStackBuilder.create(context)
|
||||
.addNextIntentWithParentStack(Intent(activity.intent))
|
||||
.startActivities()
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
updateIntervalSubscription?.unsubscribe()
|
||||
columnsSubscription?.unsubscribe()
|
||||
super.onDestroyView()
|
||||
|
||||
}
|
||||
|
||||
override fun onDisplayPreferenceDialog(preference: Preference) {
|
||||
if (preference === columnsPreference) {
|
||||
val fragment = LibraryColumnsDialog.newInstance(preference)
|
||||
override fun onPreferenceDisplayDialog(p0: PreferenceFragmentCompat?, p: Preference): Boolean {
|
||||
if (p.key == getString(R.string.pref_library_columns_dialog_key)) {
|
||||
val fragment = LibraryColumnsDialog.newInstance(p)
|
||||
fragment.setTargetFragment(this, 0)
|
||||
fragment.show(fragmentManagerCompat, null)
|
||||
} else {
|
||||
super.onDisplayPreferenceDialog(preference)
|
||||
fragment.show(childFragmentManager, null)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun updateColumnsSummary(portraitColumns: Int, landscapeColumns: Int) {
|
||||
|
@ -1,48 +0,0 @@
|
||||
package eu.kanade.tachiyomi.ui.setting
|
||||
|
||||
import android.app.FragmentManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.support.v14.preference.PreferenceFragment
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
|
||||
open class SettingsNestedFragment : PreferenceFragment() {
|
||||
|
||||
companion object {
|
||||
|
||||
private val RESOURCE_FILE = "resource_file"
|
||||
private val TOOLBAR_TITLE = "toolbar_title"
|
||||
|
||||
fun newInstance(resourcePreference: Int, resourceTitle: Int): SettingsNestedFragment {
|
||||
val fragment = SettingsNestedFragment()
|
||||
fragment.setArgs(resourcePreference, resourceTitle)
|
||||
return fragment
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedState: Bundle?, s: String?) {
|
||||
addPreferencesFromResource(arguments.getInt(RESOURCE_FILE))
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
settingsActivity.setToolbarTitle(getString(arguments.getInt(TOOLBAR_TITLE)))
|
||||
}
|
||||
|
||||
fun setArgs(resourcePreference: Int, resourceTitle: Int) {
|
||||
val args = Bundle()
|
||||
args.putInt(RESOURCE_FILE, resourcePreference)
|
||||
args.putInt(TOOLBAR_TITLE, resourceTitle)
|
||||
arguments = args
|
||||
}
|
||||
|
||||
val settingsActivity: SettingsActivity
|
||||
get() = activity as SettingsActivity
|
||||
|
||||
val preferences: PreferencesHelper
|
||||
get() = settingsActivity.preferences
|
||||
|
||||
val fragmentManagerCompat: FragmentManager
|
||||
get() = if (Build.VERSION.SDK_INT >= 17) childFragmentManager else fragmentManager
|
||||
}
|
@ -2,36 +2,45 @@ package eu.kanade.tachiyomi.ui.setting
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.support.v14.preference.MultiSelectListPreference
|
||||
import android.support.v7.preference.Preference
|
||||
import android.support.v7.preference.PreferenceGroup
|
||||
import android.support.v7.preference.XpPreferenceFragment
|
||||
import android.view.View
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.data.source.Source
|
||||
import eu.kanade.tachiyomi.data.source.SourceManager
|
||||
import eu.kanade.tachiyomi.data.source.getLanguages
|
||||
import eu.kanade.tachiyomi.data.source.online.LoginSource
|
||||
import eu.kanade.tachiyomi.util.plusAssign
|
||||
import eu.kanade.tachiyomi.widget.preference.LoginPreference
|
||||
import eu.kanade.tachiyomi.widget.preference.SourceLoginDialog
|
||||
import rx.Subscription
|
||||
import net.xpece.android.support.preference.MultiSelectListPreference
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class SettingsSourcesFragment : SettingsNestedFragment() {
|
||||
class SettingsSourcesFragment : SettingsFragment() {
|
||||
|
||||
companion object {
|
||||
const val SOURCE_CHANGE_REQUEST = 120
|
||||
|
||||
fun newInstance(resourcePreference: Int, resourceTitle: Int): SettingsNestedFragment {
|
||||
val fragment = SettingsSourcesFragment()
|
||||
fragment.setArgs(resourcePreference, resourceTitle)
|
||||
return fragment
|
||||
fun newInstance(rootKey: String?): SettingsSourcesFragment {
|
||||
val args = Bundle()
|
||||
args.putString(XpPreferenceFragment.ARG_PREFERENCE_ROOT, rootKey)
|
||||
return SettingsSourcesFragment().apply { arguments = args }
|
||||
}
|
||||
}
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
|
||||
private val sourceManager: SourceManager by injectLazy()
|
||||
|
||||
val languagesPref by lazy { findPreference("pref_source_languages") as MultiSelectListPreference }
|
||||
|
||||
val sourcesPref by lazy { findPreference("pref_sources") as PreferenceGroup }
|
||||
|
||||
var languagesSubscription: Subscription? = null
|
||||
|
||||
override fun onViewCreated(view: View, savedState: Bundle?) {
|
||||
super.onViewCreated(view, savedState)
|
||||
|
||||
val langs = getLanguages()
|
||||
|
||||
val entryKeys = langs.map { it.code }
|
||||
@ -39,11 +48,11 @@ class SettingsSourcesFragment : SettingsNestedFragment() {
|
||||
languagesPref.entryValues = entryKeys.toTypedArray()
|
||||
languagesPref.values = preferences.enabledLanguages().getOrDefault()
|
||||
|
||||
languagesSubscription = preferences.enabledLanguages().asObservable()
|
||||
subscriptions += preferences.enabledLanguages().asObservable()
|
||||
.subscribe { languages ->
|
||||
sourcesPref.removeAll()
|
||||
|
||||
val enabledSources = settingsActivity.sourceManager.getOnlineSources()
|
||||
val enabledSources = sourceManager.getOnlineSources()
|
||||
.filter { it.lang.code in languages }
|
||||
|
||||
for (source in enabledSources.filterIsInstance(LoginSource::class.java)) {
|
||||
@ -56,11 +65,6 @@ class SettingsSourcesFragment : SettingsNestedFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
languagesSubscription?.unsubscribe()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
fun createLoginSourceEntry(source: Source): Preference {
|
||||
return LoginPreference(preferenceManager.context).apply {
|
||||
key = preferences.keys.sourceUsername(source.id)
|
||||
@ -69,7 +73,7 @@ class SettingsSourcesFragment : SettingsNestedFragment() {
|
||||
setOnPreferenceClickListener {
|
||||
val fragment = SourceLoginDialog.newInstance(source)
|
||||
fragment.setTargetFragment(this@SettingsSourcesFragment, SOURCE_CHANGE_REQUEST)
|
||||
fragment.show(fragmentManagerCompat, null)
|
||||
fragment.show(childFragmentManager, null)
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -3,28 +3,38 @@ package eu.kanade.tachiyomi.ui.setting
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.support.v7.preference.PreferenceCategory
|
||||
import android.support.v7.preference.XpPreferenceFragment
|
||||
import android.view.View
|
||||
import eu.kanade.tachiyomi.data.mangasync.MangaSyncManager
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.widget.preference.LoginPreference
|
||||
import eu.kanade.tachiyomi.widget.preference.MangaSyncLoginDialog
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class SettingsSyncFragment : SettingsNestedFragment() {
|
||||
class SettingsSyncFragment : SettingsFragment() {
|
||||
|
||||
companion object {
|
||||
const val SYNC_CHANGE_REQUEST = 121
|
||||
|
||||
fun newInstance(resourcePreference: Int, resourceTitle: Int): SettingsNestedFragment {
|
||||
val fragment = SettingsSyncFragment()
|
||||
fragment.setArgs(resourcePreference, resourceTitle)
|
||||
return fragment
|
||||
fun newInstance(rootKey: String): SettingsSyncFragment {
|
||||
val args = Bundle()
|
||||
args.putString(XpPreferenceFragment.ARG_PREFERENCE_ROOT, rootKey)
|
||||
return SettingsSyncFragment().apply { arguments = args }
|
||||
}
|
||||
}
|
||||
|
||||
private val syncManager: MangaSyncManager by injectLazy()
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
|
||||
val syncCategory by lazy { findPreference("pref_category_manga_sync_accounts") as PreferenceCategory }
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
override fun onViewCreated(view: View, savedState: Bundle?) {
|
||||
super.onViewCreated(view, savedState)
|
||||
|
||||
val themedContext = preferenceManager.context
|
||||
|
||||
for (sync in settingsActivity.syncManager.services) {
|
||||
for (sync in syncManager.services) {
|
||||
val pref = LoginPreference(themedContext).apply {
|
||||
key = preferences.keys.syncUsername(sync.id)
|
||||
title = sync.name
|
||||
@ -32,7 +42,7 @@ class SettingsSyncFragment : SettingsNestedFragment() {
|
||||
setOnPreferenceClickListener {
|
||||
val fragment = MangaSyncLoginDialog.newInstance(sync)
|
||||
fragment.setTargetFragment(this@SettingsSyncFragment, SYNC_CHANGE_REQUEST)
|
||||
fragment.show(fragmentManagerCompat, null)
|
||||
fragment.show(childFragmentManager, null)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
@ -16,7 +15,7 @@ public final class DiskUtils {
|
||||
String cacheKey;
|
||||
try {
|
||||
final MessageDigest mDigest = MessageDigest.getInstance("MD5");
|
||||
mDigest.update(key.getBytes(StandardCharsets.UTF_8));
|
||||
mDigest.update(key.getBytes());
|
||||
cacheKey = bytesToHexString(mDigest.digest());
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
cacheKey = String.valueOf(key.hashCode());
|
||||
|
@ -1,15 +1,15 @@
|
||||
package eu.kanade.tachiyomi.widget.preference
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.v14.preference.PreferenceDialogFragment
|
||||
import android.support.v7.preference.Preference
|
||||
import android.support.v7.preference.PreferenceDialogFragmentCompat
|
||||
import android.view.View
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsActivity
|
||||
import kotlinx.android.synthetic.main.pref_library_columns.view.*
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class LibraryColumnsDialog : PreferenceDialogFragment() {
|
||||
class LibraryColumnsDialog : PreferenceDialogFragmentCompat() {
|
||||
|
||||
companion object {
|
||||
|
||||
@ -25,8 +25,7 @@ class LibraryColumnsDialog : PreferenceDialogFragment() {
|
||||
var portrait: Int = 0
|
||||
var landscape: Int = 0
|
||||
|
||||
val preferences: PreferencesHelper
|
||||
get() = (activity as SettingsActivity).preferences
|
||||
val preferences: PreferencesHelper by injectLazy()
|
||||
|
||||
override fun onBindDialogView(view: View) {
|
||||
super.onBindDialogView(view)
|
||||
|
@ -1,28 +1,27 @@
|
||||
package eu.kanade.tachiyomi.widget.preference
|
||||
|
||||
import android.app.Dialog
|
||||
import android.app.DialogFragment
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.support.v4.app.DialogFragment
|
||||
import android.text.method.PasswordTransformationMethod
|
||||
import android.view.View
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.dd.processbutton.iml.ActionProcessButton
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsActivity
|
||||
import eu.kanade.tachiyomi.widget.SimpleTextWatcher
|
||||
import kotlinx.android.synthetic.main.pref_account_login.view.*
|
||||
import rx.Subscription
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
abstract class LoginDialogPreference : DialogFragment() {
|
||||
|
||||
var v: View? = null
|
||||
private set
|
||||
|
||||
val preferences: PreferencesHelper
|
||||
get() = (activity as SettingsActivity).preferences
|
||||
val preferences: PreferencesHelper by injectLazy()
|
||||
|
||||
var requestSubscription: Subscription? = null
|
||||
|
||||
|
@ -3,12 +3,13 @@ package eu.kanade.tachiyomi.widget.preference
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.mangasync.MangaSyncManager
|
||||
import eu.kanade.tachiyomi.data.mangasync.MangaSyncService
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsActivity
|
||||
import eu.kanade.tachiyomi.util.toast
|
||||
import kotlinx.android.synthetic.main.pref_account_login.view.*
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.schedulers.Schedulers
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class MangaSyncLoginDialog : LoginDialogPreference() {
|
||||
|
||||
@ -23,13 +24,15 @@ class MangaSyncLoginDialog : LoginDialogPreference() {
|
||||
}
|
||||
}
|
||||
|
||||
val syncManager: MangaSyncManager by injectLazy()
|
||||
|
||||
lateinit var sync: MangaSyncService
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val syncId = arguments.getInt("key")
|
||||
sync = (activity as SettingsActivity).syncManager.getService(syncId)!!
|
||||
sync = syncManager.getService(syncId)!!
|
||||
}
|
||||
|
||||
override fun setCredentialsOnView(view: View) = with(view) {
|
||||
|
@ -4,12 +4,13 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.source.Source
|
||||
import eu.kanade.tachiyomi.data.source.SourceManager
|
||||
import eu.kanade.tachiyomi.data.source.online.LoginSource
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsActivity
|
||||
import eu.kanade.tachiyomi.util.toast
|
||||
import kotlinx.android.synthetic.main.pref_account_login.view.*
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.schedulers.Schedulers
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class SourceLoginDialog : LoginDialogPreference() {
|
||||
|
||||
@ -24,13 +25,15 @@ class SourceLoginDialog : LoginDialogPreference() {
|
||||
}
|
||||
}
|
||||
|
||||
val sourceManager: SourceManager by injectLazy()
|
||||
|
||||
lateinit var source: LoginSource
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val sourceId = arguments.getInt("key")
|
||||
source = (activity as SettingsActivity).sourceManager.get(sourceId) as LoginSource
|
||||
source = sourceManager.get(sourceId) as LoginSource
|
||||
}
|
||||
|
||||
override fun setCredentialsOnView(view: View) = with(view) {
|
||||
|
@ -8,7 +8,6 @@
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
|
||||
<item name="android:alertDialogTheme">@style/Theme.AlertDialog.Light</item>
|
||||
</style>
|
||||
|
||||
<!--============-->
|
||||
@ -19,6 +18,5 @@
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
|
||||
<item name="android:alertDialogTheme">@style/Theme.AlertDialog.Dark</item>
|
||||
</style>
|
||||
</resources>
|
@ -26,7 +26,9 @@
|
||||
<!-- Themes -->
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
<item name="actionBarTheme">@style/Theme.ActionBar.Light</item>
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.Material</item>
|
||||
<item name="alertDialogTheme">@style/Theme.AlertDialog.Light</item>
|
||||
|
||||
|
||||
<!-- Custom Attributes-->
|
||||
<item name="selectable_list_drawable">@drawable/list_item_selector_light</item>
|
||||
@ -61,7 +63,9 @@
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
|
||||
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat</item>
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.Material</item>
|
||||
<item name="alertDialogTheme">@style/Theme.AlertDialog.Dark</item>
|
||||
|
||||
|
||||
<!-- Custom Attributes-->
|
||||
<item name="navigation_view_theme">@style/Theme.Widget.NavigationView.Dark</item>
|
||||
|
@ -1,28 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.preference.PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="acra.enable"
|
||||
android:summary="@string/pref_acra_summary"
|
||||
android:title="@string/pref_enable_acra"/>
|
||||
<PreferenceScreen
|
||||
android:key="about_screen"
|
||||
android:title="@string/pref_category_about"
|
||||
android:persistent="false">
|
||||
|
||||
<!--<SwitchPreferenceCompat-->
|
||||
<!--android:defaultValue="false"-->
|
||||
<!--android:enabled="false"-->
|
||||
<!--android:key="@string/pref_enable_automatic_updates_key"-->
|
||||
<!--android:summary="@string/pref_enable_automatic_updates_summary"-->
|
||||
<!--android:title="@string/pref_enable_automatic_updates"/>-->
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="acra.enable"
|
||||
android:summary="@string/pref_acra_summary"
|
||||
android:title="@string/pref_enable_acra"/>
|
||||
|
||||
<Preference
|
||||
android:key="@string/pref_version"
|
||||
android:persistent="false"
|
||||
android:title="@string/version"/>
|
||||
<!--<SwitchPreferenceCompat-->
|
||||
<!--android:defaultValue="false"-->
|
||||
<!--android:enabled="false"-->
|
||||
<!--android:key="@string/pref_enable_automatic_updates_key"-->
|
||||
<!--android:summary="@string/pref_enable_automatic_updates_summary"-->
|
||||
<!--android:title="@string/pref_enable_automatic_updates"/>-->
|
||||
|
||||
<Preference
|
||||
android:key="@string/pref_build_time"
|
||||
android:persistent="false"
|
||||
android:title="@string/build_time"/>
|
||||
<Preference
|
||||
android:key="@string/pref_version"
|
||||
android:persistent="false"
|
||||
android:title="@string/version"/>
|
||||
|
||||
</android.support.v7.preference.PreferenceScreen>
|
||||
<Preference
|
||||
android:key="@string/pref_build_time"
|
||||
android:persistent="false"
|
||||
android:title="@string/build_time"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
</PreferenceScreen>
|
@ -1,24 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.preference.PreferenceScreen
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<Preference
|
||||
android:key="@string/pref_clear_chapter_cache_key"
|
||||
android:title="@string/pref_clear_chapter_cache"/>
|
||||
<PreferenceScreen
|
||||
android:key="advanced_screen"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_category_advanced">
|
||||
|
||||
<Preference
|
||||
android:key="@string/pref_clear_cookies_key"
|
||||
android:title="@string/pref_clear_cookies"/>
|
||||
<Preference
|
||||
android:key="@string/pref_clear_chapter_cache_key"
|
||||
android:title="@string/pref_clear_chapter_cache"/>
|
||||
|
||||
<Preference
|
||||
android:key="@string/pref_clear_database_key"
|
||||
android:summary="@string/pref_clear_database_summary"
|
||||
android:title="@string/pref_clear_database"/>
|
||||
<Preference
|
||||
android:key="@string/pref_clear_cookies_key"
|
||||
android:title="@string/pref_clear_cookies"/>
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_reencode_key"
|
||||
android:summary="@string/pref_reencode_summary"
|
||||
android:title="@string/pref_reencode"/>
|
||||
<Preference
|
||||
android:key="@string/pref_clear_database_key"
|
||||
android:summary="@string/pref_clear_database_summary"
|
||||
android:title="@string/pref_clear_database"/>
|
||||
|
||||
</android.support.v7.preference.PreferenceScreen>
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_reencode_key"
|
||||
android:summary="@string/pref_reencode_summary"
|
||||
android:title="@string/pref_reencode"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
</PreferenceScreen>
|
@ -1,43 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.preference.PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<Preference
|
||||
android:key="@string/pref_download_directory_key"
|
||||
android:title="@string/pref_download_directory"/>
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="@string/pref_download_only_over_wifi_key"
|
||||
android:title="@string/pref_download_only_over_wifi"/>
|
||||
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:defaultValue="1"
|
||||
android:entries="@array/download_slots"
|
||||
android:entryValues="@array/download_slots"
|
||||
android:key="@string/pref_download_slots_key"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_download_slots"/>
|
||||
|
||||
<PreferenceCategory
|
||||
<PreferenceScreen
|
||||
android:key="downloads_screen"
|
||||
android:persistent="false"
|
||||
android:title="@string/cat_remove_after_read"/>
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_remove_after_marked_as_read_key"
|
||||
android:title="@string/pref_remove_after_marked_as_read"/>
|
||||
android:title="@string/pref_category_downloads">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_remove_after_read_key"
|
||||
android:summary="@string/current_chapter"
|
||||
android:title="@string/pref_remove_after_read"/>
|
||||
<Preference
|
||||
android:key="@string/pref_download_directory_key"
|
||||
android:title="@string/pref_download_directory"/>
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:dependency="@string/pref_remove_after_read_key"
|
||||
android:key="@string/pref_remove_after_read_previous_key"
|
||||
android:summary="@string/previous_chapter"
|
||||
android:title="@string/pref_remove_after_read"/>
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/pref_download_only_over_wifi_key"
|
||||
android:title="@string/pref_download_only_over_wifi"/>
|
||||
|
||||
</android.support.v7.preference.PreferenceScreen>
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:defaultValue="1"
|
||||
android:entries="@array/download_slots"
|
||||
android:entryValues="@array/download_slots"
|
||||
android:key="@string/pref_download_slots_key"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_download_slots"/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:persistent="false"
|
||||
android:title="@string/cat_remove_after_read"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_remove_after_marked_as_read_key"
|
||||
android:title="@string/pref_remove_after_marked_as_read"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_remove_after_read_key"
|
||||
android:summary="@string/current_chapter"
|
||||
android:title="@string/pref_remove_after_read"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:dependency="@string/pref_remove_after_read_key"
|
||||
android:key="@string/pref_remove_after_read_previous_key"
|
||||
android:summary="@string/previous_chapter"
|
||||
android:title="@string/pref_remove_after_read"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
</PreferenceScreen>
|
@ -1,39 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.preference.PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:defaultValue="1"
|
||||
android:entries="@array/themes"
|
||||
android:entryValues="@array/themes_values"
|
||||
android:key="@string/pref_theme_key"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_theme"/>
|
||||
|
||||
<eu.kanade.tachiyomi.widget.preference.SimpleDialogPreference
|
||||
android:dialogLayout="@layout/pref_library_columns"
|
||||
android:key="@string/pref_library_columns_dialog_key"
|
||||
<PreferenceScreen
|
||||
android:key="general_screen"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_library_columns"/>
|
||||
android:title="@string/pref_category_general">
|
||||
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/library_update_interval"
|
||||
android:entryValues="@array/library_update_interval_values"
|
||||
android:key="@string/pref_library_update_interval_key"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_library_update_interval"/>
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:defaultValue="1"
|
||||
android:entries="@array/themes"
|
||||
android:entryValues="@array/themes_values"
|
||||
android:key="@string/pref_theme_key"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_theme"/>
|
||||
|
||||
<MultiSelectListPreference
|
||||
android:entries="@array/library_update_restrictions"
|
||||
android:entryValues="@array/library_update_restrictions_values"
|
||||
android:key="@string/pref_library_update_restriction_key"
|
||||
android:summary="@string/pref_library_update_restriction_summary"
|
||||
android:title="@string/pref_library_update_restriction" />
|
||||
<eu.kanade.tachiyomi.widget.preference.SimpleDialogPreference
|
||||
android:dialogLayout="@layout/pref_library_columns"
|
||||
android:key="@string/pref_library_columns_dialog_key"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_library_columns"/>
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_update_only_non_completed_key"
|
||||
android:title="@string/pref_update_only_non_completed"/>
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/library_update_interval"
|
||||
android:entryValues="@array/library_update_interval_values"
|
||||
android:key="@string/pref_library_update_interval_key"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_library_update_interval"/>
|
||||
|
||||
</android.support.v7.preference.PreferenceScreen>
|
||||
<MultiSelectListPreference
|
||||
android:entries="@array/library_update_restrictions"
|
||||
android:entryValues="@array/library_update_restrictions_values"
|
||||
android:key="@string/pref_library_update_restriction_key"
|
||||
android:summary="@string/pref_library_update_restriction_summary"
|
||||
android:title="@string/pref_library_update_restriction" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_update_only_non_completed_key"
|
||||
android:title="@string/pref_update_only_non_completed"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
</PreferenceScreen>
|
@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.preference.PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<Preference
|
||||
android:key="@string/pref_category_general_key"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_category_general" />
|
||||
|
||||
<Preference
|
||||
android:key="@string/pref_category_reader_key"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_category_reader" />
|
||||
|
||||
<Preference
|
||||
android:key="@string/pref_category_downloads_key"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_category_downloads" />
|
||||
|
||||
<Preference
|
||||
android:key="@string/pref_category_sources_key"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_category_sources" />
|
||||
|
||||
<Preference
|
||||
android:key="@string/pref_category_sync_key"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_category_sync" />
|
||||
|
||||
<Preference
|
||||
android:key="@string/pref_category_advanced_key"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_category_advanced" />
|
||||
|
||||
<Preference
|
||||
android:key="@string/pref_category_about_key"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_category_about" />
|
||||
|
||||
</android.support.v7.preference.PreferenceScreen>
|
@ -1,93 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.preference.PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:title="@string/pref_viewer_type"
|
||||
android:key="@string/pref_default_viewer_key"
|
||||
android:entries="@array/viewers"
|
||||
android:entryValues="@array/viewers_values"
|
||||
android:defaultValue="1"
|
||||
android:summary="%s"/>
|
||||
<PreferenceScreen
|
||||
android:key="reader_screen"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_category_reader">
|
||||
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:title="@string/pref_image_scale_type"
|
||||
android:key="@string/pref_image_scale_type_key"
|
||||
android:entries="@array/image_scale_type"
|
||||
android:entryValues="@array/image_scale_type_values"
|
||||
android:defaultValue="1"
|
||||
android:summary="%s"/>
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:title="@string/pref_viewer_type"
|
||||
android:key="@string/pref_default_viewer_key"
|
||||
android:entries="@array/viewers"
|
||||
android:entryValues="@array/viewers_values"
|
||||
android:defaultValue="1"
|
||||
android:summary="%s"/>
|
||||
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:title="@string/pref_zoom_start"
|
||||
android:key="@string/pref_zoom_start_key"
|
||||
android:entries="@array/zoom_start"
|
||||
android:entryValues="@array/zoom_start_values"
|
||||
android:defaultValue="1"
|
||||
android:summary="%s"/>
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:title="@string/pref_image_scale_type"
|
||||
android:key="@string/pref_image_scale_type_key"
|
||||
android:entries="@array/image_scale_type"
|
||||
android:entryValues="@array/image_scale_type_values"
|
||||
android:defaultValue="1"
|
||||
android:summary="%s"/>
|
||||
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:title="@string/pref_rotation_type"
|
||||
android:key="@string/pref_rotation_type_key"
|
||||
android:entries="@array/rotation_type"
|
||||
android:entryValues="@array/rotation_type_values"
|
||||
android:defaultValue="1"
|
||||
android:summary="%s"/>
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:title="@string/pref_zoom_start"
|
||||
android:key="@string/pref_zoom_start_key"
|
||||
android:entries="@array/zoom_start"
|
||||
android:entryValues="@array/zoom_start_values"
|
||||
android:defaultValue="1"
|
||||
android:summary="%s"/>
|
||||
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:title="@string/pref_reader_theme"
|
||||
android:key="@string/pref_reader_theme_key"
|
||||
android:entries="@array/reader_themes"
|
||||
android:entryValues="@array/reader_themes_values"
|
||||
android:defaultValue="0"
|
||||
android:summary="%s"/>
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:title="@string/pref_rotation_type"
|
||||
android:key="@string/pref_rotation_type_key"
|
||||
android:entries="@array/rotation_type"
|
||||
android:entryValues="@array/rotation_type_values"
|
||||
android:defaultValue="1"
|
||||
android:summary="%s"/>
|
||||
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:title="@string/pref_image_decoder"
|
||||
android:key="@string/pref_image_decoder_key"
|
||||
android:entries="@array/image_decoders"
|
||||
android:entryValues="@array/image_decoders_values"
|
||||
android:defaultValue="0"
|
||||
android:summary="%s" />
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:title="@string/pref_reader_theme"
|
||||
android:key="@string/pref_reader_theme_key"
|
||||
android:entries="@array/reader_themes"
|
||||
android:entryValues="@array/reader_themes_values"
|
||||
android:defaultValue="0"
|
||||
android:summary="%s"/>
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:title="@string/pref_hide_status_bar"
|
||||
android:key="@string/pref_hide_status_bar_key"
|
||||
android:defaultValue="true" />
|
||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||
android:title="@string/pref_image_decoder"
|
||||
android:key="@string/pref_image_decoder_key"
|
||||
android:entries="@array/image_decoders"
|
||||
android:entryValues="@array/image_decoders_values"
|
||||
android:defaultValue="0"
|
||||
android:summary="%s" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:title="@string/pref_enable_transitions"
|
||||
android:key="@string/pref_enable_transitions_key"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:title="@string/pref_show_page_number"
|
||||
android:key="@string/pref_show_page_number_key"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:title="@string/pref_custom_brightness"
|
||||
android:key="@string/pref_custom_brightness_key"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:title="@string/pref_keep_screen_on"
|
||||
android:key="@string/pref_keep_screen_on_key"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/pref_reader_navigation">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:title="@string/pref_read_with_tapping"
|
||||
android:key="@string/pref_read_with_tapping_key"
|
||||
<SwitchPreference
|
||||
android:title="@string/pref_hide_status_bar"
|
||||
android:key="@string/pref_hide_status_bar_key"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:title="@string/pref_read_with_volume_keys"
|
||||
android:key="@string/pref_read_with_volume_keys_key"
|
||||
<SwitchPreference
|
||||
android:title="@string/pref_enable_transitions"
|
||||
android:key="@string/pref_enable_transitions_key"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<SwitchPreference
|
||||
android:title="@string/pref_show_page_number"
|
||||
android:key="@string/pref_show_page_number_key"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<SwitchPreference
|
||||
android:title="@string/pref_custom_brightness"
|
||||
android:key="@string/pref_custom_brightness_key"
|
||||
android:defaultValue="false" />
|
||||
|
||||
</PreferenceCategory>
|
||||
<SwitchPreference
|
||||
android:title="@string/pref_keep_screen_on"
|
||||
android:key="@string/pref_keep_screen_on_key"
|
||||
android:defaultValue="true" />
|
||||
|
||||
</android.support.v7.preference.PreferenceScreen>
|
||||
<PreferenceCategory
|
||||
android:title="@string/pref_reader_navigation">
|
||||
|
||||
<SwitchPreference
|
||||
android:title="@string/pref_read_with_tapping"
|
||||
android:key="@string/pref_read_with_tapping_key"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<SwitchPreference
|
||||
android:title="@string/pref_read_with_volume_keys"
|
||||
android:key="@string/pref_read_with_volume_keys_key"
|
||||
android:defaultValue="false" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
</PreferenceScreen>
|
@ -1,16 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.preference.PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orderingFromXml="true">
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<MultiSelectListPreference
|
||||
android:key="@string/pref_source_languages"
|
||||
android:title="@string/languages"
|
||||
android:summary="@string/languages_summary"/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="pref_sources"
|
||||
<PreferenceScreen
|
||||
android:key="sources_screen"
|
||||
android:persistent="false"
|
||||
android:title="@string/accounts"/>
|
||||
android:title="@string/pref_category_sources">
|
||||
|
||||
</android.support.v7.preference.PreferenceScreen>
|
||||
<MultiSelectListPreference
|
||||
android:key="@string/pref_source_languages"
|
||||
android:title="@string/languages"
|
||||
android:summary="@string/languages_summary"/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="pref_sources"
|
||||
android:persistent="false"
|
||||
android:title="@string/accounts"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
</PreferenceScreen>
|
@ -1,22 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.preference.PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orderingFromXml="true">
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:key="@string/pref_auto_update_manga_sync_key"
|
||||
android:title="@string/pref_auto_update_manga_sync"
|
||||
android:defaultValue="true"/>
|
||||
<PreferenceScreen
|
||||
android:key="sync_screen"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_category_sync">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:key="@string/pref_ask_update_manga_sync_key"
|
||||
android:title="@string/pref_ask_update_manga_sync"
|
||||
android:defaultValue="false"
|
||||
android:dependency="@string/pref_auto_update_manga_sync_key"/>
|
||||
<SwitchPreference
|
||||
android:key="@string/pref_auto_update_manga_sync_key"
|
||||
android:title="@string/pref_auto_update_manga_sync"
|
||||
android:defaultValue="true"/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="pref_category_manga_sync_accounts"
|
||||
android:title="@string/services"
|
||||
android:persistent="false"/>
|
||||
<SwitchPreference
|
||||
android:key="@string/pref_ask_update_manga_sync_key"
|
||||
android:title="@string/pref_ask_update_manga_sync"
|
||||
android:defaultValue="false"
|
||||
android:dependency="@string/pref_auto_update_manga_sync_key"/>
|
||||
|
||||
</android.support.v7.preference.PreferenceScreen>
|
||||
<PreferenceCategory
|
||||
android:key="pref_category_manga_sync_accounts"
|
||||
android:title="@string/services"
|
||||
android:persistent="false"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user