Loading res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -10887,6 +10887,11 @@ <!-- Preference and settings suggestion title text for ambient display double tap (device) [CHAR LIMIT=60]--> <string name="ambient_display_title" product="device">Double-tap to check device</string> <!-- Do not translate. Title text for swiping downwards on the bottom of the screen for notifications [CHAR LIMIT=25]--> <string name="swipe_bottom_to_notifications_title" translatable="false">Swipe for notifications</string> <!-- Do not translate. Summary text for swiping downwards on the bottom of the screen for notifications [CHAR LIMIT=80]--> <string name="swipe_bottom_to_notifications_summary" translatable="false">Swipe down on the bottom of the screen to check the notification</string> <!-- Preference and settings suggestion title text for one handed [CHAR LIMIT=60] --> <string name="one_handed_title">One-Handed mode</string> <!-- Preference Switch for enabling one handed [CHAR LIMIT=60] --> res/xml/gestures.xml +7 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,13 @@ 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" Loading res/xml/swipe_bottom_to_notification_settings.xml 0 → 100644 +36 −0 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.settings.widget.VideoPreference android:title="@string/swipe_bottom_to_notifications_title" settings:animation="@raw/gesture_fingerprint_swipe" settings:preview="@drawable/gesture_fingerprint_swipe" settings:controller="com.android.settings.widget.VideoPreferenceController"/> <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> src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceController.java 0 → 100644 +89 −0 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 static android.provider.Settings.Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED; import static com.android.settings.gestures.OneHandedEnablePreferenceController.SUPPORT_ONE_HANDED_MODE; import android.content.Context; import android.os.SystemProperties; import android.provider.Settings; import android.text.TextUtils; import com.android.settings.R; import com.android.settings.core.TogglePreferenceController; /** * Handles swipe bottom to expand notification panel gesture. **/ public class SwipeBottomToNotificationPreferenceController extends TogglePreferenceController { private static final int ON = 1; private static final int OFF = 0; private static final String PREF_KEY = "gesture_swipe_bottom_to_notification"; public SwipeBottomToNotificationPreferenceController(Context context, String key) { super(context, key); } /** Indicates whether the gesture is available or not. */ public static boolean isGestureAvailable(Context context) { // Disable the gesture once One-Handed mode gesture enabled. if (SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false)) { return !OneHandedSettingsUtils.isOneHandedModeEnabled(context); } return true; } @Override public int getAvailabilityStatus() { return isGestureAvailable(mContext) ? AVAILABLE : DISABLED_DEPENDENT_SETTING; } @Override public boolean isSliceable() { return TextUtils.equals(getPreferenceKey(), PREF_KEY); } @Override public boolean isPublicSlice() { return true; } @Override public boolean setChecked(boolean isChecked) { Settings.Secure.putInt(mContext.getContentResolver(), SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, isChecked ? ON : OFF); return true; } @Override public boolean isChecked() { return Settings.Secure.getInt(mContext.getContentResolver(), SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, OFF) == ON; } @Override public CharSequence getSummary() { // This toggle preference summary will be updated in gesture preference page since we bound // it with entry preference in gesture.xml return mContext.getText( isChecked() ? R.string.gesture_setting_on : R.string.gesture_setting_off); } } src/com/android/settings/gestures/SwipeBottomToNotificationSettings.java 0 → 100644 +57 −0 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.app.settings.SettingsEnums; import android.content.Context; import com.android.settings.R; import com.android.settings.dashboard.DashboardFragment; import com.android.settings.search.BaseSearchIndexProvider; /** * The Fragment for swipe bottom to notification gesture settings. */ public class SwipeBottomToNotificationSettings extends DashboardFragment { private static final String TAG = "SwipeBottomToNotificationSettings"; @Override public int getMetricsCategory() { return SettingsEnums.SETTINGS_SWIPE_BOTTOM_TO_NOTIFICATION; } @Override protected String getLogTag() { return TAG; } @Override protected int getPreferenceScreenResId() { return R.xml.swipe_bottom_to_notification_settings; } public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = new BaseSearchIndexProvider(R.xml.swipe_bottom_to_notification_settings) { @Override protected boolean isPageSearchEnabled(Context context) { return SwipeBottomToNotificationPreferenceController .isGestureAvailable(context); } }; } Loading
res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -10887,6 +10887,11 @@ <!-- Preference and settings suggestion title text for ambient display double tap (device) [CHAR LIMIT=60]--> <string name="ambient_display_title" product="device">Double-tap to check device</string> <!-- Do not translate. Title text for swiping downwards on the bottom of the screen for notifications [CHAR LIMIT=25]--> <string name="swipe_bottom_to_notifications_title" translatable="false">Swipe for notifications</string> <!-- Do not translate. Summary text for swiping downwards on the bottom of the screen for notifications [CHAR LIMIT=80]--> <string name="swipe_bottom_to_notifications_summary" translatable="false">Swipe down on the bottom of the screen to check the notification</string> <!-- Preference and settings suggestion title text for one handed [CHAR LIMIT=60] --> <string name="one_handed_title">One-Handed mode</string> <!-- Preference Switch for enabling one handed [CHAR LIMIT=60] -->
res/xml/gestures.xml +7 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,13 @@ 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" Loading
res/xml/swipe_bottom_to_notification_settings.xml 0 → 100644 +36 −0 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.settings.widget.VideoPreference android:title="@string/swipe_bottom_to_notifications_title" settings:animation="@raw/gesture_fingerprint_swipe" settings:preview="@drawable/gesture_fingerprint_swipe" settings:controller="com.android.settings.widget.VideoPreferenceController"/> <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>
src/com/android/settings/gestures/SwipeBottomToNotificationPreferenceController.java 0 → 100644 +89 −0 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 static android.provider.Settings.Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED; import static com.android.settings.gestures.OneHandedEnablePreferenceController.SUPPORT_ONE_HANDED_MODE; import android.content.Context; import android.os.SystemProperties; import android.provider.Settings; import android.text.TextUtils; import com.android.settings.R; import com.android.settings.core.TogglePreferenceController; /** * Handles swipe bottom to expand notification panel gesture. **/ public class SwipeBottomToNotificationPreferenceController extends TogglePreferenceController { private static final int ON = 1; private static final int OFF = 0; private static final String PREF_KEY = "gesture_swipe_bottom_to_notification"; public SwipeBottomToNotificationPreferenceController(Context context, String key) { super(context, key); } /** Indicates whether the gesture is available or not. */ public static boolean isGestureAvailable(Context context) { // Disable the gesture once One-Handed mode gesture enabled. if (SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false)) { return !OneHandedSettingsUtils.isOneHandedModeEnabled(context); } return true; } @Override public int getAvailabilityStatus() { return isGestureAvailable(mContext) ? AVAILABLE : DISABLED_DEPENDENT_SETTING; } @Override public boolean isSliceable() { return TextUtils.equals(getPreferenceKey(), PREF_KEY); } @Override public boolean isPublicSlice() { return true; } @Override public boolean setChecked(boolean isChecked) { Settings.Secure.putInt(mContext.getContentResolver(), SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, isChecked ? ON : OFF); return true; } @Override public boolean isChecked() { return Settings.Secure.getInt(mContext.getContentResolver(), SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, OFF) == ON; } @Override public CharSequence getSummary() { // This toggle preference summary will be updated in gesture preference page since we bound // it with entry preference in gesture.xml return mContext.getText( isChecked() ? R.string.gesture_setting_on : R.string.gesture_setting_off); } }
src/com/android/settings/gestures/SwipeBottomToNotificationSettings.java 0 → 100644 +57 −0 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.app.settings.SettingsEnums; import android.content.Context; import com.android.settings.R; import com.android.settings.dashboard.DashboardFragment; import com.android.settings.search.BaseSearchIndexProvider; /** * The Fragment for swipe bottom to notification gesture settings. */ public class SwipeBottomToNotificationSettings extends DashboardFragment { private static final String TAG = "SwipeBottomToNotificationSettings"; @Override public int getMetricsCategory() { return SettingsEnums.SETTINGS_SWIPE_BOTTOM_TO_NOTIFICATION; } @Override protected String getLogTag() { return TAG; } @Override protected int getPreferenceScreenResId() { return R.xml.swipe_bottom_to_notification_settings; } public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = new BaseSearchIndexProvider(R.xml.swipe_bottom_to_notification_settings) { @Override protected boolean isPageSearchEnabled(Context context) { return SwipeBottomToNotificationPreferenceController .isGestureAvailable(context); } }; }