ToggleSliderpublic 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 boolean | isChecked()
return mToggle.isChecked();
| protected void | onAttachedToWindow()
super.onAttachedToWindow();
if (mListener != null) {
mListener.onInit(this);
}
| public void | setChecked(boolean checked)
mToggle.setChecked(checked);
| public void | setMax(int max)
mSlider.setMax(max);
if (mMirror != null) {
mMirror.setMax(max);
}
| public void | setMirror(com.android.systemui.settings.ToggleSlider toggleSlider)
mMirror = toggleSlider;
if (mMirror != null) {
mMirror.setChecked(mToggle.isChecked());
mMirror.setMax(mSlider.getMax());
mMirror.setValue(mSlider.getProgress());
}
| public void | setMirrorController(com.android.systemui.statusbar.policy.BrightnessMirrorController c)
mMirrorController = c;
| public void | setOnChangedListener(com.android.systemui.settings.ToggleSlider$Listener l)
mListener = l;
| public void | setValue(int value)
mSlider.setProgress(value);
if (mMirror != null) {
mMirror.setValue(value);
}
|
|