ViewCompat.java revision 12ba769d9e9b121829c69daf0f6350e808028a6a
1/*
2 * Copyright (C) 2011 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.support.v4.view;
18
19import android.graphics.Paint;
20import android.graphics.PixelFormat;
21import android.graphics.Rect;
22import android.graphics.drawable.Drawable;
23import android.os.Bundle;
24import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
25import android.support.v4.view.accessibility.AccessibilityNodeProviderCompat;
26import android.view.View;
27import android.view.ViewParent;
28import android.view.accessibility.AccessibilityEvent;
29
30/**
31 * Helper for accessing features in {@link View} introduced after API
32 * level 4 in a backwards compatible fashion.
33 */
34public class ViewCompat {
35    /**
36     * Always allow a user to over-scroll this view, provided it is a
37     * view that can scroll.
38     */
39    public static final int OVER_SCROLL_ALWAYS = 0;
40
41    /**
42     * Allow a user to over-scroll this view only if the content is large
43     * enough to meaningfully scroll, provided it is a view that can scroll.
44     */
45    public static final int OVER_SCROLL_IF_CONTENT_SCROLLS = 1;
46
47    /**
48     * Never allow a user to over-scroll this view.
49     */
50    public static final int OVER_SCROLL_NEVER = 2;
51
52    private static final long FAKE_FRAME_TIME = 10;
53
54    /**
55     * Automatically determine whether a view is important for accessibility.
56     */
57    public static final int IMPORTANT_FOR_ACCESSIBILITY_AUTO = 0x00000000;
58
59    /**
60     * The view is important for accessibility.
61     */
62    public static final int IMPORTANT_FOR_ACCESSIBILITY_YES = 0x00000001;
63
64    /**
65     * The view is not important for accessibility.
66     */
67    public static final int IMPORTANT_FOR_ACCESSIBILITY_NO = 0x00000002;
68
69    /**
70     * The view is not important for accessibility, nor are any of its
71     * descendant views.
72     */
73    public static final int IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS = 0x00000004;
74
75    /**
76     * Live region mode specifying that accessibility services should not
77     * automatically announce changes to this view. This is the default live
78     * region mode for most views.
79     * <p>
80     * Use with {@link ViewCompat#setAccessibilityLiveRegion(View, int)}.
81     */
82    public static final int ACCESSIBILITY_LIVE_REGION_NONE = 0x00000000;
83
84    /**
85     * Live region mode specifying that accessibility services should announce
86     * changes to this view.
87     * <p>
88     * Use with {@link ViewCompat#setAccessibilityLiveRegion(View, int)}.
89     */
90    public static final int ACCESSIBILITY_LIVE_REGION_POLITE = 0x00000001;
91
92    /**
93     * Live region mode specifying that accessibility services should interrupt
94     * ongoing speech to immediately announce changes to this view.
95     * <p>
96     * Use with {@link ViewCompat#setAccessibilityLiveRegion(View, int)}.
97     */
98    public static final int ACCESSIBILITY_LIVE_REGION_ASSERTIVE = 0x00000002;
99
100    /**
101     * Indicates that the view does not have a layer.
102     */
103    public static final int LAYER_TYPE_NONE = 0;
104
105    /**
106     * <p>Indicates that the view has a software layer. A software layer is backed
107     * by a bitmap and causes the view to be rendered using Android's software
108     * rendering pipeline, even if hardware acceleration is enabled.</p>
109     *
110     * <p>Software layers have various usages:</p>
111     * <p>When the application is not using hardware acceleration, a software layer
112     * is useful to apply a specific color filter and/or blending mode and/or
113     * translucency to a view and all its children.</p>
114     * <p>When the application is using hardware acceleration, a software layer
115     * is useful to render drawing primitives not supported by the hardware
116     * accelerated pipeline. It can also be used to cache a complex view tree
117     * into a texture and reduce the complexity of drawing operations. For instance,
118     * when animating a complex view tree with a translation, a software layer can
119     * be used to render the view tree only once.</p>
120     * <p>Software layers should be avoided when the affected view tree updates
121     * often. Every update will require to re-render the software layer, which can
122     * potentially be slow (particularly when hardware acceleration is turned on
123     * since the layer will have to be uploaded into a hardware texture after every
124     * update.)</p>
125     */
126    public static final int LAYER_TYPE_SOFTWARE = 1;
127
128    /**
129     * <p>Indicates that the view has a hardware layer. A hardware layer is backed
130     * by a hardware specific texture (generally Frame Buffer Objects or FBO on
131     * OpenGL hardware) and causes the view to be rendered using Android's hardware
132     * rendering pipeline, but only if hardware acceleration is turned on for the
133     * view hierarchy. When hardware acceleration is turned off, hardware layers
134     * behave exactly as {@link #LAYER_TYPE_SOFTWARE software layers}.</p>
135     *
136     * <p>A hardware layer is useful to apply a specific color filter and/or
137     * blending mode and/or translucency to a view and all its children.</p>
138     * <p>A hardware layer can be used to cache a complex view tree into a
139     * texture and reduce the complexity of drawing operations. For instance,
140     * when animating a complex view tree with a translation, a hardware layer can
141     * be used to render the view tree only once.</p>
142     * <p>A hardware layer can also be used to increase the rendering quality when
143     * rotation transformations are applied on a view. It can also be used to
144     * prevent potential clipping issues when applying 3D transforms on a view.</p>
145     */
146    public static final int LAYER_TYPE_HARDWARE = 2;
147
148    /**
149     * Horizontal layout direction of this view is from Left to Right.
150     */
151    public static final int LAYOUT_DIRECTION_LTR = 0;
152
153    /**
154     * Horizontal layout direction of this view is from Right to Left.
155     */
156    public static final int LAYOUT_DIRECTION_RTL = 1;
157
158    /**
159     * Horizontal layout direction of this view is inherited from its parent.
160     * Use with {@link #setLayoutDirection}.
161     */
162    public static final int LAYOUT_DIRECTION_INHERIT = 2;
163
164    /**
165     * Horizontal layout direction of this view is from deduced from the default language
166     * script for the locale. Use with {@link #setLayoutDirection}.
167     */
168    public static final int LAYOUT_DIRECTION_LOCALE = 3;
169
170    /**
171     * Bits of {@link #getMeasuredWidthAndState} and
172     * {@link #getMeasuredWidthAndState} that provide the actual measured size.
173     */
174    public static final int MEASURED_SIZE_MASK = 0x00ffffff;
175
176    /**
177     * Bits of {@link #getMeasuredWidthAndState} and
178     * {@link #getMeasuredWidthAndState} that provide the additional state bits.
179     */
180    public static final int MEASURED_STATE_MASK = 0xff000000;
181
182    /**
183     * Bit shift of {@link #MEASURED_STATE_MASK} to get to the height bits
184     * for functions that combine both width and height into a single int,
185     * such as {@link #getMeasuredState} and the childState argument of
186     * {@link #resolveSizeAndState(int, int, int)}.
187     */
188    public static final int MEASURED_HEIGHT_STATE_SHIFT = 16;
189
190    /**
191     * Bit of {@link #getMeasuredWidthAndState} and
192     * {@link #getMeasuredWidthAndState} that indicates the measured size
193     * is smaller that the space the view would like to have.
194     */
195    public static final int MEASURED_STATE_TOO_SMALL = 0x01000000;
196
197    interface ViewCompatImpl {
198        public boolean canScrollHorizontally(View v, int direction);
199        public boolean canScrollVertically(View v, int direction);
200        public int getOverScrollMode(View v);
201        public void setOverScrollMode(View v, int mode);
202        public void onInitializeAccessibilityEvent(View v, AccessibilityEvent event);
203        public void onPopulateAccessibilityEvent(View v, AccessibilityEvent event);
204        public void onInitializeAccessibilityNodeInfo(View v, AccessibilityNodeInfoCompat info);
205        public void setAccessibilityDelegate(View v, AccessibilityDelegateCompat delegate);
206        public boolean hasTransientState(View view);
207        public void setHasTransientState(View view, boolean hasTransientState);
208        public void postInvalidateOnAnimation(View view);
209        public void postInvalidateOnAnimation(View view, int left, int top, int right, int bottom);
210        public void postOnAnimation(View view, Runnable action);
211        public void postOnAnimationDelayed(View view, Runnable action, long delayMillis);
212        public int getImportantForAccessibility(View view);
213        public void setImportantForAccessibility(View view, int mode);
214        public boolean performAccessibilityAction(View view, int action, Bundle arguments);
215        public AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View view);
216        public float getAlpha(View view);
217        public void setLayerType(View view, int layerType, Paint paint);
218        public int getLayerType(View view);
219        public int getLabelFor(View view);
220        public void setLabelFor(View view, int id);
221        public void setLayerPaint(View view, Paint paint);
222        public int getLayoutDirection(View view);
223        public void setLayoutDirection(View view, int layoutDirection);
224        public ViewParent getParentForAccessibility(View view);
225        public boolean isOpaque(View view);
226        public int resolveSizeAndState(int size, int measureSpec, int childMeasuredState);
227        public int getMeasuredWidthAndState(View view);
228        public int getMeasuredHeightAndState(View view);
229        public int getMeasuredState(View view);
230        public int getAccessibilityLiveRegion(View view);
231        public void setAccessibilityLiveRegion(View view, int mode);
232    }
233
234    static class BaseViewCompatImpl implements ViewCompatImpl {
235        public boolean canScrollHorizontally(View v, int direction) {
236            return false;
237        }
238        public boolean canScrollVertically(View v, int direction) {
239            return false;
240        }
241        public int getOverScrollMode(View v) {
242            return OVER_SCROLL_NEVER;
243        }
244        public void setOverScrollMode(View v, int mode) {
245            // Do nothing; API doesn't exist
246        }
247        public void setAccessibilityDelegate(View v, AccessibilityDelegateCompat delegate) {
248            // Do nothing; API doesn't exist
249        }
250        public void onPopulateAccessibilityEvent(View v, AccessibilityEvent event) {
251            // Do nothing; API doesn't exist
252        }
253        public void onInitializeAccessibilityEvent(View v, AccessibilityEvent event) {
254         // Do nothing; API doesn't exist
255        }
256        public void onInitializeAccessibilityNodeInfo(View v, AccessibilityNodeInfoCompat info) {
257            // Do nothing; API doesn't exist
258        }
259        public boolean hasTransientState(View view) {
260            // A view can't have transient state if transient state wasn't supported.
261            return false;
262        }
263        public void setHasTransientState(View view, boolean hasTransientState) {
264            // Do nothing; API doesn't exist
265        }
266        public void postInvalidateOnAnimation(View view) {
267            view.postInvalidateDelayed(getFrameTime());
268        }
269        public void postInvalidateOnAnimation(View view, int left, int top, int right, int bottom) {
270            view.postInvalidateDelayed(getFrameTime(), left, top, right, bottom);
271        }
272        public void postOnAnimation(View view, Runnable action) {
273            view.postDelayed(action, getFrameTime());
274        }
275        public void postOnAnimationDelayed(View view, Runnable action, long delayMillis) {
276            view.postDelayed(action, getFrameTime() + delayMillis);
277        }
278        long getFrameTime() {
279            return FAKE_FRAME_TIME;
280        }
281        public int getImportantForAccessibility(View view) {
282            return 0;
283        }
284        public void setImportantForAccessibility(View view, int mode) {
285
286        }
287        public boolean performAccessibilityAction(View view, int action, Bundle arguments) {
288            return false;
289        }
290        public AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View view) {
291            return null;
292        }
293        public float getAlpha(View view) {
294            return 1.0f;
295        }
296        public void setLayerType(View view, int layerType, Paint paint) {
297            // No-op until layers became available (HC)
298        }
299        public int getLayerType(View view) {
300            return LAYER_TYPE_NONE;
301        }
302        public int getLabelFor(View view) {
303            return 0;
304        }
305        public void setLabelFor(View view, int id) {
306
307        }
308        public void setLayerPaint(View view, Paint p) {
309            // No-op until layers became available (HC)
310        }
311
312        @Override
313        public int getLayoutDirection(View view) {
314            return LAYOUT_DIRECTION_LTR;
315        }
316
317        @Override
318        public void setLayoutDirection(View view, int layoutDirection) {
319            // No-op
320        }
321
322        @Override
323        public ViewParent getParentForAccessibility(View view) {
324            return view.getParent();
325        }
326
327        @Override
328        public boolean isOpaque(View view) {
329            final Drawable bg = view.getBackground();
330            if (bg != null) {
331                return bg.getOpacity() == PixelFormat.OPAQUE;
332            }
333            return false;
334        }
335
336        public int resolveSizeAndState(int size, int measureSpec, int childMeasuredState) {
337            return View.resolveSize(size, measureSpec);
338        }
339
340        @Override
341        public int getMeasuredWidthAndState(View view) {
342            return view.getMeasuredWidth();
343        }
344
345        @Override
346        public int getMeasuredHeightAndState(View view) {
347            return view.getMeasuredHeight();
348        }
349
350        @Override
351        public int getMeasuredState(View view) {
352            return 0;
353        }
354
355        @Override
356        public int getAccessibilityLiveRegion(View view) {
357            return ACCESSIBILITY_LIVE_REGION_NONE;
358        }
359
360        @Override
361        public void setAccessibilityLiveRegion(View view, int mode) {
362            // No-op
363        }
364    }
365
366    static class EclairMr1ViewCompatImpl extends BaseViewCompatImpl {
367        @Override
368        public boolean isOpaque(View view) {
369            return ViewCompatEclairMr1.isOpaque(view);
370        }
371    }
372
373    static class GBViewCompatImpl extends EclairMr1ViewCompatImpl {
374        @Override
375        public int getOverScrollMode(View v) {
376            return ViewCompatGingerbread.getOverScrollMode(v);
377        }
378        @Override
379        public void setOverScrollMode(View v, int mode) {
380            ViewCompatGingerbread.setOverScrollMode(v, mode);
381        }
382    }
383
384    static class HCViewCompatImpl extends GBViewCompatImpl {
385        @Override
386        long getFrameTime() {
387            return ViewCompatHC.getFrameTime();
388        }
389        @Override
390        public float getAlpha(View view) {
391            return ViewCompatHC.getAlpha(view);
392        }
393        @Override
394        public void setLayerType(View view, int layerType, Paint paint) {
395            ViewCompatHC.setLayerType(view, layerType, paint);
396        }
397        @Override
398        public int getLayerType(View view)  {
399            return ViewCompatHC.getLayerType(view);
400        }
401        @Override
402        public void setLayerPaint(View view, Paint paint) {
403            // Make sure the paint is correct; this will be cheap if it's the same
404            // instance as was used to call setLayerType earlier.
405            setLayerType(view, getLayerType(view), paint);
406            // This is expensive, but the only way to accomplish this before JB-MR1.
407            view.invalidate();
408        }
409        @Override
410        public int resolveSizeAndState(int size, int measureSpec, int childMeasuredState) {
411            return ViewCompatHC.resolveSizeAndState(size, measureSpec, childMeasuredState);
412        }
413        @Override
414        public int getMeasuredWidthAndState(View view) {
415            return ViewCompatHC.getMeasuredWidthAndState(view);
416        }
417        @Override
418        public int getMeasuredHeightAndState(View view) {
419            return ViewCompatHC.getMeasuredHeightAndState(view);
420        }
421        @Override
422        public int getMeasuredState(View view) {
423            return ViewCompatHC.getMeasuredState(view);
424        }
425    }
426
427    static class ICSViewCompatImpl extends HCViewCompatImpl {
428        @Override
429        public boolean canScrollHorizontally(View v, int direction) {
430            return ViewCompatICS.canScrollHorizontally(v, direction);
431        }
432        @Override
433        public boolean canScrollVertically(View v, int direction) {
434            return ViewCompatICS.canScrollVertically(v, direction);
435        }
436        @Override
437        public void onPopulateAccessibilityEvent(View v, AccessibilityEvent event) {
438            ViewCompatICS.onPopulateAccessibilityEvent(v, event);
439        }
440        @Override
441        public void onInitializeAccessibilityEvent(View v, AccessibilityEvent event) {
442            ViewCompatICS.onInitializeAccessibilityEvent(v, event);
443        }
444        @Override
445        public void onInitializeAccessibilityNodeInfo(View v, AccessibilityNodeInfoCompat info) {
446            ViewCompatICS.onInitializeAccessibilityNodeInfo(v, info.getInfo());
447        }
448        @Override
449        public void setAccessibilityDelegate(View v, AccessibilityDelegateCompat delegate) {
450            ViewCompatICS.setAccessibilityDelegate(v, delegate.getBridge());
451        }
452    }
453
454    static class JBViewCompatImpl extends ICSViewCompatImpl {
455        @Override
456        public boolean hasTransientState(View view) {
457            return ViewCompatJB.hasTransientState(view);
458        }
459        @Override
460        public void setHasTransientState(View view, boolean hasTransientState) {
461            ViewCompatJB.setHasTransientState(view, hasTransientState);
462        }
463        @Override
464        public void postInvalidateOnAnimation(View view) {
465            ViewCompatJB.postInvalidateOnAnimation(view);
466        }
467        @Override
468        public void postInvalidateOnAnimation(View view, int left, int top, int right, int bottom) {
469            ViewCompatJB.postInvalidateOnAnimation(view, left, top, right, bottom);
470        }
471        @Override
472        public void postOnAnimation(View view, Runnable action) {
473            ViewCompatJB.postOnAnimation(view, action);
474        }
475        @Override
476        public void postOnAnimationDelayed(View view, Runnable action, long delayMillis) {
477            ViewCompatJB.postOnAnimationDelayed(view, action, delayMillis);
478        }
479        @Override
480        public int getImportantForAccessibility(View view) {
481            return ViewCompatJB.getImportantForAccessibility(view);
482        }
483        @Override
484        public void setImportantForAccessibility(View view, int mode) {
485            // IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS is not available
486            // on this platform so replace with IMPORTANT_FOR_ACCESSIBILITY_NO
487            // which is closer semantically.
488            if (mode == IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS) {
489                mode = IMPORTANT_FOR_ACCESSIBILITY_NO;
490            }
491            ViewCompatJB.setImportantForAccessibility(view, mode);
492        }
493        @Override
494        public boolean performAccessibilityAction(View view, int action, Bundle arguments) {
495            return ViewCompatJB.performAccessibilityAction(view, action, arguments);
496        }
497        @Override
498        public AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View view) {
499            Object compat = ViewCompatJB.getAccessibilityNodeProvider(view);
500            if (compat != null) {
501                return new AccessibilityNodeProviderCompat(compat);
502            }
503            return null;
504        }
505
506        @Override
507        public ViewParent getParentForAccessibility(View view) {
508            return ViewCompatJB.getParentForAccessibility(view);
509        }
510    }
511
512    static class JbMr1ViewCompatImpl extends JBViewCompatImpl {
513
514        @Override
515        public int getLabelFor(View view) {
516            return ViewCompatJellybeanMr1.getLabelFor(view);
517        }
518
519        @Override
520        public void setLabelFor(View view, int id) {
521            ViewCompatJellybeanMr1.setLabelFor(view, id);
522        }
523
524        @Override
525        public void setLayerPaint(View view, Paint paint) {
526            ViewCompatJellybeanMr1.setLayerPaint(view, paint);
527        }
528
529        @Override
530        public int getLayoutDirection(View view) {
531            return ViewCompatJellybeanMr1.getLayoutDirection(view);
532        }
533
534        @Override
535        public void setLayoutDirection(View view, int layoutDirection) {
536            ViewCompatJellybeanMr1.setLayoutDirection(view, layoutDirection);
537        }
538    }
539
540    static class KitKatViewCompatImpl extends JbMr1ViewCompatImpl {
541        @Override
542        public int getAccessibilityLiveRegion(View view) {
543            return ViewCompatKitKat.getAccessibilityLiveRegion(view);
544        }
545
546        @Override
547        public void setAccessibilityLiveRegion(View view, int mode) {
548            ViewCompatKitKat.setAccessibilityLiveRegion(view, mode);
549        }
550
551        @Override
552        public void setImportantForAccessibility(View view, int mode) {
553            ViewCompatJB.setImportantForAccessibility(view, mode);
554        }
555    }
556
557    static final ViewCompatImpl IMPL;
558    static {
559        final int version = android.os.Build.VERSION.SDK_INT;
560        if (version >= 19) {
561            IMPL = new KitKatViewCompatImpl();
562        } else if (version >= 17) {
563            IMPL = new JbMr1ViewCompatImpl();
564        } else if (version >= 16) {
565            IMPL = new JBViewCompatImpl();
566        } else if (version >= 14) {
567            IMPL = new ICSViewCompatImpl();
568        } else if (version >= 11) {
569            IMPL = new HCViewCompatImpl();
570        } else if (version >= 9) {
571            IMPL = new GBViewCompatImpl();
572        } else {
573            IMPL = new BaseViewCompatImpl();
574        }
575    }
576
577    /**
578     * Check if this view can be scrolled horizontally in a certain direction.
579     *
580     * @param v The View against which to invoke the method.
581     * @param direction Negative to check scrolling left, positive to check scrolling right.
582     * @return true if this view can be scrolled in the specified direction, false otherwise.
583     */
584    public static boolean canScrollHorizontally(View v, int direction) {
585        return IMPL.canScrollHorizontally(v, direction);
586    }
587
588    /**
589     * Check if this view can be scrolled vertically in a certain direction.
590     *
591     * @param v The View against which to invoke the method.
592     * @param direction Negative to check scrolling up, positive to check scrolling down.
593     * @return true if this view can be scrolled in the specified direction, false otherwise.
594     */
595    public static boolean canScrollVertically(View v, int direction) {
596        return IMPL.canScrollVertically(v, direction);
597    }
598
599    /**
600     * Returns the over-scroll mode for this view. The result will be
601     * one of {@link #OVER_SCROLL_ALWAYS} (default), {@link #OVER_SCROLL_IF_CONTENT_SCROLLS}
602     * (allow over-scrolling only if the view content is larger than the container),
603     * or {@link #OVER_SCROLL_NEVER}.
604     *
605     * @param v The View against which to invoke the method.
606     * @return This view's over-scroll mode.
607     */
608    public static int getOverScrollMode(View v) {
609        return IMPL.getOverScrollMode(v);
610    }
611
612    /**
613     * Set the over-scroll mode for this view. Valid over-scroll modes are
614     * {@link #OVER_SCROLL_ALWAYS} (default), {@link #OVER_SCROLL_IF_CONTENT_SCROLLS}
615     * (allow over-scrolling only if the view content is larger than the container),
616     * or {@link #OVER_SCROLL_NEVER}.
617     *
618     * Setting the over-scroll mode of a view will have an effect only if the
619     * view is capable of scrolling.
620     *
621     * @param v The View against which to invoke the method.
622     * @param overScrollMode The new over-scroll mode for this view.
623     */
624    public static void setOverScrollMode(View v, int overScrollMode) {
625        IMPL.setOverScrollMode(v, overScrollMode);
626    }
627
628    /**
629     * Called from {@link View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)}
630     * giving a chance to this View to populate the accessibility event with its
631     * text content. While this method is free to modify event
632     * attributes other than text content, doing so should normally be performed in
633     * {@link View#onInitializeAccessibilityEvent(AccessibilityEvent)}.
634     * <p>
635     * Example: Adding formatted date string to an accessibility event in addition
636     *          to the text added by the super implementation:
637     * <pre> public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
638     *     super.onPopulateAccessibilityEvent(event);
639     *     final int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY;
640     *     String selectedDateUtterance = DateUtils.formatDateTime(mContext,
641     *         mCurrentDate.getTimeInMillis(), flags);
642     *     event.getText().add(selectedDateUtterance);
643     * }</pre>
644     * <p>
645     * If an {@link android.view.View.AccessibilityDelegate} has been specified via calling
646     * {@link View#setAccessibilityDelegate(android.view.View.AccessibilityDelegate)} its
647     * {@link android.view.View.AccessibilityDelegate#onPopulateAccessibilityEvent(View,
648     *  AccessibilityEvent)}
649     * is responsible for handling this call.
650     * </p>
651     * <p class="note"><strong>Note:</strong> Always call the super implementation before adding
652     * information to the event, in case the default implementation has basic information to add.
653     * </p>
654     *
655     * @param v The View against which to invoke the method.
656     * @param event The accessibility event which to populate.
657     *
658     * @see View#sendAccessibilityEvent(int)
659     * @see View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)
660     */
661    public static void onPopulateAccessibilityEvent(View v, AccessibilityEvent event) {
662        IMPL.onPopulateAccessibilityEvent(v, event);
663    }
664
665    /**
666     * Initializes an {@link AccessibilityEvent} with information about
667     * this View which is the event source. In other words, the source of
668     * an accessibility event is the view whose state change triggered firing
669     * the event.
670     * <p>
671     * Example: Setting the password property of an event in addition
672     *          to properties set by the super implementation:
673     * <pre> public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
674     *     super.onInitializeAccessibilityEvent(event);
675     *     event.setPassword(true);
676     * }</pre>
677     * <p>
678     * If an {@link android.view.View.AccessibilityDelegate} has been specified via calling
679     * {@link View#setAccessibilityDelegate(android.view.View.AccessibilityDelegate)} its
680     * {@link android.view.View.AccessibilityDelegate#onInitializeAccessibilityEvent(View,
681     *  AccessibilityEvent)}
682     * is responsible for handling this call.
683     * </p>
684     * <p class="note"><strong>Note:</strong> Always call the super implementation before adding
685     * information to the event, in case the default implementation has basic information to add.
686     * </p>
687     *
688     * @param v The View against which to invoke the method.
689     * @param event The event to initialize.
690     *
691     * @see View#sendAccessibilityEvent(int)
692     * @see View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)
693     */
694    public static void onInitializeAccessibilityEvent(View v, AccessibilityEvent event) {
695        IMPL.onInitializeAccessibilityEvent(v, event);
696    }
697
698    /**
699     * Initializes an {@link android.view.accessibility.AccessibilityNodeInfo} with information
700     * about this view. The base implementation sets:
701     * <ul>
702     * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setParent(View)},</li>
703     * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setBoundsInParent(Rect)},</li>
704     * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setBoundsInScreen(Rect)},</li>
705     * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setPackageName(CharSequence)},</li>
706     * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setClassName(CharSequence)},</li>
707     * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setContentDescription(CharSequence)},</li>
708     * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setEnabled(boolean)},</li>
709     * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setClickable(boolean)},</li>
710     * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setFocusable(boolean)},</li>
711     * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setFocused(boolean)},</li>
712     * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setLongClickable(boolean)},</li>
713     * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setSelected(boolean)},</li>
714     * </ul>
715     * <p>
716     * Subclasses should override this method, call the super implementation,
717     * and set additional attributes.
718     * </p>
719     * <p>
720     * If an {@link android.view.View.AccessibilityDelegate} has been specified via calling
721     * {@link View#setAccessibilityDelegate(android.view.View.AccessibilityDelegate)} its
722     * {@link android.view.View.AccessibilityDelegate#onInitializeAccessibilityNodeInfo(View,
723     *  android.view.accessibility.AccessibilityNodeInfo)}
724     * is responsible for handling this call.
725     * </p>
726     *
727     * @param v The View against which to invoke the method.
728     * @param info The instance to initialize.
729     */
730    public static void onInitializeAccessibilityNodeInfo(View v, AccessibilityNodeInfoCompat info) {
731        IMPL.onInitializeAccessibilityNodeInfo(v, info);
732    }
733
734    /**
735     * Sets a delegate for implementing accessibility support via compositon as
736     * opposed to inheritance. The delegate's primary use is for implementing
737     * backwards compatible widgets. For more details see
738     * {@link android.view.View.AccessibilityDelegate}.
739     *
740     * @param v The View against which to invoke the method.
741     * @param delegate The delegate instance.
742     *
743     * @see android.view.View.AccessibilityDelegate
744     */
745    public static void setAccessibilityDelegate(View v, AccessibilityDelegateCompat delegate) {
746        IMPL.setAccessibilityDelegate(v, delegate);
747    }
748
749    /**
750     * Indicates whether the view is currently tracking transient state that the
751     * app should not need to concern itself with saving and restoring, but that
752     * the framework should take special note to preserve when possible.
753     *
754     * @param view View to check for transient state
755     * @return true if the view has transient state
756     */
757    public static boolean hasTransientState(View view) {
758        return IMPL.hasTransientState(view);
759    }
760
761    /**
762     * Set whether this view is currently tracking transient state that the
763     * framework should attempt to preserve when possible.
764     *
765     * @param view View tracking transient state
766     * @param hasTransientState true if this view has transient state
767     */
768    public static void setHasTransientState(View view, boolean hasTransientState) {
769        IMPL.setHasTransientState(view, hasTransientState);
770    }
771
772    /**
773     * <p>Cause an invalidate to happen on the next animation time step, typically the
774     * next display frame.</p>
775     *
776     * <p>This method can be invoked from outside of the UI thread
777     * only when this View is attached to a window.</p>
778     *
779     * @param view View to invalidate
780     */
781    public static void postInvalidateOnAnimation(View view) {
782        IMPL.postInvalidateOnAnimation(view);
783    }
784
785    /**
786     * <p>Cause an invalidate of the specified area to happen on the next animation
787     * time step, typically the next display frame.</p>
788     *
789     * <p>This method can be invoked from outside of the UI thread
790     * only when this View is attached to a window.</p>
791     *
792     * @param view View to invalidate
793     * @param left The left coordinate of the rectangle to invalidate.
794     * @param top The top coordinate of the rectangle to invalidate.
795     * @param right The right coordinate of the rectangle to invalidate.
796     * @param bottom The bottom coordinate of the rectangle to invalidate.
797     */
798    public static void postInvalidateOnAnimation(View view, int left, int top,
799            int right, int bottom) {
800        IMPL.postInvalidateOnAnimation(view, left, top, right, bottom);
801    }
802
803    /**
804     * <p>Causes the Runnable to execute on the next animation time step.
805     * The runnable will be run on the user interface thread.</p>
806     *
807     * <p>This method can be invoked from outside of the UI thread
808     * only when this View is attached to a window.</p>
809     *
810     * @param view View to post this Runnable to
811     * @param action The Runnable that will be executed.
812     */
813    public static void postOnAnimation(View view, Runnable action) {
814        IMPL.postOnAnimation(view, action);
815    }
816
817    /**
818     * <p>Causes the Runnable to execute on the next animation time step,
819     * after the specified amount of time elapses.
820     * The runnable will be run on the user interface thread.</p>
821     *
822     * <p>This method can be invoked from outside of the UI thread
823     * only when this View is attached to a window.</p>
824     *
825     * @param view The view to post this Runnable to
826     * @param action The Runnable that will be executed.
827     * @param delayMillis The delay (in milliseconds) until the Runnable
828     *        will be executed.
829     */
830    public static void postOnAnimationDelayed(View view, Runnable action, long delayMillis) {
831        IMPL.postOnAnimationDelayed(view, action, delayMillis);
832    }
833
834    /**
835     * Gets the mode for determining whether this View is important for accessibility
836     * which is if it fires accessibility events and if it is reported to
837     * accessibility services that query the screen.
838     *
839     * @param view The view whose property to get.
840     * @return The mode for determining whether a View is important for accessibility.
841     *
842     * @see #IMPORTANT_FOR_ACCESSIBILITY_YES
843     * @see #IMPORTANT_FOR_ACCESSIBILITY_NO
844     * @see #IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
845     * @see #IMPORTANT_FOR_ACCESSIBILITY_AUTO
846     */
847    public static int getImportantForAccessibility(View view) {
848        return IMPL.getImportantForAccessibility(view);
849    }
850
851    /**
852     * Sets how to determine whether this view is important for accessibility
853     * which is if it fires accessibility events and if it is reported to
854     * accessibility services that query the screen.
855     * <p>
856     * <em>Note:</em> If the current paltform version does not support the
857     *  {@link #IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS} mode, then
858     *  {@link #IMPORTANT_FOR_ACCESSIBILITY_NO} will be used as it is the
859     *  closest terms of semantics.
860     * </p>
861     *
862     * @param view The view whose property to set.
863     * @param mode How to determine whether this view is important for accessibility.
864     *
865     * @see #IMPORTANT_FOR_ACCESSIBILITY_YES
866     * @see #IMPORTANT_FOR_ACCESSIBILITY_NO
867     * @see #IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
868     * @see #IMPORTANT_FOR_ACCESSIBILITY_AUTO
869     */
870    public static void setImportantForAccessibility(View view, int mode) {
871        IMPL.setImportantForAccessibility(view, mode);
872    }
873
874    /**
875     * Performs the specified accessibility action on the view. For
876     * possible accessibility actions look at {@link AccessibilityNodeInfoCompat}.
877     * <p>
878     * If an {@link AccessibilityDelegateCompat} has been specified via calling
879     * {@link #setAccessibilityDelegate(View, AccessibilityDelegateCompat)} its
880     * {@link AccessibilityDelegateCompat#performAccessibilityAction(View, int, Bundle)}
881     * is responsible for handling this call.
882     * </p>
883     *
884     * @param action The action to perform.
885     * @param arguments Optional action arguments.
886     * @return Whether the action was performed.
887     */
888    public static boolean performAccessibilityAction(View view, int action, Bundle arguments) {
889        return IMPL.performAccessibilityAction(view, action, arguments);
890    }
891
892    /**
893     * Gets the provider for managing a virtual view hierarchy rooted at this View
894     * and reported to {@link android.accessibilityservice.AccessibilityService}s
895     * that explore the window content.
896     * <p>
897     * If this method returns an instance, this instance is responsible for managing
898     * {@link AccessibilityNodeInfoCompat}s describing the virtual sub-tree rooted at
899     * this View including the one representing the View itself. Similarly the returned
900     * instance is responsible for performing accessibility actions on any virtual
901     * view or the root view itself.
902     * </p>
903     * <p>
904     * If an {@link AccessibilityDelegateCompat} has been specified via calling
905     * {@link #setAccessibilityDelegate(View, AccessibilityDelegateCompat)} its
906     * {@link AccessibilityDelegateCompat#getAccessibilityNodeProvider(View)}
907     * is responsible for handling this call.
908     * </p>
909     *
910     * @param view The view whose property to get.
911     * @return The provider.
912     *
913     * @see AccessibilityNodeProviderCompat
914     */
915    public static AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View view) {
916        return IMPL.getAccessibilityNodeProvider(view);
917    }
918
919    /**
920     * The opacity of the view. This is a value from 0 to 1, where 0 means the view is
921     * completely transparent and 1 means the view is completely opaque.
922     *
923     * <p>By default this is 1.0f. Prior to API 11, the returned value is always 1.0f.
924     * @return The opacity of the view.
925     */
926    public static float getAlpha(View view) {
927        return IMPL.getAlpha(view);
928    }
929
930    /**
931     * <p>Specifies the type of layer backing this view. The layer can be
932     * {@link #LAYER_TYPE_NONE disabled}, {@link #LAYER_TYPE_SOFTWARE software} or
933     * {@link #LAYER_TYPE_HARDWARE hardware}.</p>
934     *
935     * <p>A layer is associated with an optional {@link android.graphics.Paint}
936     * instance that controls how the layer is composed on screen. The following
937     * properties of the paint are taken into account when composing the layer:</p>
938     * <ul>
939     * <li>{@link android.graphics.Paint#getAlpha() Translucency (alpha)}</li>
940     * <li>{@link android.graphics.Paint#getXfermode() Blending mode}</li>
941     * <li>{@link android.graphics.Paint#getColorFilter() Color filter}</li>
942     * </ul>
943     *
944     * <p>If this view has an alpha value set to < 1.0 by calling
945     * setAlpha(float), the alpha value of the layer's paint is replaced by
946     * this view's alpha value. Calling setAlpha(float) is therefore
947     * equivalent to setting a hardware layer on this view and providing a paint with
948     * the desired alpha value.<p>
949     *
950     * <p>Refer to the documentation of {@link #LAYER_TYPE_NONE disabled},
951     * {@link #LAYER_TYPE_SOFTWARE software} and {@link #LAYER_TYPE_HARDWARE hardware}
952     * for more information on when and how to use layers.</p>
953     *
954     * @param layerType The ype of layer to use with this view, must be one of
955     *        {@link #LAYER_TYPE_NONE}, {@link #LAYER_TYPE_SOFTWARE} or
956     *        {@link #LAYER_TYPE_HARDWARE}
957     * @param paint The paint used to compose the layer. This argument is optional
958     *        and can be null. It is ignored when the layer type is
959     *        {@link #LAYER_TYPE_NONE}
960     *
961     * @param view View to set the layer type for
962     * @param layerType The type of layer to use with this view, must be one of
963     *        {@link #LAYER_TYPE_NONE}, {@link #LAYER_TYPE_SOFTWARE} or
964     *        {@link #LAYER_TYPE_HARDWARE}
965     * @param paint The paint used to compose the layer. This argument is optional
966     *        and can be null. It is ignored when the layer type is
967     *        {@link #LAYER_TYPE_NONE}
968     */
969    public static void setLayerType(View view, int layerType, Paint paint) {
970        IMPL.setLayerType(view, layerType, paint);
971    }
972
973    /**
974     * Indicates what type of layer is currently associated with this view. By default
975     * a view does not have a layer, and the layer type is {@link #LAYER_TYPE_NONE}.
976     * Refer to the documentation of
977     * {@link #setLayerType(android.view.View, int, android.graphics.Paint)}
978     * for more information on the different types of layers.
979     *
980     * @param view The view to fetch the layer type from
981     * @return {@link #LAYER_TYPE_NONE}, {@link #LAYER_TYPE_SOFTWARE} or
982     *         {@link #LAYER_TYPE_HARDWARE}
983     *
984     * @see #setLayerType(android.view.View, int, android.graphics.Paint)
985     * @see #LAYER_TYPE_NONE
986     * @see #LAYER_TYPE_SOFTWARE
987     * @see #LAYER_TYPE_HARDWARE
988     */
989    public static int getLayerType(View view) {
990        return IMPL.getLayerType(view);
991    }
992
993    /**
994     * Gets the id of a view for which a given view serves as a label for
995     * accessibility purposes.
996     *
997     * @param view The view on which to invoke the corresponding method.
998     * @return The labeled view id.
999     */
1000    public static int getLabelFor(View view) {
1001        return IMPL.getLabelFor(view);
1002    }
1003
1004    /**
1005     * Sets the id of a view for which a given view serves as a label for
1006     * accessibility purposes.
1007     *
1008     * @param view The view on which to invoke the corresponding method.
1009     * @param labeledId The labeled view id.
1010     */
1011    public static void setLabelFor(View view, int labeledId) {
1012        IMPL.setLabelFor(view, labeledId);
1013    }
1014
1015    /**
1016     * Updates the {@link Paint} object used with the current layer (used only if the current
1017     * layer type is not set to {@link #LAYER_TYPE_NONE}). Changed properties of the Paint
1018     * provided to {@link #setLayerType(android.view.View, int, android.graphics.Paint)}
1019     * will be used the next time the View is redrawn, but
1020     * {@link #setLayerPaint(android.view.View, android.graphics.Paint)}
1021     * must be called to ensure that the view gets redrawn immediately.
1022     *
1023     * <p>A layer is associated with an optional {@link android.graphics.Paint}
1024     * instance that controls how the layer is composed on screen. The following
1025     * properties of the paint are taken into account when composing the layer:</p>
1026     * <ul>
1027     * <li>{@link android.graphics.Paint#getAlpha() Translucency (alpha)}</li>
1028     * <li>{@link android.graphics.Paint#getXfermode() Blending mode}</li>
1029     * <li>{@link android.graphics.Paint#getColorFilter() Color filter}</li>
1030     * </ul>
1031     *
1032     * <p>If this view has an alpha value set to < 1.0 by calling
1033     * View#setAlpha(float), the alpha value of the layer's paint is replaced by
1034     * this view's alpha value. Calling View#setAlpha(float) is therefore
1035     * equivalent to setting a hardware layer on this view and providing a paint with
1036     * the desired alpha value.</p>
1037     *
1038     * @param view View to set a layer paint for
1039     * @param paint The paint used to compose the layer. This argument is optional
1040     *        and can be null. It is ignored when the layer type is
1041     *        {@link #LAYER_TYPE_NONE}
1042     *
1043     * @see #setLayerType(View, int, android.graphics.Paint)
1044     */
1045    public static void setLayerPaint(View view, Paint paint) {
1046        IMPL.setLayerPaint(view, paint);
1047    }
1048
1049    /**
1050     * Returns the resolved layout direction for this view.
1051     *
1052     * @param view View to get layout direction for
1053     * @return {@link #LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns
1054     * {@link #LAYOUT_DIRECTION_LTR} if the layout direction is not RTL.
1055     *
1056     * For compatibility, this will return {@link #LAYOUT_DIRECTION_LTR} if API version
1057     * is lower than Jellybean MR1 (API 17)
1058     */
1059    public static int getLayoutDirection(View view) {
1060        return IMPL.getLayoutDirection(view);
1061    }
1062
1063    /**
1064     * Set the layout direction for this view. This will propagate a reset of layout direction
1065     * resolution to the view's children and resolve layout direction for this view.
1066     *
1067     * @param view View to set layout direction for
1068     * @param layoutDirection the layout direction to set. Should be one of:
1069     *
1070     * {@link #LAYOUT_DIRECTION_LTR},
1071     * {@link #LAYOUT_DIRECTION_RTL},
1072     * {@link #LAYOUT_DIRECTION_INHERIT},
1073     * {@link #LAYOUT_DIRECTION_LOCALE}.
1074     *
1075     * Resolution will be done if the value is set to LAYOUT_DIRECTION_INHERIT. The resolution
1076     * proceeds up the parent chain of the view to get the value. If there is no parent, then it
1077     * will return the default {@link #LAYOUT_DIRECTION_LTR}.
1078     */
1079    public static void setLayoutDirection(View view, int layoutDirection) {
1080        IMPL.setLayoutDirection(view, layoutDirection);
1081    }
1082
1083    /**
1084     * Gets the parent for accessibility purposes. Note that the parent for
1085     * accessibility is not necessary the immediate parent. It is the first
1086     * predecessor that is important for accessibility.
1087     *
1088     * @param view View to retrieve parent for
1089     * @return The parent for use in accessibility inspection
1090     */
1091    public static ViewParent getParentForAccessibility(View view) {
1092        return IMPL.getParentForAccessibility(view);
1093    }
1094
1095    /**
1096     * Indicates whether this View is opaque. An opaque View guarantees that it will
1097     * draw all the pixels overlapping its bounds using a fully opaque color.
1098     *
1099     * On API 7 and above this will call View's true isOpaque method. On previous platform
1100     * versions it will check the opacity of the view's background drawable if present.
1101     *
1102     * @return True if this View is guaranteed to be fully opaque, false otherwise.
1103     */
1104    public static boolean isOpaque(View view) {
1105        return IMPL.isOpaque(view);
1106    }
1107
1108    /**
1109     * Utility to reconcile a desired size and state, with constraints imposed
1110     * by a MeasureSpec.  Will take the desired size, unless a different size
1111     * is imposed by the constraints.  The returned value is a compound integer,
1112     * with the resolved size in the {@link #MEASURED_SIZE_MASK} bits and
1113     * optionally the bit {@link #MEASURED_STATE_TOO_SMALL} set if the resulting
1114     * size is smaller than the size the view wants to be.
1115     *
1116     * @param size How big the view wants to be
1117     * @param measureSpec Constraints imposed by the parent
1118     * @return Size information bit mask as defined by
1119     * {@link #MEASURED_SIZE_MASK} and {@link #MEASURED_STATE_TOO_SMALL}.
1120     */
1121    public static int resolveSizeAndState(int size, int measureSpec, int childMeasuredState) {
1122        return IMPL.resolveSizeAndState(size, measureSpec, childMeasuredState);
1123    }
1124
1125    /**
1126     * Return the full width measurement information for this view as computed
1127     * by the most recent call to {@link android.view.View#measure(int, int)}.
1128     * This result is a bit mask as defined by {@link #MEASURED_SIZE_MASK} and
1129     * {@link #MEASURED_STATE_TOO_SMALL}.
1130     * This should be used during measurement and layout calculations only. Use
1131     * {@link android.view.View#getWidth()} to see how wide a view is after layout.
1132     *
1133     * @return The measured width of this view as a bit mask.
1134     */
1135    public static int getMeasuredWidthAndState(View view) {
1136        return IMPL.getMeasuredWidthAndState(view);
1137    }
1138
1139    /**
1140     * Return the full height measurement information for this view as computed
1141     * by the most recent call to {@link android.view.View#measure(int, int)}.
1142     * This result is a bit mask as defined by {@link #MEASURED_SIZE_MASK} and
1143     * {@link #MEASURED_STATE_TOO_SMALL}.
1144     * This should be used during measurement and layout calculations only. Use
1145     * {@link android.view.View#getHeight()} to see how wide a view is after layout.
1146     *
1147     * @return The measured width of this view as a bit mask.
1148     */
1149    public static int getMeasuredHeightAndState(View view) {
1150        return IMPL.getMeasuredHeightAndState(view);
1151    }
1152
1153    /**
1154     * Return only the state bits of {@link #getMeasuredWidthAndState}
1155     * and {@link #getMeasuredHeightAndState}, combined into one integer.
1156     * The width component is in the regular bits {@link #MEASURED_STATE_MASK}
1157     * and the height component is at the shifted bits
1158     * {@link #MEASURED_HEIGHT_STATE_SHIFT}>>{@link #MEASURED_STATE_MASK}.
1159     */
1160    public static int getMeasuredState(View view) {
1161        return IMPL.getMeasuredState(view);
1162    }
1163
1164    /**
1165     * Gets the live region mode for the specified View.
1166     *
1167     * @param view The view from which to obtain the live region mode
1168     * @return The live region mode for the view.
1169     *
1170     * @see ViewCompat#setAccessibilityLiveRegion(View, int)
1171     */
1172    public int getAccessibilityLiveRegion(View view) {
1173        return IMPL.getAccessibilityLiveRegion(view);
1174    }
1175
1176    /**
1177     * Sets the live region mode for the specified view. This indicates to
1178     * accessibility services whether they should automatically notify the user
1179     * about changes to the view's content description or text, or to the
1180     * content descriptions or text of the view's children (where applicable).
1181     * <p>
1182     * For example, in a login screen with a TextView that displays an "incorrect
1183     * password" notification, that view should be marked as a live region with
1184     * mode {@link #ACCESSIBILITY_LIVE_REGION_POLITE}.
1185     * <p>
1186     * To disable change notifications for this view, use
1187     * {@link #ACCESSIBILITY_LIVE_REGION_NONE}. This is the default live region
1188     * mode for most views.
1189     * <p>
1190     * To indicate that the user should be notified of changes, use
1191     * {@link #ACCESSIBILITY_LIVE_REGION_POLITE}.
1192     * <p>
1193     * If the view's changes should interrupt ongoing speech and notify the user
1194     * immediately, use {@link #ACCESSIBILITY_LIVE_REGION_ASSERTIVE}.
1195     *
1196     * @param view The view on which to set the live region mode
1197     * @param mode The live region mode for this view, one of:
1198     *        <ul>
1199     *        <li>{@link #ACCESSIBILITY_LIVE_REGION_NONE}
1200     *        <li>{@link #ACCESSIBILITY_LIVE_REGION_POLITE}
1201     *        <li>{@link #ACCESSIBILITY_LIVE_REGION_ASSERTIVE}
1202     *        </ul>
1203     */
1204    public void setAccessibilityLiveRegion(View view, int mode) {
1205        IMPL.setAccessibilityLiveRegion(view, mode);
1206    }
1207}
1208