com.sileria.android.event
Class PrefsSeekBarListener

java.lang.Object
  extended by com.sileria.android.event.PrefsChangeListener<SeekBarPreference>
      extended by com.sileria.android.view.SeekBarPreference.AbstractSeekBarListener
          extended by com.sileria.android.event.PrefsSeekBarListener
All Implemented Interfaces:
Preference.OnPreferenceChangeListener

public class PrefsSeekBarListener
extends SeekBarPreference.AbstractSeekBarListener

Handles updating of the summary text for a ListPreference.

Example:

  SeekBarPreference seekPref = new SeekBarPreference( this );
  seekPref.setOnPreferenceChangeListener( new PrefsSeekBarListener(listPref) );
 
Example of summary with var-arg string resource:
  SeekBarPreference botsPref = new SeekBarPreference( this );
  botsPref.setTitle( R.string.bots_prefs );
  botsPref.setKey( OPT_BOTS_COUNT );
  botsPref.setDefaultValue( DEF_BOTS_COUNT );
  botsPref.setMax( MAX_BOTS_COUNT );
  prefs.addPreference( botsPref );
  botsPref.setOnPreferenceChangeListener( new PrefsSeekBarListener( botsPref, R.string.bots_x ) );
 
where R.string.bots_x is defined as:
  <string name="bots_x">Total Bots: %d</string>
 

Author:
Ahmed Shakil
Create Date:
Dec 22nd, 2011

Field Summary
 
Fields inherited from class com.sileria.android.event.PrefsChangeListener
pref
 
Constructor Summary
PrefsSeekBarListener(SeekBarPreference pref)
          Construct a change lsitener for the specified widget.
PrefsSeekBarListener(SeekBarPreference pref, int strResId)
          Construct a change lsitener for the specified widget.
 
Method Summary
protected  String toSummary(Object newValue)
          Convert integer progress to summary string.
protected  void updateSummary(Object newValue)
          Update the summary.
 
Methods inherited from class com.sileria.android.view.SeekBarPreference.AbstractSeekBarListener
setSummary
 
Methods inherited from class com.sileria.android.event.PrefsChangeListener
onPreferenceChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrefsSeekBarListener

public PrefsSeekBarListener(SeekBarPreference pref)
Construct a change lsitener for the specified widget.


PrefsSeekBarListener

public PrefsSeekBarListener(SeekBarPreference pref,
                            int strResId)
Construct a change lsitener for the specified widget.

Parameters:
pref - SeekBarPreference object
strResId - string resource id that takes a integer argument
Method Detail

updateSummary

protected void updateSummary(Object newValue)
Update the summary.

Overrides:
updateSummary in class PrefsChangeListener<SeekBarPreference>
Parameters:
newValue - Integer value

toSummary

protected String toSummary(Object newValue)
Convert integer progress to summary string.

Specified by:
toSummary in class SeekBarPreference.AbstractSeekBarListener
Parameters:
newValue - should be an Integer instance


Copyright © 2001 - 2014 Sileria, Inc.
Licensed under the Apache License, Ver 2.0