public class SettingSwitch
extends SwitchWidget
SwitchWidget implementation that is used as widget for SettingSwitchPreference.
This extended switch widget fixes a common issue when the thumb is not being animated when checked
state of the switch is changed due to isShown() method returning always false.
The incorporated fix overrides behavior of isShown() method in a way that it returns
true whenever the current visibility of the switch widget is View.VISIBLE.
Note, that due to workaround described above, this switch widget should be only used for purpose
of preference layouts. For application layouts use rather SwitchWidget.
SwitchWidget
switchStyle| Constructor and Description |
|---|
SettingSwitch(android.content.Context context)
Same as
SettingSwitch(Context, AttributeSet) without attributes. |
SettingSwitch(android.content.Context context,
android.util.AttributeSet attrs)
Same as
SettingSwitch(Context, AttributeSet, int) with R.attr#switchStyle
as attribute for default style. |
SettingSwitch(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
Same as
SettingSwitch(Context, AttributeSet, int, int) with 0 as default style. |
SettingSwitch(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
Creates a new instance of SettingSwitch for the given context.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isShown() |
void |
onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent event) |
void |
onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo info) |
public SettingSwitch(android.content.Context context)
SettingSwitch(Context, AttributeSet) without attributes.public SettingSwitch(android.content.Context context,
android.util.AttributeSet attrs)
SettingSwitch(Context, AttributeSet, int) with R.attr#switchStyle
as attribute for default style.public SettingSwitch(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
SettingSwitch(Context, AttributeSet, int, int) with 0 as default style.public SettingSwitch(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
context - Context in which will be the new view presented.attrs - Set of Xml attributes used to configure the new instance of this view.defStyleAttr - An attribute which contains a reference to a default style resource for
this view within a theme of the given context.defStyleRes - Resource id of the default style for the new view.public void onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)
public void onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo info)
public boolean isShown()
True whenever the current visibility of this widget is View.VISIBLE.#getVisibility()