Hide navigation hint checkbox when taskbar is enabled
Change-Id: Idb29572be5f5b070f71d90889a5ad150a222206b
This commit is contained in:
@@ -35,6 +35,7 @@ android_app {
|
||||
"SettingsLib",
|
||||
"setupcompat",
|
||||
"setupdesign",
|
||||
"SystemUISharedLib",
|
||||
"org.lineageos.platform.internal",
|
||||
],
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The LineageOS Project
|
||||
* Copyright (C) 2022-2023 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,8 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON_OVE
|
||||
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY;
|
||||
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY;
|
||||
|
||||
import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen;
|
||||
|
||||
import static org.lineageos.internal.util.DeviceKeysConstants.KEY_MASK_APP_SWITCH;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.DISABLE_NAV_KEYS;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.NAVIGATION_OPTION_KEY;
|
||||
@@ -50,6 +52,8 @@ public class NavigationSettingsActivity extends BaseSetupWizardActivity {
|
||||
|
||||
private SetupWizardApp mSetupWizardApp;
|
||||
|
||||
private boolean mIsTaskbarEnabled;
|
||||
|
||||
private String mSelection = NAV_BAR_MODE_GESTURAL_OVERLAY;
|
||||
|
||||
private CheckBox mHideGesturalHint;
|
||||
@@ -63,6 +67,8 @@ public class NavigationSettingsActivity extends BaseSetupWizardActivity {
|
||||
if (mSetupWizardApp.getSettingsBundle().containsKey(DISABLE_NAV_KEYS)) {
|
||||
navBarEnabled = mSetupWizardApp.getSettingsBundle().getBoolean(DISABLE_NAV_KEYS);
|
||||
}
|
||||
mIsTaskbarEnabled = LineageSettings.System.getInt(getContentResolver(),
|
||||
LineageSettings.System.ENABLE_TASKBAR, isLargeScreen(this) ? 1 : 0) == 1;
|
||||
|
||||
int deviceKeys = getResources().getInteger(
|
||||
org.lineageos.platform.internal.R.integer.config_deviceHardwareKeys);
|
||||
@@ -89,7 +95,6 @@ public class NavigationSettingsActivity extends BaseSetupWizardActivity {
|
||||
available--;
|
||||
}
|
||||
|
||||
|
||||
// Hide this page if the device has hardware keys but didn't enable navbar
|
||||
// or if there's <= 1 available navigation modes
|
||||
if (!navBarEnabled && hasHomeKey || available <= 1) {
|
||||
@@ -103,6 +108,12 @@ public class NavigationSettingsActivity extends BaseSetupWizardActivity {
|
||||
findViewById(R.id.navigation_illustration);
|
||||
final RadioGroup radioGroup = findViewById(R.id.navigation_radio_group);
|
||||
mHideGesturalHint = findViewById(R.id.hide_navigation_hint);
|
||||
|
||||
// Hide navigation hint checkbox when taskbar is enabled
|
||||
if (mIsTaskbarEnabled) {
|
||||
mHideGesturalHint.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
@@ -131,6 +142,10 @@ public class NavigationSettingsActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
|
||||
private void revealHintCheckbox() {
|
||||
if (mIsTaskbarEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
mHideGesturalHint.animate().cancel();
|
||||
|
||||
if (mHideGesturalHint.getVisibility() == View.VISIBLE) {
|
||||
@@ -146,6 +161,10 @@ public class NavigationSettingsActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
|
||||
private void hideHintCheckBox() {
|
||||
if (mIsTaskbarEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mHideGesturalHint.getVisibility() == View.INVISIBLE) {
|
||||
return;
|
||||
}
|
||||
@@ -165,10 +184,12 @@ public class NavigationSettingsActivity extends BaseSetupWizardActivity {
|
||||
@Override
|
||||
protected void onNextPressed() {
|
||||
mSetupWizardApp.getSettingsBundle().putString(NAVIGATION_OPTION_KEY, mSelection);
|
||||
if (!mIsTaskbarEnabled) {
|
||||
boolean hideHint = mHideGesturalHint.isChecked();
|
||||
LineageSettings.System.putIntForUser(getContentResolver(),
|
||||
LineageSettings.System.NAVIGATION_BAR_HINT, hideHint ? 0 : 1,
|
||||
UserHandle.USER_CURRENT);
|
||||
}
|
||||
Intent intent = WizardManagerHelper.getNextIntent(getIntent(), Activity.RESULT_OK);
|
||||
nextAction(NEXT_REQUEST, intent);
|
||||
}
|
||||
|
Reference in New Issue
Block a user