From 44241e03daaa53f0fd31a4f0e1243aea0f583e97 Mon Sep 17 00:00:00 2001 From: len Date: Sun, 27 Nov 2016 22:02:23 +0100 Subject: [PATCH] Update preferences lib --- app/build.gradle | 2 +- .../tachiyomi/ui/setting/SettingsFragment.kt | 30 ------------------- .../asp_preference_widget_switch.xml | 29 ------------------ app/src/main/res/xml/pref_about.xml | 8 +++-- app/src/main/res/xml/pref_advanced.xml | 8 +++-- app/src/main/res/xml/pref_downloads.xml | 8 +++-- app/src/main/res/xml/pref_general.xml | 8 +++-- app/src/main/res/xml/pref_reader.xml | 8 +++-- app/src/main/res/xml/pref_sources.xml | 8 +++-- app/src/main/res/xml/pref_sync.xml | 8 +++-- 10 files changed, 43 insertions(+), 74 deletions(-) delete mode 100644 app/src/main/res/layout-v21/asp_preference_widget_switch.xml diff --git a/app/build.gradle b/app/build.gradle index e545e845ac..a663a4bced 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -185,7 +185,7 @@ dependencies { compile 'com.nononsenseapps:filepicker:2.5.2' compile 'com.github.amulyakhare:TextDrawable:558677e' compile 'com.afollestad.material-dialogs:core:0.9.1.0' - compile 'net.xpece.android:support-preference:1.0.3' + compile 'net.xpece.android:support-preference:1.2.0' compile 'me.zhanghai.android.systemuihelper:library:1.0.0' compile 'de.hdodenhof:circleimageview:2.1.0' diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsFragment.kt index 6431ad249b..1439da6e81 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsFragment.kt @@ -2,14 +2,10 @@ package eu.kanade.tachiyomi.ui.setting import android.os.Bundle import android.support.annotation.CallSuper -import android.support.graphics.drawable.VectorDrawableCompat -import android.support.v4.content.ContextCompat import android.support.v7.preference.Preference import android.support.v7.preference.XpPreferenceFragment import android.view.View import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.util.getResourceId -import net.xpece.android.support.preference.PreferenceIconHelper import net.xpece.android.support.preference.PreferenceScreenNavigationStrategy import rx.subscriptions.CompositeSubscription @@ -25,10 +21,6 @@ open class SettingsFragment : XpPreferenceFragment() { lateinit var subscriptions: CompositeSubscription - private val iconTint by lazy { ContextCompat.getColorStateList(context, - context.theme.getResourceId(R.attr.colorAccent, 0)) - } - override final fun onCreatePreferences2(savedState: Bundle?, rootKey: String?) { subscriptions = CompositeSubscription() @@ -40,18 +32,6 @@ open class SettingsFragment : XpPreferenceFragment() { addPreferencesFromResource(R.xml.pref_advanced) addPreferencesFromResource(R.xml.pref_about) - // Add an icon to each subscreen - for ((screen, drawable) in getSubscreenIcons()) { - val icon = VectorDrawableCompat.create(resources, drawable, context.theme) ?: continue - - PreferenceIconHelper(findPreference(screen)).apply { - isIconPaddingEnabled = true - setIcon(icon) - tintList = iconTint - isIconTintEnabled = true - } - } - // Setup root preference title. preferenceScreen.title = activity.title @@ -74,16 +54,6 @@ open class SettingsFragment : XpPreferenceFragment() { super.onDestroyView() } - private fun getSubscreenIcons() = listOf( - "general_screen" to R.drawable.ic_tune_black_24dp, - "reader_screen" to R.drawable.ic_chrome_reader_mode_black_24dp, - "downloads_screen" to R.drawable.ic_file_download_black_24dp, - "sources_screen" to R.drawable.ic_language_black_24dp, - "sync_screen" to R.drawable.ic_sync_black_24dp, - "advanced_screen" to R.drawable.ic_code_black_24dp, - "about_screen" to R.drawable.ic_help_black_24dp - ) - protected inline fun bindPref(resId: Int): Lazy { return lazy { findPreference(getString(resId)) as T } } diff --git a/app/src/main/res/layout-v21/asp_preference_widget_switch.xml b/app/src/main/res/layout-v21/asp_preference_widget_switch.xml deleted file mode 100644 index 2fcedadf4b..0000000000 --- a/app/src/main/res/layout-v21/asp_preference_widget_switch.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - diff --git a/app/src/main/res/xml/pref_about.xml b/app/src/main/res/xml/pref_about.xml index 9294da4540..cca8173b41 100644 --- a/app/src/main/res/xml/pref_about.xml +++ b/app/src/main/res/xml/pref_about.xml @@ -1,10 +1,14 @@ - + + app:asp_tintEnabled="true"> - + + android:title="@string/pref_category_advanced" + app:asp_tintEnabled="true"> - + + android:title="@string/pref_category_downloads" + app:asp_tintEnabled="true"> - + + android:title="@string/pref_category_general" + app:asp_tintEnabled="true"> - + + android:title="@string/pref_category_reader" + app:asp_tintEnabled="true"> - + + android:title="@string/pref_category_sources" + app:asp_tintEnabled="true"> diff --git a/app/src/main/res/xml/pref_sync.xml b/app/src/main/res/xml/pref_sync.xml index 885f34eb4b..82caccdff3 100644 --- a/app/src/main/res/xml/pref_sync.xml +++ b/app/src/main/res/xml/pref_sync.xml @@ -1,10 +1,14 @@ - + + android:title="@string/pref_category_sync" + app:asp_tintEnabled="true">