Make A11y SUW launchable from SUW and small UX changes based on last round of
UX studies. Change-Id: I9c20cd3abf910a37731da2af604f3af2cd30e942
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.accessibility;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
@@ -24,10 +25,10 @@ import com.android.settings.widget.ToggleSwitch.OnBeforeCheckedChangeListener;
|
||||
|
||||
public class ToggleScreenMagnificationPreferenceFragment
|
||||
extends ToggleFeaturePreferenceFragment {
|
||||
|
||||
@Override
|
||||
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
|
||||
Settings.Secure.putInt(getContentResolver(),
|
||||
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, enabled ? 1 : 0);
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,6 +45,30 @@ public class ToggleScreenMagnificationPreferenceFragment
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
// Temporarily enable Magnification on this screen if it's disabled.
|
||||
if (Settings.Secure.getInt(getContentResolver(),
|
||||
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, 0) == 0) {
|
||||
setMagnificationEnabled(1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
if (!mToggleSwitch.isChecked()) {
|
||||
setMagnificationEnabled(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void setMagnificationEnabled(int enabled) {
|
||||
Settings.Secure.putInt(getContentResolver(),
|
||||
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMetricsCategory() {
|
||||
return MetricsLogger.ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFICATION;
|
||||
|
Reference in New Issue
Block a user