FileDocCategorySizeDatePackage
VolumePreference.javaAPI DocAndroid 1.5 API6859Wed May 06 22:41:56 BST 2009android.preference

VolumePreference

public class VolumePreference extends SeekBarPreference implements PreferenceManager.OnActivityStopListener
hide

Fields Summary
private static final String
TAG
private int
mStreamType
private SeekBarVolumizer
mSeekBarVolumizer
May be null if the dialog isn't visible.
Constructors Summary
public VolumePreference(android.content.Context context, android.util.AttributeSet attrs)

    
         
        super(context, attrs);
        
        TypedArray a = context.obtainStyledAttributes(attrs,
                com.android.internal.R.styleable.VolumePreference, 0, 0);
        mStreamType = a.getInt(android.R.styleable.VolumePreference_streamType, 0);
        a.recycle();        
    
Methods Summary
private voidcleanup()
Do clean up. This can be called multiple times!

       getPreferenceManager().unregisterOnActivityStopListener(this);
       
       if (mSeekBarVolumizer != null) {
           mSeekBarVolumizer.stop();
           mSeekBarVolumizer = null;
       }
    
public voidonActivityStop()

        cleanup();
    
protected voidonBindDialogView(android.view.View view)

        super.onBindDialogView(view);
    
        final SeekBar seekBar = (SeekBar) view.findViewById(com.android.internal.R.id.seekbar);
        mSeekBarVolumizer = new SeekBarVolumizer(getContext(), seekBar, mStreamType);
        
        getPreferenceManager().registerOnActivityStopListener(this);
    
protected voidonDialogClosed(boolean positiveResult)

        super.onDialogClosed(positiveResult);
        
        if (!positiveResult && mSeekBarVolumizer != null) {
            mSeekBarVolumizer.revertVolume();
        }
        
        cleanup();
    
protected voidonSampleStarting(android.preference.VolumePreference$SeekBarVolumizer volumizer)

        if (mSeekBarVolumizer != null && volumizer != mSeekBarVolumizer) {
            mSeekBarVolumizer.stopSample();
        }
    
public voidsetStreamType(int streamType)

        mStreamType = streamType;