metagloss 0.0.2

net.sf.metagloss.preference
Annotation Type BindPreference


@Target(value={TYPE,FIELD})
@Retention(value=RUNTIME)
@Inherited
public @interface BindPreference

Annotation type to make a Preference's value reflected in its summary field. The format defaults to simply echoing the value of the selected Preference, but can be customized by specifying the format of the summary.

Examples:

Echo value of preference

@BindPreference
public static final String PREF_THOUSAND_SEPARATOR = "thousand_separator";

Echo formatted value

@BindPreference(format="Delimiter: %s")
public static final String PREF_THOUSAND_SEPARATOR = "thousand_separator";

Echo formatted value and fire preference change event by key id

@BindPreference(format = "Delimiter: %s", fireChange = { PREF_DATE_FORMAT })
public static final String PREF_DATE_FORMAT_SEPARATOR = "date_format_separator";


Optional Element Summary
 java.lang.String[] fireChange
          Each defined entry will fire a OnSharedPreferenceChangeListener#onSharedPreferenceChanged(SharedPreferences, String) where the string parameter corresponds to the given entry in the array.
 java.lang.String format
          Format string of summary.
 java.lang.String key
          The key value associated with a preference.
 

key

public abstract java.lang.String key
The key value associated with a preference.

Returns:
Preference element's key value.
See Also:
Preference.getKey()
Default:
""

format

public abstract java.lang.String format
Format string of summary. Must be single argument.

Returns:
Format string.
Default:
"%s"

fireChange

public abstract java.lang.String[] fireChange
Each defined entry will fire a OnSharedPreferenceChangeListener#onSharedPreferenceChanged(SharedPreferences, String) where the string parameter corresponds to the given entry in the array. This is primarily useful if the formatted summary co-depends on a value given in a separate preference. However, all such situations must be handled by the class extending AnnotatedPreferenceActivity.

Returns:
Array of preference events to fire.
Default:
{}