Cannot switch between multiple TTS engines

That is caused by layout xml changes. The radio button was clickable
in old xml resource. But it is not clickable in new xml resource.
Therefore we can't receive click callback. Fixed by changing
Radio button state when preference is clicked.

Fixes: 135285101
Test: manual, make RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.tts"
Change-Id: Idd7bf37d9ccbc1b56d41978d19dc05c8a81cc49a
This commit is contained in:
Raff Tsai
2019-06-19 16:21:20 +08:00
parent 0304f4d1ce
commit 39c6a16aba
2 changed files with 107 additions and 0 deletions

View File

@@ -30,6 +30,8 @@ import androidx.preference.PreferenceViewHolder;
import com.android.settings.R;
import androidx.annotation.VisibleForTesting;
public class TtsEnginePreference extends Preference {
@@ -45,6 +47,7 @@ public class TtsEnginePreference extends Preference {
* The shared radio button state, which button is checked etc.
*/
private final RadioButtonGroupState mSharedState;
private RadioButton mRadioButton;
/**
* When true, the change callbacks on the radio button will not
@@ -95,6 +98,12 @@ public class TtsEnginePreference extends Preference {
mPreventRadioButtonCallbacks = true;
rb.setChecked(isChecked);
mPreventRadioButtonCallbacks = false;
mRadioButton = rb;
}
@Override
public void onClick() {
mRadioButton.setChecked(true);
}
private boolean shouldDisplayDataAlert() {