public class

RemotePreferenceUpdater

extends BroadcastReceiver
java.lang.Object
   ↳ android.content.BroadcastReceiver
     ↳ lineageos.preference.RemotePreferenceUpdater

Class Overview

Base class for remote summary providers.

When an application is hosting preferences which are served by a different process, the former needs to stay updated with changes in order to display the correct summary when the user returns to the latter.

This class implements a simple ordered broadcast mechanism where the application running the RemotePreference sends an explicit broadcast to the host, who fills out the extras in the result bundle and returns it to the caller.

A minimal implementation will override getSummary and return a summary for the given key. Alternatively, fillResultExtras can be overridden if additional data should be added to the result.

Summary

Public Constructors
RemotePreferenceUpdater()
Public Methods
static void notifyChanged(Context context, String key)
Tell the RemotePreference that updated state is available.
Protected Methods
boolean fillResultExtras(Context context, String key, Bundle extras)
Fill the bundle with the summary and any other data needed to update the client.
String getSummary(Context context, String key)
Fetch the updated summary for the given key
[Expand]
Inherited Methods
From class android.content.BroadcastReceiver
From class java.lang.Object

Public Constructors

public RemotePreferenceUpdater ()

added in API level 8

Public Methods

public static void notifyChanged (Context context, String key)

added in API level 8

Tell the RemotePreference that updated state is available. Call from the fragment when necessary.

Protected Methods

protected boolean fillResultExtras (Context context, String key, Bundle extras)

added in API level 8

Fill the bundle with the summary and any other data needed to update the client.

Returns
boolean true if successful

protected String getSummary (Context context, String key)

added in API level 8

Fetch the updated summary for the given key

Parameters
context Context
Returns
String the summary for the given key