blob: f3a5050001eadfa5c70f8d295e6404ca7c865de3 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 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
17package android.view;
18
Svetoslav Ganov54d068e2011-03-02 12:58:40 -080019import android.app.AppGlobals;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.Context;
Dianne Hackbornff801ec2011-01-22 18:05:38 -080021import android.content.res.Configuration;
Svetoslav Ganov54d068e2011-03-02 12:58:40 -080022import android.provider.Settings;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.util.DisplayMetrics;
24import android.util.SparseArray;
25
26/**
27 * Contains methods to standard constants used in the UI for timeouts, sizes, and distances.
28 */
29public class ViewConfiguration {
30 /**
Romain Guydbc26d22010-10-11 17:58:29 -070031 * Expected bit depth of the display panel.
32 *
33 * @hide
34 */
35 public static final float PANEL_BIT_DEPTH = 24;
36
37 /**
38 * Minimum alpha required for a view to draw.
39 *
40 * @hide
41 */
42 public static final float ALPHA_THRESHOLD = 0.5f / PANEL_BIT_DEPTH;
Romain Guy909cbaf2010-10-13 18:19:48 -070043 /**
44 * @hide
45 */
46 public static final float ALPHA_THRESHOLD_INT = 0x7f / PANEL_BIT_DEPTH;
47
Romain Guydbc26d22010-10-11 17:58:29 -070048 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049 * Defines the width of the horizontal scrollbar and the height of the vertical scrollbar in
50 * pixels
51 */
52 private static final int SCROLL_BAR_SIZE = 10;
53
54 /**
Mike Cleronf116bf82009-09-27 19:14:12 -070055 * Duration of the fade when scrollbars fade away in milliseconds
56 */
57 private static final int SCROLL_BAR_FADE_DURATION = 250;
58
59 /**
60 * Default delay before the scrollbars fade in milliseconds
61 */
62 private static final int SCROLL_BAR_DEFAULT_DELAY = 300;
63
64 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065 * Defines the length of the fading edges in pixels
66 */
67 private static final int FADING_EDGE_LENGTH = 12;
68
69 /**
70 * Defines the duration in milliseconds of the pressed state in child
71 * components.
72 */
Adam Powelle14579b2009-12-16 18:39:52 -080073 private static final int PRESSED_STATE_DURATION = 125;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074
75 /**
Jeff Browna4547672011-03-02 21:38:11 -080076 * Defines the default duration in milliseconds before a press turns into
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 * a long press
78 */
Jeff Browna4547672011-03-02 21:38:11 -080079 private static final int DEFAULT_LONG_PRESS_TIMEOUT = 500;
80
81 /**
82 * Defines the time between successive key repeats in milliseconds.
83 */
84 private static final int KEY_REPEAT_DELAY = 50;
85
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 /**
87 * Defines the duration in milliseconds a user needs to hold down the
88 * appropriate button to bring up the global actions dialog (power off,
89 * lock screen, etc).
90 */
91 private static final int GLOBAL_ACTIONS_KEY_TIMEOUT = 500;
92
93 /**
94 * Defines the duration in milliseconds we will wait to see if a touch event
95 * is a tap or a scroll. If the user does not move within this interval, it is
96 * considered to be a tap.
97 */
Patrick Dubroye0a799a2011-05-04 16:19:22 -070098 private static final int TAP_TIMEOUT = 180;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099
100 /**
101 * Defines the duration in milliseconds we will wait to see if a touch event
102 * is a jump tap. If the user does not complete the jump tap within this interval, it is
103 * considered to be a tap.
104 */
105 private static final int JUMP_TAP_TIMEOUT = 500;
106
107 /**
108 * Defines the duration in milliseconds between the first tap's up event and
109 * the second tap's down event for an interaction to be considered a
110 * double-tap.
111 */
112 private static final int DOUBLE_TAP_TIMEOUT = 300;
Jeff Brownbb3fcba0c2011-06-06 19:23:05 -0700113
114 /**
115 * Defines the maximum duration in milliseconds between a touch pad
116 * touch and release for a given touch to be considered a tap (click) as
117 * opposed to a hover movement gesture.
118 */
119 private static final int HOVER_TAP_TIMEOUT = 150;
120
121 /**
122 * Defines the maximum distance in pixels that a touch pad touch can move
123 * before being released for it to be considered a tap (click) as opposed
124 * to a hover movement gesture.
125 */
126 private static final int HOVER_TAP_SLOP = 20;
127
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800128 /**
129 * Defines the duration in milliseconds we want to display zoom controls in response
130 * to a user panning within an application.
131 */
132 private static final int ZOOM_CONTROLS_TIMEOUT = 3000;
133
134 /**
135 * Inset in pixels to look for touchable content when the user touches the edge of the screen
136 */
137 private static final int EDGE_SLOP = 12;
138
139 /**
140 * Distance a touch can wander before we think the user is scrolling in pixels
141 */
Dianne Hackborn3e2ac882009-09-25 01:34:28 -0700142 private static final int TOUCH_SLOP = 16;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143
144 /**
Adam Powellde8d0832010-03-09 17:11:30 -0800145 * Distance a touch can wander before we think the user is attempting a paged scroll
146 * (in dips)
147 */
Adam Powellb7ef1d92010-03-11 10:25:24 -0800148 private static final int PAGING_TOUCH_SLOP = TOUCH_SLOP * 2;
Adam Powellde8d0832010-03-09 17:11:30 -0800149
150 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800151 * Distance between the first touch and second touch to still be considered a double tap
152 */
153 private static final int DOUBLE_TAP_SLOP = 100;
154
155 /**
156 * Distance a touch needs to be outside of a window's bounds for it to
157 * count as outside for purposes of dismissing the window.
158 */
159 private static final int WINDOW_TOUCH_SLOP = 16;
160
161 /**
162 * Minimum velocity to initiate a fling, as measured in pixels per second
163 */
164 private static final int MINIMUM_FLING_VELOCITY = 50;
Romain Guy4296fc42009-07-06 11:48:52 -0700165
166 /**
167 * Maximum velocity to initiate a fling, as measured in pixels per second
168 */
Adam Powell637d3372010-08-25 14:37:03 -0700169 private static final int MAXIMUM_FLING_VELOCITY = 8000;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800170
171 /**
Svetoslav Ganov736c2752011-04-22 18:30:36 -0700172 * Distance between a touch up event denoting the end of a touch exploration
173 * gesture and the touch up event of a subsequent tap for the latter tap to be
174 * considered as a tap i.e. to perform a click.
175 */
176 private static final int TOUCH_EXPLORATION_TAP_SLOP = 80;
177
178 /**
Svetoslav Ganova0156172011-06-26 17:55:44 -0700179 * Delay before dispatching a recurring accessibility event in milliseconds.
180 * This delay guarantees that a recurring event will be send at most once
181 * during the {@link #SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS} time
182 * frame.
183 */
184 private static final long SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS = 400;
185
186 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800187 * The maximum size of View's drawing cache, expressed in bytes. This size
188 * should be at least equal to the size of the screen in ARGB888 format.
189 */
190 @Deprecated
Romain Guy0211a0a2011-02-14 16:34:59 -0800191 private static final int MAXIMUM_DRAWING_CACHE_SIZE = 480 * 800 * 4; // ARGB8888
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800192
193 /**
194 * The coefficient of friction applied to flings/scrolls.
195 */
Romain Guy0211a0a2011-02-14 16:34:59 -0800196 private static final float SCROLL_FRICTION = 0.015f;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800197
Adam Powell637d3372010-08-25 14:37:03 -0700198 /**
199 * Max distance to overscroll for edge effects
200 */
201 private static final int OVERSCROLL_DISTANCE = 0;
202
203 /**
204 * Max distance to overfling for edge effects
205 */
Gilles Debunne8ce7aab2011-01-25 11:23:30 -0800206 private static final int OVERFLING_DISTANCE = 6;
Adam Powell637d3372010-08-25 14:37:03 -0700207
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800208 private final int mEdgeSlop;
209 private final int mFadingEdgeLength;
210 private final int mMinimumFlingVelocity;
Romain Guy4296fc42009-07-06 11:48:52 -0700211 private final int mMaximumFlingVelocity;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800212 private final int mScrollbarSize;
213 private final int mTouchSlop;
Adam Powellde8d0832010-03-09 17:11:30 -0800214 private final int mPagingTouchSlop;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800215 private final int mDoubleTapSlop;
Svetoslav Ganov736c2752011-04-22 18:30:36 -0700216 private final int mScaledTouchExplorationTapSlop;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800217 private final int mWindowTouchSlop;
218 private final int mMaximumDrawingCacheSize;
Adam Powell637d3372010-08-25 14:37:03 -0700219 private final int mOverscrollDistance;
220 private final int mOverflingDistance;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800221
222 private static final SparseArray<ViewConfiguration> sConfigurations =
223 new SparseArray<ViewConfiguration>(2);
224
225 /**
226 * @deprecated Use {@link android.view.ViewConfiguration#get(android.content.Context)} instead.
227 */
228 @Deprecated
229 public ViewConfiguration() {
230 mEdgeSlop = EDGE_SLOP;
231 mFadingEdgeLength = FADING_EDGE_LENGTH;
232 mMinimumFlingVelocity = MINIMUM_FLING_VELOCITY;
Romain Guy4296fc42009-07-06 11:48:52 -0700233 mMaximumFlingVelocity = MAXIMUM_FLING_VELOCITY;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800234 mScrollbarSize = SCROLL_BAR_SIZE;
235 mTouchSlop = TOUCH_SLOP;
Adam Powellde8d0832010-03-09 17:11:30 -0800236 mPagingTouchSlop = PAGING_TOUCH_SLOP;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800237 mDoubleTapSlop = DOUBLE_TAP_SLOP;
Svetoslav Ganov736c2752011-04-22 18:30:36 -0700238 mScaledTouchExplorationTapSlop = TOUCH_EXPLORATION_TAP_SLOP;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800239 mWindowTouchSlop = WINDOW_TOUCH_SLOP;
240 //noinspection deprecation
241 mMaximumDrawingCacheSize = MAXIMUM_DRAWING_CACHE_SIZE;
Adam Powell637d3372010-08-25 14:37:03 -0700242 mOverscrollDistance = OVERSCROLL_DISTANCE;
243 mOverflingDistance = OVERFLING_DISTANCE;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800244 }
245
246 /**
247 * Creates a new configuration for the specified context. The configuration depends on
248 * various parameters of the context, like the dimension of the display or the density
249 * of the display.
250 *
251 * @param context The application context used to initialize this view configuration.
252 *
253 * @see #get(android.content.Context)
254 * @see android.util.DisplayMetrics
255 */
256 private ViewConfiguration(Context context) {
257 final DisplayMetrics metrics = context.getResources().getDisplayMetrics();
258 final float density = metrics.density;
Dianne Hackbornff801ec2011-01-22 18:05:38 -0800259 final float sizeAndDensity;
260 if (context.getResources().getConfiguration().isLayoutSizeAtLeast(
261 Configuration.SCREENLAYOUT_SIZE_XLARGE)) {
262 sizeAndDensity = density * 1.5f;
263 } else {
264 sizeAndDensity = density;
265 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800266
Dianne Hackbornff801ec2011-01-22 18:05:38 -0800267 mEdgeSlop = (int) (sizeAndDensity * EDGE_SLOP + 0.5f);
268 mFadingEdgeLength = (int) (sizeAndDensity * FADING_EDGE_LENGTH + 0.5f);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800269 mMinimumFlingVelocity = (int) (density * MINIMUM_FLING_VELOCITY + 0.5f);
Romain Guy4296fc42009-07-06 11:48:52 -0700270 mMaximumFlingVelocity = (int) (density * MAXIMUM_FLING_VELOCITY + 0.5f);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800271 mScrollbarSize = (int) (density * SCROLL_BAR_SIZE + 0.5f);
Dianne Hackbornff801ec2011-01-22 18:05:38 -0800272 mTouchSlop = (int) (sizeAndDensity * TOUCH_SLOP + 0.5f);
273 mPagingTouchSlop = (int) (sizeAndDensity * PAGING_TOUCH_SLOP + 0.5f);
274 mDoubleTapSlop = (int) (sizeAndDensity * DOUBLE_TAP_SLOP + 0.5f);
Svetoslav Ganov736c2752011-04-22 18:30:36 -0700275 mScaledTouchExplorationTapSlop = (int) (density * TOUCH_EXPLORATION_TAP_SLOP + 0.5f);
Dianne Hackbornff801ec2011-01-22 18:05:38 -0800276 mWindowTouchSlop = (int) (sizeAndDensity * WINDOW_TOUCH_SLOP + 0.5f);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800277
278 // Size of the screen in bytes, in ARGB_8888 format
279 mMaximumDrawingCacheSize = 4 * metrics.widthPixels * metrics.heightPixels;
Adam Powell637d3372010-08-25 14:37:03 -0700280
Dianne Hackbornff801ec2011-01-22 18:05:38 -0800281 mOverscrollDistance = (int) (sizeAndDensity * OVERSCROLL_DISTANCE + 0.5f);
282 mOverflingDistance = (int) (sizeAndDensity * OVERFLING_DISTANCE + 0.5f);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800283 }
284
285 /**
286 * Returns a configuration for the specified context. The configuration depends on
287 * various parameters of the context, like the dimension of the display or the
288 * density of the display.
289 *
290 * @param context The application context used to initialize the view configuration.
291 */
292 public static ViewConfiguration get(Context context) {
293 final DisplayMetrics metrics = context.getResources().getDisplayMetrics();
294 final int density = (int) (100.0f * metrics.density);
295
296 ViewConfiguration configuration = sConfigurations.get(density);
297 if (configuration == null) {
298 configuration = new ViewConfiguration(context);
299 sConfigurations.put(density, configuration);
300 }
301
302 return configuration;
303 }
304
305 /**
306 * @return The width of the horizontal scrollbar and the height of the vertical
307 * scrollbar in pixels
308 *
309 * @deprecated Use {@link #getScaledScrollBarSize()} instead.
310 */
311 @Deprecated
312 public static int getScrollBarSize() {
313 return SCROLL_BAR_SIZE;
314 }
315
316 /**
317 * @return The width of the horizontal scrollbar and the height of the vertical
318 * scrollbar in pixels
319 */
320 public int getScaledScrollBarSize() {
321 return mScrollbarSize;
322 }
323
324 /**
Mike Cleronf116bf82009-09-27 19:14:12 -0700325 * @return Duration of the fade when scrollbars fade away in milliseconds
326 */
327 public static int getScrollBarFadeDuration() {
328 return SCROLL_BAR_FADE_DURATION;
329 }
330
331 /**
332 * @return Default delay before the scrollbars fade in milliseconds
333 */
334 public static int getScrollDefaultDelay() {
335 return SCROLL_BAR_DEFAULT_DELAY;
336 }
337
338 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800339 * @return the length of the fading edges in pixels
340 *
341 * @deprecated Use {@link #getScaledFadingEdgeLength()} instead.
342 */
343 @Deprecated
344 public static int getFadingEdgeLength() {
345 return FADING_EDGE_LENGTH;
346 }
347
348 /**
349 * @return the length of the fading edges in pixels
350 */
351 public int getScaledFadingEdgeLength() {
352 return mFadingEdgeLength;
353 }
354
355 /**
356 * @return the duration in milliseconds of the pressed state in child
357 * components.
358 */
359 public static int getPressedStateDuration() {
360 return PRESSED_STATE_DURATION;
361 }
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800362
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 /**
364 * @return the duration in milliseconds before a press turns into
365 * a long press
366 */
367 public static int getLongPressTimeout() {
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800368 return AppGlobals.getIntCoreSetting(Settings.Secure.LONG_PRESS_TIMEOUT,
Jeff Browna4547672011-03-02 21:38:11 -0800369 DEFAULT_LONG_PRESS_TIMEOUT);
370 }
371
372 /**
373 * @return the time before the first key repeat in milliseconds.
374 */
375 public static int getKeyRepeatTimeout() {
376 return getLongPressTimeout();
377 }
378
379 /**
380 * @return the time between successive key repeats in milliseconds.
381 */
382 public static int getKeyRepeatDelay() {
383 return KEY_REPEAT_DELAY;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 }
Svetoslav Ganov54d068e2011-03-02 12:58:40 -0800385
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 /**
387 * @return the duration in milliseconds we will wait to see if a touch event
388 * is a tap or a scroll. If the user does not move within this interval, it is
389 * considered to be a tap.
390 */
391 public static int getTapTimeout() {
392 return TAP_TIMEOUT;
393 }
Jeff Brownbb3fcba0c2011-06-06 19:23:05 -0700394
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800395 /**
396 * @return the duration in milliseconds we will wait to see if a touch event
397 * is a jump tap. If the user does not move within this interval, it is
398 * considered to be a tap.
399 */
400 public static int getJumpTapTimeout() {
401 return JUMP_TAP_TIMEOUT;
402 }
403
404 /**
405 * @return the duration in milliseconds between the first tap's up event and
406 * the second tap's down event for an interaction to be considered a
407 * double-tap.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800408 */
409 public static int getDoubleTapTimeout() {
410 return DOUBLE_TAP_TIMEOUT;
411 }
Jeff Brownbb3fcba0c2011-06-06 19:23:05 -0700412
413 /**
414 * @return the maximum duration in milliseconds between a touch pad
415 * touch and release for a given touch to be considered a tap (click) as
416 * opposed to a hover movement gesture.
417 * @hide
418 */
419 public static int getHoverTapTimeout() {
420 return HOVER_TAP_TIMEOUT;
421 }
422
423 /**
424 * @return the maximum distance in pixels that a touch pad touch can move
425 * before being released for it to be considered a tap (click) as opposed
426 * to a hover movement gesture.
427 * @hide
428 */
429 public static int getHoverTapSlop() {
430 return HOVER_TAP_SLOP;
431 }
432
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800433 /**
434 * @return Inset in pixels to look for touchable content when the user touches the edge of the
435 * screen
436 *
437 * @deprecated Use {@link #getScaledEdgeSlop()} instead.
438 */
439 @Deprecated
440 public static int getEdgeSlop() {
441 return EDGE_SLOP;
442 }
443
444 /**
445 * @return Inset in pixels to look for touchable content when the user touches the edge of the
446 * screen
447 */
448 public int getScaledEdgeSlop() {
449 return mEdgeSlop;
450 }
451
452 /**
453 * @return Distance a touch can wander before we think the user is scrolling in pixels
454 *
455 * @deprecated Use {@link #getScaledTouchSlop()} instead.
456 */
457 @Deprecated
458 public static int getTouchSlop() {
459 return TOUCH_SLOP;
460 }
461
462 /**
463 * @return Distance a touch can wander before we think the user is scrolling in pixels
464 */
465 public int getScaledTouchSlop() {
466 return mTouchSlop;
467 }
Adam Powellde8d0832010-03-09 17:11:30 -0800468
469 /**
470 * @return Distance a touch can wander before we think the user is scrolling a full page
471 * in dips
472 */
473 public int getScaledPagingTouchSlop() {
474 return mPagingTouchSlop;
475 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800476
477 /**
478 * @return Distance between the first touch and second touch to still be
479 * considered a double tap
480 * @deprecated Use {@link #getScaledDoubleTapSlop()} instead.
481 * @hide The only client of this should be GestureDetector, which needs this
482 * for clients that still use its deprecated constructor.
483 */
484 @Deprecated
485 public static int getDoubleTapSlop() {
486 return DOUBLE_TAP_SLOP;
487 }
488
489 /**
490 * @return Distance between the first touch and second touch to still be
491 * considered a double tap
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800492 */
493 public int getScaledDoubleTapSlop() {
494 return mDoubleTapSlop;
495 }
496
497 /**
Svetoslav Ganov736c2752011-04-22 18:30:36 -0700498 * @return Distance between a touch up event denoting the end of a touch exploration
499 * gesture and the touch up event of a subsequent tap for the latter tap to be
500 * considered as a tap i.e. to perform a click.
501 *
502 * @hide
503 */
504 public int getScaledTouchExplorationTapSlop() {
505 return mScaledTouchExplorationTapSlop;
506 }
507
508 /**
Svetoslav Ganova0156172011-06-26 17:55:44 -0700509 * Interval for dispatching a recurring accessibility event in milliseconds.
510 * This interval guarantees that a recurring event will be send at most once
511 * during the {@link #getSendRecurringAccessibilityEventsInterval()} time frame.
512 *
513 * @return The delay in milliseconds.
514 *
515 * @hide
516 */
517 public static long getSendRecurringAccessibilityEventsInterval() {
518 return SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS;
519 }
520
521 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800522 * @return Distance a touch must be outside the bounds of a window for it
523 * to be counted as outside the window for purposes of dismissing that
524 * window.
525 *
526 * @deprecated Use {@link #getScaledWindowTouchSlop()} instead.
527 */
528 @Deprecated
529 public static int getWindowTouchSlop() {
530 return WINDOW_TOUCH_SLOP;
531 }
532
533 /**
534 * @return Distance a touch must be outside the bounds of a window for it
535 * to be counted as outside the window for purposes of dismissing that
536 * window.
537 */
538 public int getScaledWindowTouchSlop() {
539 return mWindowTouchSlop;
540 }
541
542 /**
543 * @return Minimum velocity to initiate a fling, as measured in pixels per second.
544 *
545 * @deprecated Use {@link #getScaledMinimumFlingVelocity()} instead.
546 */
547 @Deprecated
548 public static int getMinimumFlingVelocity() {
549 return MINIMUM_FLING_VELOCITY;
550 }
551
552 /**
553 * @return Minimum velocity to initiate a fling, as measured in pixels per second.
554 */
555 public int getScaledMinimumFlingVelocity() {
556 return mMinimumFlingVelocity;
557 }
558
559 /**
Romain Guy4296fc42009-07-06 11:48:52 -0700560 * @return Maximum velocity to initiate a fling, as measured in pixels per second.
561 *
562 * @deprecated Use {@link #getScaledMaximumFlingVelocity()} instead.
563 */
564 @Deprecated
565 public static int getMaximumFlingVelocity() {
566 return MAXIMUM_FLING_VELOCITY;
567 }
568
569 /**
570 * @return Maximum velocity to initiate a fling, as measured in pixels per second.
571 */
572 public int getScaledMaximumFlingVelocity() {
573 return mMaximumFlingVelocity;
574 }
575
576 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800577 * The maximum drawing cache size expressed in bytes.
578 *
579 * @return the maximum size of View's drawing cache expressed in bytes
580 *
581 * @deprecated Use {@link #getScaledMaximumDrawingCacheSize()} instead.
582 */
583 @Deprecated
584 public static int getMaximumDrawingCacheSize() {
585 //noinspection deprecation
586 return MAXIMUM_DRAWING_CACHE_SIZE;
587 }
588
589 /**
590 * The maximum drawing cache size expressed in bytes.
591 *
592 * @return the maximum size of View's drawing cache expressed in bytes
593 */
594 public int getScaledMaximumDrawingCacheSize() {
595 return mMaximumDrawingCacheSize;
596 }
597
598 /**
Adam Powell637d3372010-08-25 14:37:03 -0700599 * @return The maximum distance a View should overscroll by when showing edge effects.
600 */
601 public int getScaledOverscrollDistance() {
602 return mOverscrollDistance;
603 }
604
605 /**
606 * @return The maximum distance a View should overfling by when showing edge effects.
607 */
608 public int getScaledOverflingDistance() {
609 return mOverflingDistance;
610 }
611
612 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800613 * The amount of time that the zoom controls should be
614 * displayed on the screen expressed in milliseconds.
615 *
616 * @return the time the zoom controls should be visible expressed
617 * in milliseconds.
618 */
619 public static long getZoomControlsTimeout() {
620 return ZOOM_CONTROLS_TIMEOUT;
621 }
622
623 /**
624 * The amount of time a user needs to press the relevant key to bring up
625 * the global actions dialog.
626 *
627 * @return how long a user needs to press the relevant key to bring up
628 * the global actions dialog.
629 */
630 public static long getGlobalActionKeyTimeout() {
631 return GLOBAL_ACTIONS_KEY_TIMEOUT;
632 }
633
634 /**
635 * The amount of friction applied to scrolls and flings.
636 *
637 * @return A scalar dimensionless value representing the coefficient of
638 * friction.
639 */
640 public static float getScrollFriction() {
641 return SCROLL_FRICTION;
642 }
643}