diff options
author | Selim Cinek <cinek@google.com> | 2015-06-26 14:49:18 -0400 |
---|---|---|
committer | Selim Cinek <cinek@google.com> | 2015-06-30 19:38:26 -0700 |
commit | 4949c75f1e891e165b63db17c487cf2383bcfcd4 (patch) | |
tree | e4fafb25af1cf9ee64e0d0ec2d424e15a4ecb8bf /packages/SystemUI/src/com/android/systemui/settings | |
parent | 4e6b2d3e7d2c78c0575c14045469c36ab09a6a4e (diff) | |
download | frameworks_base-4949c75f1e891e165b63db17c487cf2383bcfcd4.zip frameworks_base-4949c75f1e891e165b63db17c487cf2383bcfcd4.tar.gz frameworks_base-4949c75f1e891e165b63db17c487cf2383bcfcd4.tar.bz2 |
Fixed accessibility order for quick settings
Bug: 20535538
Change-Id: I4e464c54158eb575208f6361af295ae702b19b21
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/settings')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/settings/ToggleSeekBar.java | 16 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java | 6 |
2 files changed, 19 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/settings/ToggleSeekBar.java b/packages/SystemUI/src/com/android/systemui/settings/ToggleSeekBar.java index a0a5561..8829794 100644 --- a/packages/SystemUI/src/com/android/systemui/settings/ToggleSeekBar.java +++ b/packages/SystemUI/src/com/android/systemui/settings/ToggleSeekBar.java @@ -19,9 +19,13 @@ package com.android.systemui.settings; import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; +import android.view.View; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.SeekBar; public class ToggleSeekBar extends SeekBar { + private String mAccessibilityLabel; + public ToggleSeekBar(Context context) { super(context); } @@ -42,4 +46,16 @@ public class ToggleSeekBar extends SeekBar { return super.onTouchEvent(event); } + + public void setAccessibilityLabel(String label) { + mAccessibilityLabel = label; + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + if (mAccessibilityLabel != null) { + info.setText(mAccessibilityLabel); + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java b/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java index cdb8e69..04263dd 100644 --- a/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java +++ b/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java @@ -42,7 +42,7 @@ public class ToggleSlider extends RelativeLayout { private boolean mTracking; private CompoundButton mToggle; - private SeekBar mSlider; + private ToggleSeekBar mSlider; private TextView mLabel; private ToggleSlider mMirror; @@ -68,13 +68,13 @@ public class ToggleSlider extends RelativeLayout { mToggle = (CompoundButton) findViewById(R.id.toggle); mToggle.setOnCheckedChangeListener(mCheckListener); - mSlider = (SeekBar) findViewById(R.id.slider); + mSlider = (ToggleSeekBar) findViewById(R.id.slider); mSlider.setOnSeekBarChangeListener(mSeekListener); mLabel = (TextView) findViewById(R.id.label); mLabel.setText(a.getString(R.styleable.ToggleSlider_text)); - setLabelFor(R.id.slider); // use our a11y text to annotate, not replace, the slider's + mSlider.setAccessibilityLabel(getContentDescription().toString()); a.recycle(); } |