import com.android.settings.support.SupportDashboardActivity;
import com.android.settings.system.ResetDashboardFragment;
import com.android.settings.system.SystemDashboardFragment;
+import com.android.settings.tts.TextToSpeechSettings;
import com.android.settings.tts.TtsEnginePreferenceFragment;
import com.android.settings.users.UserSettings;
import com.android.settings.wallpaper.WallpaperTypeSettings;
R.drawable.ic_devices_other);
addIndex(EnterprisePrivacySettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_about);
addIndex(PaymentSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_nfc_payment);
+ addIndex(TextToSpeechSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_accessibility);
addIndex(
TtsEnginePreferenceFragment.class, NO_DATA_RES_ID, R.drawable.ic_settings_language);
addIndex(LockscreenDashboardFragment.class, R.xml.security_lockscreen_settings,
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
+import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.provider.SearchIndexableResource;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.EngineInfo;
import android.speech.tts.TtsEngines;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
import com.android.settings.widget.ActionButtonPreference;
import com.android.settings.widget.GearPreference;
import com.android.settings.widget.SeekBarPreference;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
public class TextToSpeechSettings extends SettingsPreferenceFragment
implements Preference.OnPreferenceChangeListener,
- GearPreference.OnGearClickListener {
+ GearPreference.OnGearClickListener, Indexable {
private static final String STATE_KEY_LOCALE_ENTRIES = "locale_entries";
private static final String STATE_KEY_LOCALE_ENTRY_VALUES = "locale_entry_values";
// Do set pitch correctly after it may have changed, and unlike speed, it doesn't change
// immediately.
final ContentResolver resolver = getContentResolver();
- mTts.setPitch(android.provider.Settings.Secure.getInt(resolver, TTS_DEFAULT_PITCH, TextToSpeech.Engine.DEFAULT_PITCH)/100.0f);
+ mTts.setPitch(android.provider.Settings.Secure.getInt(resolver, TTS_DEFAULT_PITCH,
+ TextToSpeech.Engine.DEFAULT_PITCH) / 100.0f);
}
Locale ttsDefaultLocale = mTts.getDefaultLanguage();
}
mTts.setOnUtteranceProgressListener(new UtteranceProgressListener() {
@Override
- public void onStart(String utteranceId) {}
+ public void onStart(String utteranceId) {
+ }
@Override
- public void onDone(String utteranceId) {}
+ public void onDone(String utteranceId) {
+ }
@Override
public void onError(String utteranceId) {
EngineInfo info = mEnginesHelper.getEngineInfo(mCurrentEngine);
-
Preference mEnginePreference = findPreference(KEY_TTS_ENGINE_PREFERENCE);
((GearPreference) mEnginePreference).setOnGearClickListener(this);
mEnginePreference.setSummary(info.label);
}
});
} else {
- if (DBG) Log.d(TAG, "TTS engine for settings screen failed to initialize successfully.");
+ if (DBG) {
+ Log.d(TAG,
+ "TTS engine for settings screen failed to initialize successfully.");
+ }
updateWidgetState(false);
}
}
for (String loc : mAvailableStrLocals) {
if (loc.equalsIgnoreCase(defaultLocaleStr)) {
- notInAvailableLangauges = false;
- break;
+ notInAvailableLangauges = false;
+ break;
}
}
} catch (MissingResourceException e) {
private boolean isNetworkRequiredForSynthesis() {
Set<String> features = mTts.getFeatures(mCurrentDefaultLocale);
if (features == null) {
- return false;
+ return false;
}
return features.contains(TextToSpeech.Engine.KEY_FEATURE_NETWORK_SYNTHESIS) &&
!features.contains(TextToSpeech.Engine.KEY_FEATURE_EMBEDDED_SYNTHESIS);
return;
}
- if (data == null){
+ if (data == null) {
Log.e(TAG, "Engine failed voice data integrity check (null return)" +
mTts.getCurrentEngine());
return;
android.provider.Settings.Secure.putString(getContentResolver(), TTS_DEFAULT_SYNTH, engine);
mAvailableStrLocals = data.getStringArrayListExtra(
- TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES);
+ TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES);
if (mAvailableStrLocals == null) {
Log.e(TAG, "Voice data check complete, but no available voices found");
// Set mAvailableStrLocals to empty list
}
}
+ public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider() {
+ @Override
+ public List<SearchIndexableResource> getXmlResourcesToIndex(
+ Context context, boolean enabled) {
+ final SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.tts_settings;
+ return Arrays.asList(sir);
+ }
+
+ @Override
+ public List<String> getNonIndexableKeys(Context context) {
+ final List<String> keys = super.getNonIndexableKeys(context);
+ keys.add("tts_engine_preference");
+ return keys;
+ }
+ };
+
}