Disable controls during playback.
The controls were enabled during playback earlier, however changing them did nothing to the current playout. Disable them during playout and re-enable them once playout is done. Bug: 77976922 Test: Repro case in linked bug. Change-Id: I0fbe1c97e794fccc49172ee7542018aeef956c8f
This commit is contained in:
@@ -251,15 +251,20 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
|
||||
mTts.setOnUtteranceProgressListener(new UtteranceProgressListener() {
|
||||
@Override
|
||||
public void onStart(String utteranceId) {
|
||||
updateWidgetState(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDone(String utteranceId) {
|
||||
updateWidgetState(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String utteranceId) {
|
||||
Log.e(TAG, "Error while trying to synthesize sample text");
|
||||
// Re-enable just in case, although there isn't much hope that following synthesis
|
||||
// requests are going to succeed.
|
||||
updateWidgetState(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -696,9 +701,11 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
|
||||
}
|
||||
|
||||
private void updateWidgetState(boolean enable) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
mActionButtons.setButton1Enabled(enable);
|
||||
mDefaultRatePref.setEnabled(enable);
|
||||
mDefaultPitchPref.setEnabled(enable);
|
||||
});
|
||||
}
|
||||
|
||||
private void displayNetworkAlert() {
|
||||
|
Reference in New Issue
Block a user