Add more info in tracking settings section

This commit is contained in:
arkon 2020-05-09 12:41:10 -04:00
parent 29feee0095
commit 436253dd63
3 changed files with 21 additions and 1 deletions

View file

@ -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.bangumi.BangumiApi
import eu.kanade.tachiyomi.data.track.shikimori.ShikimoriApi import eu.kanade.tachiyomi.data.track.shikimori.ShikimoriApi
import eu.kanade.tachiyomi.util.preference.defaultValue 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.initThenAdd
import eu.kanade.tachiyomi.util.preference.onClick import eu.kanade.tachiyomi.util.preference.onClick
import eu.kanade.tachiyomi.util.preference.preferenceCategory import eu.kanade.tachiyomi.util.preference.preferenceCategory
@ -73,6 +74,9 @@ class SettingsTrackingController :
tabsIntent.launchUrl(activity!!, BangumiApi.authUrl()) tabsIntent.launchUrl(activity!!, BangumiApi.authUrl())
} }
} }
preferenceCategory {
infoPreference(R.string.tracking_info)
}
} }
private inline fun PreferenceScreen.trackPreference( private inline fun PreferenceScreen.trackPreference(

View file

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.util.preference package eu.kanade.tachiyomi.util.preference
import androidx.annotation.StringRes
import androidx.core.graphics.drawable.DrawableCompat import androidx.core.graphics.drawable.DrawableCompat
import androidx.preference.CheckBoxPreference import androidx.preference.CheckBoxPreference
import androidx.preference.DialogPreference import androidx.preference.DialogPreference
@ -13,6 +14,8 @@ import androidx.preference.PreferenceManager
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import androidx.preference.SwitchPreferenceCompat import androidx.preference.SwitchPreferenceCompat
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat 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.IntListPreference
import eu.kanade.tachiyomi.widget.preference.SwitchPreferenceCategory 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) 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 { inline fun PreferenceGroup.switchPreference(block: (@DSL SwitchPreferenceCompat).() -> Unit): SwitchPreferenceCompat {
return initThenAdd(SwitchPreferenceCompat(context), block) return initThenAdd(SwitchPreferenceCompat(context), block)
} }

View file

@ -306,8 +306,9 @@
<string name="pref_download_new_categories">Categories to include in download</string> <string name="pref_download_new_categories">Categories to include in download</string>
<!-- Tracking section --> <!-- Tracking section -->
<string name="pref_auto_update_manga_sync">Sync chapters after reading</string> <string name="pref_auto_update_manga_sync">Update chapter progress after reading</string>
<string name="services">Services</string> <string name="services">Services</string>
<string name="tracking_info">One-way sync to update chapter tracking services. Set up tracking for individual manga entries from their tracking tabs.</string>
<!-- Browse section --> <!-- Browse section -->
<string name="pref_enable_automatic_extension_updates">Check for extension updates</string> <string name="pref_enable_automatic_extension_updates">Check for extension updates</string>