am f22e2e39: Merge "Fixed accessibility order for quick settings" into mnc-dev
* commit 'f22e2e3998db9bcfdac5d1c524b0c02e7da7f86d': Fixed accessibility order for quick settings
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:contentDescription="@string/accessibility_brightness"
|
android:contentDescription="@string/accessibility_brightness"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
systemui:text="@string/status_bar_settings_auto_brightness_label" />
|
systemui:text="@string/status_bar_settings_auto_brightness_label" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -472,6 +472,7 @@ public class QSPanel extends ViewGroup {
|
|||||||
rows = r + 1;
|
rows = r + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
View previousView = mBrightnessView;
|
||||||
for (TileRecord record : mRecords) {
|
for (TileRecord record : mRecords) {
|
||||||
if (record.tileView.setDual(record.tile.supportsDualTargets())) {
|
if (record.tileView.setDual(record.tile.supportsDualTargets())) {
|
||||||
record.tileView.handleStateChanged(record.tile.getState());
|
record.tileView.handleStateChanged(record.tile.getState());
|
||||||
@@ -480,6 +481,7 @@ public class QSPanel extends ViewGroup {
|
|||||||
final int cw = record.row == 0 ? mLargeCellWidth : mCellWidth;
|
final int cw = record.row == 0 ? mLargeCellWidth : mCellWidth;
|
||||||
final int ch = record.row == 0 ? mLargeCellHeight : mCellHeight;
|
final int ch = record.row == 0 ? mLargeCellHeight : mCellHeight;
|
||||||
record.tileView.measure(exactly(cw), exactly(ch));
|
record.tileView.measure(exactly(cw), exactly(ch));
|
||||||
|
previousView = record.tileView.updateAccessibilityOrder(previousView);
|
||||||
}
|
}
|
||||||
int h = rows == 0 ? brightnessHeight : (getRowTop(rows) + mPanelPaddingBottom);
|
int h = rows == 0 ? brightnessHeight : (getRowTop(rows) + mPanelPaddingBottom);
|
||||||
if (mFooter.hasFooter()) {
|
if (mFooter.hasFooter()) {
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public class QSTileView extends ViewGroup {
|
|||||||
setClipChildren(false);
|
setClipChildren(false);
|
||||||
|
|
||||||
mTopBackgroundView = new View(context);
|
mTopBackgroundView = new View(context);
|
||||||
|
mTopBackgroundView.setId(View.generateViewId());
|
||||||
addView(mTopBackgroundView);
|
addView(mTopBackgroundView);
|
||||||
|
|
||||||
mIcon = createIcon();
|
mIcon = createIcon();
|
||||||
@@ -95,8 +96,8 @@ public class QSTileView extends ViewGroup {
|
|||||||
addView(mDivider);
|
addView(mDivider);
|
||||||
|
|
||||||
setClickable(true);
|
setClickable(true);
|
||||||
|
|
||||||
updateTopPadding();
|
updateTopPadding();
|
||||||
|
setId(View.generateViewId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTopPadding() {
|
private void updateTopPadding() {
|
||||||
@@ -137,7 +138,7 @@ public class QSTileView extends ViewGroup {
|
|||||||
final Resources res = mContext.getResources();
|
final Resources res = mContext.getResources();
|
||||||
if (mDual) {
|
if (mDual) {
|
||||||
mDualLabel = new QSDualTileLabel(mContext);
|
mDualLabel = new QSDualTileLabel(mContext);
|
||||||
mDualLabel.setId(android.R.id.title);
|
mDualLabel.setId(View.generateViewId());
|
||||||
mDualLabel.setBackgroundResource(R.drawable.btn_borderless_rect);
|
mDualLabel.setBackgroundResource(R.drawable.btn_borderless_rect);
|
||||||
mDualLabel.setFirstLineCaret(mContext.getDrawable(R.drawable.qs_dual_tile_caret));
|
mDualLabel.setFirstLineCaret(mContext.getDrawable(R.drawable.qs_dual_tile_caret));
|
||||||
mDualLabel.setTextColor(mContext.getColor(R.color.qs_tile_text));
|
mDualLabel.setTextColor(mContext.getColor(R.color.qs_tile_text));
|
||||||
@@ -155,9 +156,9 @@ public class QSTileView extends ViewGroup {
|
|||||||
mDualLabel.setContentDescription(labelDescription);
|
mDualLabel.setContentDescription(labelDescription);
|
||||||
}
|
}
|
||||||
addView(mDualLabel);
|
addView(mDualLabel);
|
||||||
|
mDualLabel.setAccessibilityTraversalAfter(mTopBackgroundView.getId());
|
||||||
} else {
|
} else {
|
||||||
mLabel = new TextView(mContext);
|
mLabel = new TextView(mContext);
|
||||||
mLabel.setId(android.R.id.title);
|
|
||||||
mLabel.setTextColor(mContext.getColor(R.color.qs_tile_text));
|
mLabel.setTextColor(mContext.getColor(R.color.qs_tile_text));
|
||||||
mLabel.setGravity(Gravity.CENTER_HORIZONTAL);
|
mLabel.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||||
mLabel.setMinLines(2);
|
mLabel.setMinLines(2);
|
||||||
@@ -328,6 +329,26 @@ public class QSTileView extends ViewGroup {
|
|||||||
mHandler.obtainMessage(H.STATE_CHANGED, state).sendToTarget();
|
mHandler.obtainMessage(H.STATE_CHANGED, state).sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the accessibility order for this view.
|
||||||
|
*
|
||||||
|
* @param previousView the view which should be before this one
|
||||||
|
* @return the last view in this view which is accessible
|
||||||
|
*/
|
||||||
|
public View updateAccessibilityOrder(View previousView) {
|
||||||
|
View firstView;
|
||||||
|
View lastView;
|
||||||
|
if (mDual) {
|
||||||
|
lastView = mDualLabel;
|
||||||
|
firstView = mTopBackgroundView;
|
||||||
|
} else {
|
||||||
|
firstView = this;
|
||||||
|
lastView = this;
|
||||||
|
}
|
||||||
|
firstView.setAccessibilityTraversalAfter(previousView.getId());
|
||||||
|
return lastView;
|
||||||
|
}
|
||||||
|
|
||||||
private class H extends Handler {
|
private class H extends Handler {
|
||||||
private static final int STATE_CHANGED = 1;
|
private static final int STATE_CHANGED = 1;
|
||||||
public H() {
|
public H() {
|
||||||
|
|||||||
@@ -19,9 +19,13 @@ package com.android.systemui.settings;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.accessibility.AccessibilityNodeInfo;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
|
|
||||||
public class ToggleSeekBar extends SeekBar {
|
public class ToggleSeekBar extends SeekBar {
|
||||||
|
private String mAccessibilityLabel;
|
||||||
|
|
||||||
public ToggleSeekBar(Context context) {
|
public ToggleSeekBar(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
@@ -42,4 +46,16 @@ public class ToggleSeekBar extends SeekBar {
|
|||||||
|
|
||||||
return super.onTouchEvent(event);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class ToggleSlider extends RelativeLayout {
|
|||||||
private boolean mTracking;
|
private boolean mTracking;
|
||||||
|
|
||||||
private CompoundButton mToggle;
|
private CompoundButton mToggle;
|
||||||
private SeekBar mSlider;
|
private ToggleSeekBar mSlider;
|
||||||
private TextView mLabel;
|
private TextView mLabel;
|
||||||
|
|
||||||
private ToggleSlider mMirror;
|
private ToggleSlider mMirror;
|
||||||
@@ -69,13 +69,13 @@ public class ToggleSlider extends RelativeLayout {
|
|||||||
mToggle = (CompoundButton) findViewById(R.id.toggle);
|
mToggle = (CompoundButton) findViewById(R.id.toggle);
|
||||||
mToggle.setOnCheckedChangeListener(mCheckListener);
|
mToggle.setOnCheckedChangeListener(mCheckListener);
|
||||||
|
|
||||||
mSlider = (SeekBar) findViewById(R.id.slider);
|
mSlider = (ToggleSeekBar) findViewById(R.id.slider);
|
||||||
mSlider.setOnSeekBarChangeListener(mSeekListener);
|
mSlider.setOnSeekBarChangeListener(mSeekListener);
|
||||||
|
|
||||||
mLabel = (TextView) findViewById(R.id.label);
|
mLabel = (TextView) findViewById(R.id.label);
|
||||||
mLabel.setText(a.getString(R.styleable.ToggleSlider_text));
|
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();
|
a.recycle();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user