Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9b0c596 authored by Jason Chang's avatar Jason Chang Committed by Automerger Merge Worker
Browse files

Remove redundant swipe down notification and one handed sub settings am: 1c310ef4

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/14797789

Change-Id: I1f9f15568537d75e49ad622564ed9f19060cf254
parents 9f69f473 1c310ef4
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -33,13 +33,6 @@
        settings:searchable="false"
        settings:controller="com.android.settings.gestures.SwipeToNotificationPreferenceController" />

    <Preference
        android:key="gesture_swipe_bottom_to_notification"
        android:title="@string/swipe_bottom_to_notifications_title"
        android:fragment="com.android.settings.gestures.SwipeBottomToNotificationSettings"
        settings:searchable="false"
        settings:controller="com.android.settings.gestures.SwipeBottomToNotificationPreferenceController" />

    <Preference
        android:key="gesture_double_tap_power_input_summary"
        android:title="@string/double_tap_power_for_camera_title"
+0 −38
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2020 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:title="@string/swipe_bottom_to_notifications_title">

    <com.android.settingslib.widget.LayoutPreference
        android:key="one_handed_header"
        android:layout="@layout/one_handed_header"
        android:persistent="false"
        android:selectable="false"
        settings:allowDividerBelow="false"
        settings:searchable="false"/>

    <SwitchPreference
        android:key="gesture_swipe_bottom_to_notification"
        android:title="@string/swipe_bottom_to_notifications_title"
        android:summary="@string/swipe_bottom_to_notifications_summary"
        settings:controller="com.android.settings.gestures.SwipeBottomToNotificationPreferenceController"
        settings:allowDividerAbove="true" />

</PreferenceScreen>
+0 −94
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settings.gestures;

import android.content.Context;
import android.net.Uri;

import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;

import com.android.settings.core.TogglePreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;

/**
 * The Controller to handle app taps to exit of one-handed mode
 */
public class OneHandedAppTapsExitPreferenceController extends TogglePreferenceController implements
        LifecycleObserver, OnStart, OnStop, OneHandedSettingsUtils.TogglesCallback {

    private final OneHandedSettingsUtils mUtils;

    private Preference mPreference;

    public OneHandedAppTapsExitPreferenceController(Context context, String key) {
        super(context, key);

        mUtils = new OneHandedSettingsUtils(context);

        // By default, app taps to stop one-handed is enabled, this will get default value once.
        OneHandedSettingsUtils.setTapsAppToExitEnabled(mContext, isChecked());
    }

    @Override
    public int getAvailabilityStatus() {
        return OneHandedSettingsUtils.isOneHandedModeEnabled(mContext)
                ? AVAILABLE : DISABLED_DEPENDENT_SETTING;
    }

    @Override
    public void displayPreference(PreferenceScreen screen) {
        super.displayPreference(screen);
        mPreference = screen.findPreference(getPreferenceKey());
    }

    @Override
    public void updateState(Preference preference) {
        super.updateState(preference);

        final int availabilityStatus = getAvailabilityStatus();
        preference.setEnabled(
                availabilityStatus == AVAILABLE || availabilityStatus == AVAILABLE_UNSEARCHABLE);
    }

    @Override
    public boolean setChecked(boolean isChecked) {
        return OneHandedSettingsUtils.setTapsAppToExitEnabled(mContext, isChecked);
    }

    @Override
    public boolean isChecked() {
        return OneHandedSettingsUtils.isTapsAppToExitEnabled(mContext);
    }

    @Override
    public void onStart() {
        mUtils.registerToggleAwareObserver(this);
    }

    @Override
    public void onStop() {
        mUtils.unregisterToggleAwareObserver();
    }

    @Override
    public void onChange(Uri uri) {
        updateState(mPreference);
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -32,8 +32,7 @@ public class OneHandedEnablePreferenceController extends SettingsMainSwitchPrefe

    @Override
    public int getAvailabilityStatus() {
        return OneHandedSettingsUtils.isFeatureAvailable(mContext)
                ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
        return AVAILABLE;
    }

    @Override
+0 −9
Original line number Diff line number Diff line
@@ -189,15 +189,6 @@ public class OneHandedSettingsUtils {
                Settings.Secure.NAVIGATION_MODE, 2 /* fully gestural */, sCurrentUserId);
    }

    /**
     *
     * @param context App context
     * @return Support One-Handed mode feature or not.
     */
    public static boolean isFeatureAvailable(Context context) {
        return isSupportOneHandedMode() && getNavigationBarMode(context) != 0;
    }

    /**
     * Registers callback for observing Settings.Secure.ONE_HANDED_MODE_ENABLED state.
     * @param callback for state changes
Loading