Info about background restrictions
This commit is contained in:
@@ -166,6 +166,7 @@ class AppSettings private constructor(private val prefs: SharedPreferences) :
|
||||
const val KEY_LOCAL_STORAGE = "local_storage"
|
||||
const val KEY_READER_SWITCHERS = "reader_switchers"
|
||||
const val KEY_TRACK_SOURCES = "track_sources"
|
||||
const val KEY_TRACK_WARNING = "track_warning"
|
||||
const val KEY_APP_UPDATE = "app_update"
|
||||
const val KEY_APP_UPDATE_AUTO = "app_update_auto"
|
||||
const val KEY_TRACKER_NOTIFICATIONS = "tracker_notifications"
|
||||
|
||||
@@ -4,6 +4,9 @@ import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.text.style.URLSpan
|
||||
import androidx.core.text.buildSpannedString
|
||||
import androidx.core.text.inSpans
|
||||
import androidx.preference.MultiSelectListPreference
|
||||
import androidx.preference.Preference
|
||||
import org.koitharu.kotatsu.R
|
||||
@@ -19,6 +22,17 @@ class TrackerSettingsFragment : BasePreferenceFragment(R.string.new_chapters_che
|
||||
|
||||
findPreference<MultiSelectListPreference>(AppSettings.KEY_TRACK_SOURCES)
|
||||
?.summaryProvider = MultiSummaryProvider(R.string.dont_check)
|
||||
val warningPreference = findPreference<Preference>(AppSettings.KEY_TRACK_WARNING)
|
||||
if (warningPreference != null) {
|
||||
warningPreference.summary = buildSpannedString {
|
||||
append(getString(R.string.tracker_warning))
|
||||
append(" ")
|
||||
inSpans(URLSpan("https://dontkillmyapp.com/")) {
|
||||
append(getString(R.string.read_more))
|
||||
}
|
||||
}
|
||||
warningPreference
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPreferenceTreeClick(preference: Preference?): Boolean {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.koitharu.kotatsu.settings.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.util.AttributeSet
|
||||
import android.widget.TextView
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceViewHolder
|
||||
|
||||
class LinksPreference @JvmOverloads constructor(
|
||||
context: Context?,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = androidx.preference.R.attr.preferenceStyle,
|
||||
defStyleRes: Int = 0,
|
||||
) : Preference(context, attrs, defStyleAttr, defStyleRes) {
|
||||
|
||||
|
||||
override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
||||
super.onBindViewHolder(holder)
|
||||
val summaryView = holder.findViewById(android.R.id.summary) as TextView
|
||||
summaryView.movementMethod = LinkMovementMethod.getInstance()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user