| 1 | /* |
| 2 | Copyright (C) 2019 The Android Open Source Project |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.widget; |
| 18 | |
| 19 | /** |
| 20 | * Flags in the {@link android.provider.DeviceConfig#NAMESPACE_WIDGET "widget" namespace}. |
| 21 | * |
| 22 | * @hide |
| 23 | */ |
| 24 | public final class WidgetFlags { |
| 25 | |
| 26 | /** |
| 27 | * Whether starting a cursor drag from anywhere in the text should be enabled. |
| 28 | */ |
| 29 | public static final String ENABLE_CURSOR_DRAG_FROM_ANYWHERE = |
| 30 | "CursorControlFeature__enable_cursor_drag_from_anywhere"; |
| 31 | |
| 32 | /** |
| 33 | * The key used in app core settings for the flag {@link #ENABLE_CURSOR_DRAG_FROM_ANYWHERE}. |
| 34 | */ |
| 35 | public static final String KEY_ENABLE_CURSOR_DRAG_FROM_ANYWHERE = |
| 36 | "widget__enable_cursor_drag_from_anywhere"; |
| 37 | |
| 38 | /** |
| 39 | * Default value for the flag {@link #ENABLE_CURSOR_DRAG_FROM_ANYWHERE}. |
| 40 | */ |
| 41 | public static final boolean ENABLE_CURSOR_DRAG_FROM_ANYWHERE_DEFAULT = true; |
| 42 | |
| 43 | /** |
| 44 | * Threshold for the direction of a swipe gesture in order for it to be handled as a cursor drag |
| 45 | * rather than a scroll. The direction angle of the swipe gesture must exceed this value in |
| 46 | * order to trigger cursor drag; otherwise, the swipe will be assumed to be a scroll gesture. |
| 47 | * The value units for this flag is degrees and the valid range is [0,90] inclusive. If a value |
| 48 | * < 0 is set, 0 will be used instead; if a value > 90 is set, 90 will be used instead. |
| 49 | */ |
| 50 | public static final String CURSOR_DRAG_MIN_ANGLE_FROM_VERTICAL = |
| 51 | "CursorControlFeature__min_angle_from_vertical_to_start_cursor_drag"; |
| 52 | |
| 53 | /** |
| 54 | * The key used in app core settings for the flag |
| 55 | * {@link #CURSOR_DRAG_MIN_ANGLE_FROM_VERTICAL}. |
| 56 | */ |
| 57 | public static final String KEY_CURSOR_DRAG_MIN_ANGLE_FROM_VERTICAL = |
| 58 | "widget__min_angle_from_vertical_to_start_cursor_drag"; |
| 59 | |
| 60 | /** |
| 61 | * Default value for the flag {@link #CURSOR_DRAG_MIN_ANGLE_FROM_VERTICAL}. |
| 62 | */ |
| 63 | public static final int CURSOR_DRAG_MIN_ANGLE_FROM_VERTICAL_DEFAULT = 45; |
| 64 | |
| 65 | /** |
| 66 | * The flag of finger-to-cursor distance in DP for cursor dragging. |
| 67 | * The value unit is DP and the range is {0..100}. If the value is out of range, the legacy |
| 68 | * value, which is based on handle size, will be used. |
| 69 | */ |
| 70 | public static final String FINGER_TO_CURSOR_DISTANCE = |
| 71 | "CursorControlFeature__finger_to_cursor_distance"; |
| 72 | |
| 73 | /** |
| 74 | * The key used in app core settings for the flag {@link #FINGER_TO_CURSOR_DISTANCE}. |
| 75 | */ |
| 76 | public static final String KEY_FINGER_TO_CURSOR_DISTANCE = |
| 77 | "widget__finger_to_cursor_distance"; |
| 78 | |
| 79 | /** |
| 80 | * Default value for the flag {@link #FINGER_TO_CURSOR_DISTANCE}. |
| 81 | */ |
| 82 | public static final int FINGER_TO_CURSOR_DISTANCE_DEFAULT = -1; |
| 83 | |
| 84 | /** |
| 85 | * Whether additional gestures should be enabled for the insertion cursor handle (e.g. |
| 86 | * long-press or double-tap on the handle to trigger selection). |
| 87 | */ |
| 88 | public static final String ENABLE_INSERTION_HANDLE_GESTURES = |
| 89 | "CursorControlFeature__enable_insertion_handle_gestures"; |
| 90 | |
| 91 | /** |
| 92 | * The key used in app core settings for the flag {@link #ENABLE_INSERTION_HANDLE_GESTURES}. |
| 93 | */ |
| 94 | public static final String KEY_ENABLE_INSERTION_HANDLE_GESTURES = |
| 95 | "widget__enable_insertion_handle_gestures"; |
| 96 | |
| 97 | /** |
| 98 | * Default value for the flag {@link #ENABLE_INSERTION_HANDLE_GESTURES}. |
| 99 | */ |
| 100 | public static final boolean ENABLE_INSERTION_HANDLE_GESTURES_DEFAULT = false; |
| 101 | |
| 102 | /** |
| 103 | * The flag of delta height applies to the insertion handle when cursor control flag is enabled. |
| 104 | */ |
| 105 | public static final String INSERTION_HANDLE_DELTA_HEIGHT = |
| 106 | "CursorControlFeature__insertion_handle_delta_height"; |
| 107 | |
| 108 | /** |
| 109 | * The key name used in app core settings for {@link #INSERTION_HANDLE_DELTA_HEIGHT}. |
| 110 | */ |
| 111 | public static final String KEY_INSERTION_HANDLE_DELTA_HEIGHT = |
| 112 | "widget__insertion_handle_delta_height"; |
| 113 | |
| 114 | /** |
| 115 | * Default value for the flag {@link #INSERTION_HANDLE_DELTA_HEIGHT}. |
| 116 | */ |
| 117 | public static final int INSERTION_HANDLE_DELTA_HEIGHT_DEFAULT = 25; |
| 118 | |
| 119 | /** |
| 120 | * The flag of opacity applies to the insertion handle when cursor control flag is enabled. |
| 121 | * The opacity value is in the range of {0..100}. |
| 122 | */ |
| 123 | public static final String INSERTION_HANDLE_OPACITY = |
| 124 | "CursorControlFeature__insertion_handle_opacity"; |
| 125 | |
| 126 | /** |
| 127 | * The key name used in app core settings for {@link #INSERTION_HANDLE_OPACITY}. |
| 128 | */ |
| 129 | public static final String KEY_INSERTION_HANDLE_OPACITY = |
| 130 | "widget__insertion_handle_opacity"; |
| 131 | |
| 132 | /** |
| 133 | * Default value for the flag {@link #INSERTION_HANDLE_OPACITY}. |
| 134 | */ |
| 135 | public static final int INSERTION_HANDLE_OPACITY_DEFAULT = 50; |
| 136 | |
| 137 | /** |
| 138 | * The flag of line slop ratio applies to cursor movement. |
| 139 | * Note: the actual slop value is bound: lineHeight + slop within the range of {8dp..45dp}. |
| 140 | */ |
| 141 | public static final String LINE_SLOP_RATIO = |
| 142 | "CursorControlFeature__line_slop_ratio"; |
| 143 | |
| 144 | /** |
| 145 | * The key name used in app core settings for {@link #LINE_SLOP_RATIO}. |
| 146 | */ |
| 147 | public static final String KEY_LINE_SLOP_RATIO = |
| 148 | "widget__line_slop_ratio"; |
| 149 | |
| 150 | /** |
| 151 | * Default value for the flag {@link #LINE_SLOP_RATIO}. |
| 152 | */ |
| 153 | public static final float LINE_SLOP_RATIO_DEFAULT = .5f; |
| 154 | |
| 155 | /** |
| 156 | * The flag of enabling the new magnifier. |
| 157 | */ |
| 158 | public static final String ENABLE_NEW_MAGNIFIER = "CursorControlFeature__enable_new_magnifier"; |
| 159 | |
| 160 | /** |
| 161 | * The key name used in app core settings for {@link #ENABLE_NEW_MAGNIFIER}. |
| 162 | */ |
| 163 | public static final String KEY_ENABLE_NEW_MAGNIFIER = "widget__enable_new_magnifier"; |
| 164 | |
| 165 | /** |
| 166 | * Default value for the flag {@link #ENABLE_NEW_MAGNIFIER}. |
| 167 | */ |
| 168 | public static final boolean ENABLE_NEW_MAGNIFIER_DEFAULT = false; |
| 169 | |
| 170 | /** |
| 171 | * The flag of zoom factor applies to the new magnifier. |
| 172 | */ |
| 173 | public static final String MAGNIFIER_ZOOM_FACTOR = |
| 174 | "CursorControlFeature__magnifier_zoom_factor"; |
| 175 | |
| 176 | /** |
| 177 | * The key name used in app core settings for {@link #MAGNIFIER_ZOOM_FACTOR}. |
| 178 | */ |
| 179 | public static final String KEY_MAGNIFIER_ZOOM_FACTOR = "widget__magnifier_zoom_factor"; |
| 180 | |
| 181 | /** |
| 182 | * Default value for the flag {@link #MAGNIFIER_ZOOM_FACTOR}. |
| 183 | */ |
| 184 | public static final float MAGNIFIER_ZOOM_FACTOR_DEFAULT = 1.5f; |
| 185 | |
| 186 | /** |
| 187 | * The flag of aspect ratio (width/height) applies to the new magnifier. |
| 188 | */ |
| 189 | public static final String MAGNIFIER_ASPECT_RATIO = |
| 190 | "CursorControlFeature__magnifier_aspect_ratio"; |
| 191 | |
| 192 | /** |
| 193 | * The key name used in app core settings for {@link #MAGNIFIER_ASPECT_RATIO}. |
| 194 | */ |
| 195 | public static final String KEY_MAGNIFIER_ASPECT_RATIO = "widget__magnifier_aspect_ratio"; |
| 196 | |
| 197 | /** |
| 198 | * Default value for the flag {@link #MAGNIFIER_ASPECT_RATIO}. |
| 199 | */ |
| 200 | public static final float MAGNIFIER_ASPECT_RATIO_DEFAULT = 5.5f; |
| 201 | |
| 202 | /** The flag of the fps of the analog clock seconds hand. */ |
| 203 | public static final String ANALOG_CLOCK_SECONDS_HAND_FPS = |
| 204 | "AnalogClockFeature__analog_clock_seconds_hand_fps"; |
| 205 | |
| 206 | /** The key name used in app core settings for {@link #ANALOG_CLOCK_SECONDS_HAND_FPS}. */ |
| 207 | public static final String KEY_ANALOG_CLOCK_SECONDS_HAND_FPS = |
| 208 | "widget__analog_clock_seconds_hand_fps"; |
| 209 | |
| 210 | private WidgetFlags() { |
| 211 | } |
| 212 | } |