From 436253dd63e07ffa5bbf5be98f5f844b2ca6fca5 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 9 May 2020 12:41:10 -0400 Subject: [PATCH] Add more info in tracking settings section --- .../ui/setting/SettingsTrackingController.kt | 4 ++++ .../tachiyomi/util/preference/PreferenceDSL.kt | 15 +++++++++++++++ app/src/main/res/values/strings.xml | 3 ++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt index 1c3ec5f0f..81ab883bc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt @@ -12,6 +12,7 @@ import eu.kanade.tachiyomi.data.track.anilist.AnilistApi import eu.kanade.tachiyomi.data.track.bangumi.BangumiApi import eu.kanade.tachiyomi.data.track.shikimori.ShikimoriApi import eu.kanade.tachiyomi.util.preference.defaultValue +import eu.kanade.tachiyomi.util.preference.infoPreference import eu.kanade.tachiyomi.util.preference.initThenAdd import eu.kanade.tachiyomi.util.preference.onClick import eu.kanade.tachiyomi.util.preference.preferenceCategory @@ -73,6 +74,9 @@ class SettingsTrackingController : tabsIntent.launchUrl(activity!!, BangumiApi.authUrl()) } } + preferenceCategory { + infoPreference(R.string.tracking_info) + } } private inline fun PreferenceScreen.trackPreference( diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/preference/PreferenceDSL.kt b/app/src/main/java/eu/kanade/tachiyomi/util/preference/PreferenceDSL.kt index db7b40e4d..c690dafa1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/preference/PreferenceDSL.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/preference/PreferenceDSL.kt @@ -1,5 +1,6 @@ package eu.kanade.tachiyomi.util.preference +import androidx.annotation.StringRes import androidx.core.graphics.drawable.DrawableCompat import androidx.preference.CheckBoxPreference import androidx.preference.DialogPreference @@ -13,6 +14,8 @@ import androidx.preference.PreferenceManager import androidx.preference.PreferenceScreen import androidx.preference.SwitchPreferenceCompat import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat +import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.widget.preference.IntListPreference import eu.kanade.tachiyomi.widget.preference.SwitchPreferenceCategory @@ -28,6 +31,18 @@ inline fun PreferenceGroup.preference(block: (@DSL Preference).() -> Unit): Pref return initThenAdd(Preference(context), block) } +inline fun PreferenceGroup.infoPreference(@StringRes infoRes: Int): Preference { + return initThenAdd( + Preference(context), + { + iconRes = R.drawable.ic_info_24dp + iconTint = context.getResourceColor(android.R.attr.textColorHint) + summaryRes = infoRes + isSelectable = false + } + ) +} + inline fun PreferenceGroup.switchPreference(block: (@DSL SwitchPreferenceCompat).() -> Unit): SwitchPreferenceCompat { return initThenAdd(SwitchPreferenceCompat(context), block) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e3ff0c816..b1c99981c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -306,8 +306,9 @@ Categories to include in download - Sync chapters after reading + Update chapter progress after reading Services + One-way sync to update chapter tracking services. Set up tracking for individual manga entries from their tracking tabs. Check for extension updates