Merge "Hide "Magnify with button" if no navbar is shown" into oc-dev

This commit is contained in:
Casey Burkhardt
2017-04-18 00:06:52 +00:00
committed by Android (Google) Code Review
3 changed files with 62 additions and 16 deletions

View File

@@ -389,6 +389,7 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
// Display magnification.
mDisplayMagnificationPreferenceScreen = findPreference(
DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN);
configureMagnificationPreferenceIfNeeded(mDisplayMagnificationPreferenceScreen);
// Font size.
mFontSizePreferenceScreen = findPreference(FONT_SIZE_PREFERENCE_SCREEN);
@@ -682,6 +683,19 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
}
}
private static void configureMagnificationPreferenceIfNeeded(Preference preference) {
// Some devices support only a single magnification mode. In these cases, we redirect to
// the magnification mode's UI directly, rather than showing a PreferenceScreen with a
// single list item.
final Context context = preference.getContext();
if (!MagnificationPreferenceFragment.isApplicable(context.getResources())) {
preference.setFragment(ToggleScreenMagnificationPreferenceFragment.class.getName());
final Bundle extras = preference.getExtras();
MagnificationPreferenceFragment.populateMagnificationGesturesPreferenceExtras(extras,
context);
}
}
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider() {
@Override