FileDocCategorySizeDatePackage
ToggleSlider.javaAPI DocAndroid 5.1 API5884Thu Mar 12 22:22:42 GMT 2015com.android.systemui.settings

ToggleSlider

public class ToggleSlider extends android.widget.RelativeLayout

Fields Summary
private Listener
mListener
private boolean
mTracking
private android.widget.CompoundButton
mToggle
private android.widget.SeekBar
mSlider
private android.widget.TextView
mLabel
private ToggleSlider
mMirror
private com.android.systemui.statusbar.policy.BrightnessMirrorController
mMirrorController
private final android.widget.CompoundButton.OnCheckedChangeListener
mCheckListener
private final android.widget.SeekBar.OnSeekBarChangeListener
mSeekListener
Constructors Summary
public ToggleSlider(android.content.Context context)

        this(context, null);
    
public ToggleSlider(android.content.Context context, android.util.AttributeSet attrs)

        this(context, attrs, 0);
    
public ToggleSlider(android.content.Context context, android.util.AttributeSet attrs, int defStyle)

        super(context, attrs, defStyle);

        View.inflate(context, R.layout.status_bar_toggle_slider, this);

        final Resources res = context.getResources();
        final TypedArray a = context.obtainStyledAttributes(
                attrs, R.styleable.ToggleSlider, defStyle, 0);

        mToggle = (CompoundButton) findViewById(R.id.toggle);
        mToggle.setOnCheckedChangeListener(mCheckListener);

        mSlider = (SeekBar) findViewById(R.id.slider);
        mSlider.setOnSeekBarChangeListener(mSeekListener);

        mLabel = (TextView) findViewById(R.id.label);
        mLabel.setText(a.getString(R.styleable.ToggleSlider_text));

        a.recycle();
    
Methods Summary
public booleanisChecked()

        return mToggle.isChecked();
    
protected voidonAttachedToWindow()

        super.onAttachedToWindow();
        if (mListener != null) {
            mListener.onInit(this);
        }
    
public voidsetChecked(boolean checked)

        mToggle.setChecked(checked);
    
public voidsetMax(int max)

        mSlider.setMax(max);
        if (mMirror != null) {
            mMirror.setMax(max);
        }
    
public voidsetMirror(com.android.systemui.settings.ToggleSlider toggleSlider)

        mMirror = toggleSlider;
        if (mMirror != null) {
            mMirror.setChecked(mToggle.isChecked());
            mMirror.setMax(mSlider.getMax());
            mMirror.setValue(mSlider.getProgress());
        }
    
public voidsetMirrorController(com.android.systemui.statusbar.policy.BrightnessMirrorController c)

        mMirrorController = c;
    
public voidsetOnChangedListener(com.android.systemui.settings.ToggleSlider$Listener l)

        mListener = l;
    
public voidsetValue(int value)

        mSlider.setProgress(value);
        if (mMirror != null) {
            mMirror.setValue(value);
        }