diff options
author | Rakesh Iyer <rni@google.com> | 2018-10-26 12:45:38 -0700 |
---|---|---|
committer | Rakesh Iyer <rni@google.com> | 2018-10-29 10:20:28 -0700 |
commit | 52fd31c2f3dbdee58ee57b08336445df8ce80ae9 (patch) | |
tree | 5dacd1c8abf39227eedf2b396101f99982176ee0 /src/com/android/settings/tts | |
parent | 0a30175bd777b0552e1a61a10b61f34ff197abf4 (diff) | |
download | packages_apps_Settings-52fd31c2f3dbdee58ee57b08336445df8ce80ae9.tar.gz packages_apps_Settings-52fd31c2f3dbdee58ee57b08336445df8ce80ae9.tar.bz2 packages_apps_Settings-52fd31c2f3dbdee58ee57b08336445df8ce80ae9.zip |
Misc fixes to TTS settings.
1. Remove an extra PreferenceGroup that was causing some spacing
issues.
2. Remove the animations when elements resize because this causes
items to slide around unnecessarily.
3. While we're in the file, lambda-ify some of the older code.
Bug: 77981482
Bug: 79897262
Test: Manually verified.
Change-Id: I9c79beea3a231ba62aeef3543802faebd775e128
Diffstat (limited to 'src/com/android/settings/tts')
-rw-r--r-- | src/com/android/settings/tts/TextToSpeechSettings.java | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/src/com/android/settings/tts/TextToSpeechSettings.java b/src/com/android/settings/tts/TextToSpeechSettings.java index 0f10d28572..866e5a8000 100644 --- a/src/com/android/settings/tts/TextToSpeechSettings.java +++ b/src/com/android/settings/tts/TextToSpeechSettings.java @@ -147,12 +147,7 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment * screen for the first time (as opposed to when a user changes his choice * of engine). */ - private final TextToSpeech.OnInitListener mInitListener = new TextToSpeech.OnInitListener() { - @Override - public void onInit(int status) { - onInitEngine(status); - } - }; + private final TextToSpeech.OnInitListener mInitListener = this::onInitEngine; @Override public int getMetricsCategory() { @@ -215,6 +210,11 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment @Override public void onResume() { super.onResume(); + // We tend to change the summary contents of our widgets, which at higher text sizes causes + // them to resize, which results in the recyclerview smoothly animating them at inopportune + // times. Disable the animation so widgets snap to their positions rather than sliding + // around while the user is interacting with it. + getListView().getItemAnimator().setMoveDuration(0); if (mTts == null || mCurrentDefaultLocale == null) { return; @@ -323,7 +323,6 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment if (mCurrentEngine != null) { EngineInfo info = mEnginesHelper.getEngineInfo(mCurrentEngine); - Preference mEnginePreference = findPreference(KEY_TTS_ENGINE_PREFERENCE); ((GearPreference) mEnginePreference).setOnGearClickListener(this); mEnginePreference.setSummary(info.label); @@ -365,14 +364,7 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment if (status == TextToSpeech.SUCCESS) { if (DBG) Log.d(TAG, "TTS engine for settings screen initialized."); checkDefaultLocale(); - getActivity() - .runOnUiThread( - new Runnable() { - @Override - public void run() { - mLocalePreference.setEnabled(true); - } - }); + getActivity().runOnUiThread(() -> mLocalePreference.setEnabled(true)); } else { if (DBG) { Log.d(TAG, @@ -516,14 +508,7 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment } // Sort it - Collections.sort( - entryPairs, - new Comparator<Pair<String, Locale>>() { - @Override - public int compare(Pair<String, Locale> lhs, Pair<String, Locale> rhs) { - return lhs.first.compareToIgnoreCase(rhs.first); - } - }); + Collections.sort(entryPairs, (lhs, rhs) -> lhs.first.compareToIgnoreCase(rhs.first)); // Get two arrays out of one of pairs mSelectedLocaleIndex = 0; // Will point to the R.string.tts_lang_use_system value |