Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf929bbd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix Talkback say twice in MainSwitch" into sc-dev

parents d78977a7 429d7624
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -152,9 +152,6 @@ public class MainSwitchBar extends LinearLayout implements CompoundButton.OnChec
    public void setTitle(CharSequence text) {
        if (mTextView != null) {
            mTextView.setText(text);
            if (mSwitch != null) {
                mSwitch.setContentDescription(mTextView.getText());
            }
        }
    }

+3 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.settingslib.widget;
import static com.google.common.truth.Truth.assertThat;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.Switch;
import android.widget.TextView;
@@ -59,13 +60,13 @@ public class MainSwitchBarTest {
    }

    @Test
    public void setTitle_switchShouldHasContentDescription() {
    public void setTitle_switchShouldNotHasContentDescription() {
        final String title = "title";

        mBar.setTitle(title);

        final Switch switchObj = mBar.getSwitch();
        assertThat(switchObj.getContentDescription()).isEqualTo(title);
        assertThat(TextUtils.isEmpty(switchObj.getContentDescription())).isTrue();
    }

    @Test