Fix bug #15897505 Talk back state shows "off" while the talk back is still enabled.

- we were missing the update of the TextView from the SwitchBar so provide a new
setCheckedInternal() method that is doing the TextView and Switch update at the
same time

Change-Id: I6dd9c472a386bb534a58fbf5cf82d9d01fa74f6c
This commit is contained in:
Fabrice Di Meglio
2014-06-27 19:13:19 -07:00
parent d2b1e441b7
commit 006b2cca13
9 changed files with 23 additions and 19 deletions

View File

@@ -151,9 +151,8 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
final boolean enabled = mCaptioningManager.isEnabled();
SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar();
mSwitchBar.setTextViewLabel(enabled);
mSwitchBar.setCheckedInternal(enabled);
mToggleSwitch = mSwitchBar.getSwitch();
mToggleSwitch.setCheckedInternal(enabled);
getPreferenceScreen().setEnabled(enabled);
@@ -228,7 +227,7 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
mToggleSwitch.setOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {
@Override
public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
toggleSwitch.setCheckedInternal(checked);
mSwitchBar.setCheckedInternal(checked);
Settings.Secure.putInt(getActivity().getContentResolver(),
Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, checked ? 1 : 0);
getPreferenceScreen().setEnabled(checked);