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
Fixes: 67997698
Fixes: 67997726
Test: make RunSettingsRoboTests
This commit is contained in:
hjchangliao
2018-05-02 16:57:20 +08:00
parent 5de68ea81a
commit 2f73a6646f
8 changed files with 135 additions and 29 deletions

View File

@@ -59,9 +59,6 @@ public abstract class GesturePreferenceController extends TogglePreferenceContro
public void updateState(Preference preference) {
super.updateState(preference);
if (preference != null) {
if (!(preference instanceof TwoStatePreference)) {
preference.setSummary(getSummary());
}
// Different meanings of "Enabled" for the Preference and Controller.
preference.setEnabled(canHandleClicks());
}