Fix some long forgottten TTS settings bugs

- Handle radio button clicks correctly
- Handle injecting voice data correctly

bug:5998256
bug:5938852
bug:5998418
Change-Id: Ib30afa6558e51ac9a88e28c51500ebaad93ad7fe
This commit is contained in:
Narayan Kamath
2012-07-20 13:27:12 +01:00
parent c6e84c0959
commit 1926bd4f2e
2 changed files with 11 additions and 6 deletions

View File

@@ -16,8 +16,6 @@
package com.android.settings.tts; package com.android.settings.tts;
import com.android.settings.R;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
@@ -31,6 +29,9 @@ import android.widget.CompoundButton;
import android.widget.RadioButton; import android.widget.RadioButton;
import com.android.settings.R;
public class TtsEnginePreference extends Preference { public class TtsEnginePreference extends Preference {
/** /**
@@ -173,7 +174,8 @@ public class TtsEnginePreference extends Preference {
} }
private void onRadioButtonClicked(CompoundButton buttonView, boolean isChecked) { private void onRadioButtonClicked(CompoundButton buttonView, boolean isChecked) {
if (mPreventRadioButtonCallbacks) { if (mPreventRadioButtonCallbacks ||
(mSharedState.getCurrentChecked() == buttonView)) {
return; return;
} }

View File

@@ -63,7 +63,6 @@ public class TtsEngineSettingsFragment extends SettingsPreferenceFragment implem
@Override @Override
public void run() { public void run() {
mLocalePreference.setEnabled(true); mLocalePreference.setEnabled(true);
updateVoiceDetails();
} }
}); });
} }
@@ -103,6 +102,9 @@ public class TtsEngineSettingsFragment extends SettingsPreferenceFragment implem
mInstallVoicesPreference.setEnabled(false); mInstallVoicesPreference.setEnabled(false);
mLocalePreference.setEnabled(false); mLocalePreference.setEnabled(false);
updateVoiceDetails();
mTts = new TextToSpeech(getActivity().getApplicationContext(), mTtsInitListener, mTts = new TextToSpeech(getActivity().getApplicationContext(), mTtsInitListener,
getEngineName()); getEngineName());
} }
@@ -117,9 +119,10 @@ public class TtsEngineSettingsFragment extends SettingsPreferenceFragment implem
final Intent voiceDataDetails = getArguments().getParcelable( final Intent voiceDataDetails = getArguments().getParcelable(
TtsEnginePreference.FRAGMENT_ARGS_VOICES); TtsEnginePreference.FRAGMENT_ARGS_VOICES);
if (DBG) Log.d(TAG, "Parsing voice data details, data: " + voiceDataDetails.toUri(0)); if (DBG) Log.d(TAG, "Parsing voice data details, data: " + voiceDataDetails.toUri(0));
ArrayList<String> available = voiceDataDetails.getStringArrayListExtra(
final ArrayList<String> available = voiceDataDetails.getStringArrayListExtra(
TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES); TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES);
ArrayList<String> unavailable = voiceDataDetails.getStringArrayListExtra( final ArrayList<String> unavailable = voiceDataDetails.getStringArrayListExtra(
TextToSpeech.Engine.EXTRA_UNAVAILABLE_VOICES); TextToSpeech.Engine.EXTRA_UNAVAILABLE_VOICES);
if (available == null){ if (available == null){