Fix that the toggle of High contrast text doesn't change to turn off after tapping the Reset button.
Solution: Triggered the updateState() after setChecked() to ensure the UI with the correct state. Fix: 220081053 Test: atest HighTextContrastPreferenceControllerTest Change-Id: I33c61d4e5602dfd67ec93a0826613304a1af7c2d
This commit is contained in:
@@ -19,6 +19,9 @@ package com.android.settings.accessibility;
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.TogglePreferenceController;
|
||||
|
||||
@@ -27,6 +30,7 @@ import com.android.settings.core.TogglePreferenceController;
|
||||
*/
|
||||
public class HighTextContrastPreferenceController extends TogglePreferenceController implements
|
||||
TextReadingResetController.ResetStateListener {
|
||||
private SwitchPreference mSwitchPreference;
|
||||
|
||||
public HighTextContrastPreferenceController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
@@ -54,8 +58,15 @@ public class HighTextContrastPreferenceController extends TogglePreferenceContro
|
||||
return R.string.menu_key_accessibility;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
mSwitchPreference = screen.findPreference(getPreferenceKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetState() {
|
||||
setChecked(false);
|
||||
updateState(mSwitchPreference);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user