Skip to content

Commit

Permalink
Settings: Hide settings that don't work when taskbar is enabled
Browse files Browse the repository at this point in the history
Change-Id: I81f0f8ad645bec95579bd0487f3f1098ab5823df
  • Loading branch information
luk1337 authored and mikeNG committed Oct 25, 2024
1 parent 3af1cb3 commit 7a1d2bb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ android_library {
"org.lineageos.platform.internal",
"LineagePreferenceLib",
"vendor.lineage.fastcharge-V1.0-java",
"SystemUISharedLib",
],

plugins: ["androidx.room_room-compiler-plugin"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
import com.android.settings.widget.SeekBarPreference;
import com.android.settingslib.search.SearchIndexable;

import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen;

import lineageos.providers.LineageSettings;

/**
* A fragment to include all the settings related to Gesture Navigation mode.
*/
Expand All @@ -45,6 +49,8 @@ public class GestureNavigationSettingsFragment extends DashboardFragment {
private static final String LEFT_EDGE_SEEKBAR_KEY = "gesture_left_back_sensitivity";
private static final String RIGHT_EDGE_SEEKBAR_KEY = "gesture_right_back_sensitivity";

private static final String NAVIGATION_BAR_HINT_KEY = "navigation_bar_hint";

private WindowManager mWindowManager;
private BackGestureIndicatorView mIndicatorView;

Expand Down Expand Up @@ -75,6 +81,13 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {

initSeekBarPreference(LEFT_EDGE_SEEKBAR_KEY);
initSeekBarPreference(RIGHT_EDGE_SEEKBAR_KEY);

boolean isTaskbarEnabled = LineageSettings.System.getInt(getContext().getContentResolver(),
LineageSettings.System.ENABLE_TASKBAR, isLargeScreen(getContext()) ? 1 : 0) == 1;
if (isTaskbarEnabled) {
getPreferenceScreen().removePreference(
getPreferenceScreen().findPreference(NAVIGATION_BAR_HINT_KEY));
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
import com.android.settingslib.widget.IllustrationPreference;
import com.android.settingslib.widget.SelectorWithWidgetPreference;

import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen;

import lineageos.providers.LineageSettings;

import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -209,14 +213,17 @@ protected List<? extends CandidateInfo> getCandidates() {
final Context c = getContext();
List<CandidateInfoExtra> candidates = new ArrayList<>();

boolean isTaskbarEnabled = LineageSettings.System.getInt(getContext().getContentResolver(),
LineageSettings.System.ENABLE_TASKBAR, isLargeScreen(getContext()) ? 1 : 0) == 1;

if (SystemNavigationPreferenceController.isOverlayPackageAvailable(c,
NAV_BAR_MODE_GESTURAL_OVERLAY)) {
candidates.add(new CandidateInfoExtra(
c.getText(R.string.edge_to_edge_navigation_title),
c.getText(R.string.edge_to_edge_navigation_summary),
KEY_SYSTEM_NAV_GESTURAL, true /* enabled */));
}
if (SystemNavigationPreferenceController.isOverlayPackageAvailable(c,
if (!isTaskbarEnabled && SystemNavigationPreferenceController.isOverlayPackageAvailable(c,
NAV_BAR_MODE_2BUTTON_OVERLAY)) {
candidates.add(new CandidateInfoExtra(
c.getText(R.string.swipe_up_to_switch_apps_title),
Expand Down

0 comments on commit 7a1d2bb

Please sign in to comment.