Convert Magnify controller to TogglePrefController

Convert below to TogglePreferenceController:
MagnificationNavbarPreferenceController
(Magnify with Button)
MagnificationGesturesPreferenceController
(Magnify with triple-tap)

The two controllers share the same fragment,
Add static method for set/get state in fragment,
And use them in controllers and fragment.

Change-Id: I2bdbdb36be71e1a3ffb557abc5a6115d48de53cf
Merged-In: I2bdbdb36be71e1a3ffb557abc5a6115d48de53cf
Fixes: 67997698
Fixes: 67997726
Test: make RunSettingsRoboTests
This commit is contained in:
hjchangliao
2018-05-02 16:57:20 +08:00
committed by Andrew Sapperstein
parent 8a9c47e1ba
commit a92271c26d
8 changed files with 131 additions and 26 deletions

View File

@@ -51,8 +51,10 @@ public abstract class TogglePreferenceController extends BasePreferenceControlle
public void updateState(Preference preference) {
if (preference instanceof TwoStatePreference) {
((TwoStatePreference) preference).setChecked(isChecked());
} if (preference instanceof MasterSwitchPreference) {
} else if (preference instanceof MasterSwitchPreference) {
((MasterSwitchPreference) preference).setChecked(isChecked());
} else {
refreshSummary(preference);
}
}