Merge "Fix Talkback say twice in MainSwitch" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
bf929bbd3b
@@ -152,9 +152,6 @@ public class MainSwitchBar extends LinearLayout implements CompoundButton.OnChec
|
|||||||
public void setTitle(CharSequence text) {
|
public void setTitle(CharSequence text) {
|
||||||
if (mTextView != null) {
|
if (mTextView != null) {
|
||||||
mTextView.setText(text);
|
mTextView.setText(text);
|
||||||
if (mSwitch != null) {
|
|
||||||
mSwitch.setContentDescription(mTextView.getText());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.android.settingslib.widget;
|
|||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -59,13 +60,13 @@ public class MainSwitchBarTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setTitle_switchShouldHasContentDescription() {
|
public void setTitle_switchShouldNotHasContentDescription() {
|
||||||
final String title = "title";
|
final String title = "title";
|
||||||
|
|
||||||
mBar.setTitle(title);
|
mBar.setTitle(title);
|
||||||
|
|
||||||
final Switch switchObj = mBar.getSwitch();
|
final Switch switchObj = mBar.getSwitch();
|
||||||
assertThat(switchObj.getContentDescription()).isEqualTo(title);
|
assertThat(TextUtils.isEmpty(switchObj.getContentDescription())).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user