Skip to content
Snippets Groups Projects
Commit 56ad23f7 authored by Dhina17's avatar Dhina17
Browse files

SystemUI: NavBarTuner: Disable unsupported preferences on gesture nav

- 'Navbar format' has no use when gesture nav is enabled
- 'Editor' has no use when gesture nav is enabled and
   ime can render gesture nav buttons.

To disable ime to render gesture nav buttons:
adb shell setprop persist.sys.ime.can_render_gestural_nav_buttons false

Change-Id: I7ceef63dcce16bf3e8f8ee07c1d6323930f66699
parent 502cd448
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,8 @@
package com.android.systemui.tuner;
import static android.inputmethodservice.InputMethodService.canImeRenderGesturalNavButtons;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
import static com.android.systemui.navigationbar.NavigationBarInflaterView.KEY;
import static com.android.systemui.navigationbar.NavigationBarInflaterView.KEY_CODE_END;
import static com.android.systemui.navigationbar.NavigationBarInflaterView.KEY_CODE_START;
......@@ -29,6 +31,7 @@ import static com.android.systemui.navigationbar.NavigationBarInflaterView.extra
import android.annotation.Nullable;
import android.app.AlertDialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
......@@ -57,6 +60,7 @@ import java.util.ArrayList;
public class NavBarTuner extends PreferenceFragment {
private static final String LAYOUT = "layout";
private static final String NAVBAR_EDITOR = "navbar_editor";
private final ArrayList<Tunable> mTunables = new ArrayList<>();
private Handler mHandler;
......@@ -79,7 +83,14 @@ public class NavBarTuner extends PreferenceFragment {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.nav_bar_tuner);
bindLayout((ListPreference) findPreference(LAYOUT));
ListPreference mLayoutPref = (ListPreference) findPreference(LAYOUT);
Preference mNavBarEditorPref = findPreference(NAVBAR_EDITOR);
if (isGestureNavigationEnabled(getContext())) {
mLayoutPref.setEnabled(false);
mNavBarEditorPref.setEnabled(!canImeRenderGesturalNavButtons());
} else {
bindLayout(mLayoutPref);
}
}
@Override
......@@ -110,4 +121,9 @@ public class NavBarTuner extends PreferenceFragment {
return true;
});
}
private boolean isGestureNavigationEnabled(Context context) {
return NAV_BAR_MODE_GESTURAL == context.getResources().getInteger(
com.android.internal.R.integer.config_navBarInteractionMode);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment