Loading packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceStateProviders.kt +4 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.ContextWrapper import android.content.Intent import android.os.Bundle import androidx.lifecycle.LifecycleCoroutineScope import com.android.settingslib.datastore.KeyValueStore import kotlinx.coroutines.CoroutineScope /** Loading Loading @@ -157,6 +158,9 @@ abstract class PreferenceLifecycleContext(context: Context) : ContextWrapper(con */ abstract fun <T : Any> requirePreference(key: String): T /** Returns the [KeyValueStore] attached to the preference of given key *on the same screen*. */ abstract fun getKeyValueStore(key: String): KeyValueStore? /** Notifies that preference state of given key is changed and updates preference widget UI. */ abstract fun notifyPreferenceChange(key: String) Loading packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceScreenBindingHelper.kt +5 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,11 @@ class PreferenceScreenBindingHelper( override fun <T : Any> requirePreference(key: String) = findPreference<T>(key)!! override fun getKeyValueStore(key: String) = (findPreference<Preference>(key)?.preferenceDataStore as? PreferenceDataStoreAdapter) ?.keyValueStore override fun notifyPreferenceChange(key: String) = notifyChange(key, CHANGE_REASON_STATE) Loading Loading
packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceStateProviders.kt +4 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.ContextWrapper import android.content.Intent import android.os.Bundle import androidx.lifecycle.LifecycleCoroutineScope import com.android.settingslib.datastore.KeyValueStore import kotlinx.coroutines.CoroutineScope /** Loading Loading @@ -157,6 +158,9 @@ abstract class PreferenceLifecycleContext(context: Context) : ContextWrapper(con */ abstract fun <T : Any> requirePreference(key: String): T /** Returns the [KeyValueStore] attached to the preference of given key *on the same screen*. */ abstract fun getKeyValueStore(key: String): KeyValueStore? /** Notifies that preference state of given key is changed and updates preference widget UI. */ abstract fun notifyPreferenceChange(key: String) Loading
packages/SettingsLib/Preference/src/com/android/settingslib/preference/PreferenceScreenBindingHelper.kt +5 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,11 @@ class PreferenceScreenBindingHelper( override fun <T : Any> requirePreference(key: String) = findPreference<T>(key)!! override fun getKeyValueStore(key: String) = (findPreference<Preference>(key)?.preferenceDataStore as? PreferenceDataStoreAdapter) ?.keyValueStore override fun notifyPreferenceChange(key: String) = notifyChange(key, CHANGE_REASON_STATE) Loading