• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 enabling the new magnifier.
139      */
140     public static final String ENABLE_NEW_MAGNIFIER = "CursorControlFeature__enable_new_magnifier";
141 
142     /**
143      * The key name used in app core settings for {@link #ENABLE_NEW_MAGNIFIER}.
144      */
145     public static final String KEY_ENABLE_NEW_MAGNIFIER = "widget__enable_new_magnifier";
146 
147     /**
148      * Default value for the flag {@link #ENABLE_NEW_MAGNIFIER}.
149      */
150     public static final boolean ENABLE_NEW_MAGNIFIER_DEFAULT = false;
151 
152     /**
153      * The flag of zoom factor applies to the new magnifier.
154      */
155     public static final String MAGNIFIER_ZOOM_FACTOR =
156             "CursorControlFeature__magnifier_zoom_factor";
157 
158     /**
159      * The key name used in app core settings for {@link #MAGNIFIER_ZOOM_FACTOR}.
160      */
161     public static final String KEY_MAGNIFIER_ZOOM_FACTOR = "widget__magnifier_zoom_factor";
162 
163     /**
164      * Default value for the flag {@link #MAGNIFIER_ZOOM_FACTOR}.
165      */
166     public static final float MAGNIFIER_ZOOM_FACTOR_DEFAULT = 1.5f;
167 
168     /**
169      * The flag of aspect ratio (width/height) applies to the new magnifier.
170      */
171     public static final String MAGNIFIER_ASPECT_RATIO =
172             "CursorControlFeature__magnifier_aspect_ratio";
173 
174     /**
175      * The key name used in app core settings for {@link #MAGNIFIER_ASPECT_RATIO}.
176      */
177     public static final String KEY_MAGNIFIER_ASPECT_RATIO = "widget__magnifier_aspect_ratio";
178 
179     /**
180      * Default value for the flag {@link #MAGNIFIER_ASPECT_RATIO}.
181      */
182     public static final float MAGNIFIER_ASPECT_RATIO_DEFAULT = 5.5f;
183 
WidgetFlags()184     private WidgetFlags() {
185     }
186 }
187