Hide "Magnify with button" if no navbar is shown

Devices without a software-rendered navigation bar will be unable to
use "Magnify with button" as no accessibility button trigger for
magnification can be shown.

In this case, we hide the setting by preventing
MagnificationPreferenceFragment from showing the list of mag
modes, instead launching directly into the PreferenceFragment for
"Magnify with triple-tap"

Bug: 36862906
Test: Manual - Configured marlin to disable the navigation bar and
      verified behavior in SUW and Settings

Change-Id: Ie614ec292d7779044274b7c79eaed1df080c0fd1
This commit is contained in:
Casey Burkhardt
2017-04-13 15:50:28 -07:00
parent 8399697520
commit 875d3b2471
3 changed files with 62 additions and 16 deletions

View File

@@ -387,6 +387,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);
@@ -678,6 +679,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