1bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell/* 2bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell * Copyright (C) 2011 The Android Open Source Project 3bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell * 4bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell * Licensed under the Apache License, Version 2.0 (the "License"); 5bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell * you may not use this file except in compliance with the License. 6bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell * You may obtain a copy of the License at 7bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell * 8bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell * http://www.apache.org/licenses/LICENSE-2.0 9bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell * 10bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell * Unless required by applicable law or agreed to in writing, software 11bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell * distributed under the License is distributed on an "AS IS" BASIS, 12bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell * See the License for the specific language governing permissions and 14bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell * limitations under the License. 15bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell */ 16bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell 17bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powellpackage android.support.v4.view; 18bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell 19a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banesimport android.content.res.ColorStateList; 208a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powellimport android.graphics.Paint; 21c029e15f5a4709214cb433a562256586824a0f33Adam Powellimport android.graphics.PixelFormat; 22a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banesimport android.graphics.PorterDuff; 230574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganovimport android.graphics.Rect; 24c029e15f5a4709214cb433a562256586824a0f33Adam Powellimport android.graphics.drawable.Drawable; 25a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banesimport android.os.Build; 260d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanvimport android.os.Bundle; 2770acb0c19be3831a2080e4f902324de16bfbf62eTor Norbyeimport android.support.annotation.FloatRange; 28a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbyeimport android.support.annotation.IdRes; 29a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbyeimport android.support.annotation.IntDef; 30d392c8cae159a3a9a416200f4e117634bdbf064eYigit Boyarimport android.support.annotation.Nullable; 319648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganovimport android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; 3225121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganovimport android.support.v4.view.accessibility.AccessibilityNodeProviderCompat; 33a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powellimport android.util.Log; 341fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powellimport android.view.MotionEvent; 351fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powellimport android.view.VelocityTracker; 36bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powellimport android.view.View; 371fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powellimport android.view.ViewConfiguration; 380f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereiraimport android.view.ViewGroup; 393cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powellimport android.view.ViewParent; 409648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganovimport android.view.accessibility.AccessibilityEvent; 41bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell 42a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbyeimport java.lang.annotation.Retention; 43a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbyeimport java.lang.annotation.RetentionPolicy; 44a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyarimport java.lang.reflect.Field; 45a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powellimport java.lang.reflect.Method; 46d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haaseimport java.util.WeakHashMap; 47a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell 48bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell/** 490574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Helper for accessing features in {@link View} introduced after API 500574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * level 4 in a backwards compatible fashion. 51bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell */ 52bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powellpublic class ViewCompat { 53a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell private static final String TAG = "ViewCompat"; 54a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell 55ea4f700ac38424954c56df5138ff794def50b019Chris Banes 56a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye /** @hide */ 57f129f1b050d2542a91fe8175eac30183beb07b41Chris Banes @IntDef({OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER}) 58a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @Retention(RetentionPolicy.SOURCE) 59a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye private @interface OverScroll {} 60a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye 61560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell /** 62560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell * Always allow a user to over-scroll this view, provided it is a 63560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell * view that can scroll. 64560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell */ 65560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell public static final int OVER_SCROLL_ALWAYS = 0; 66560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell 67560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell /** 68560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell * Allow a user to over-scroll this view only if the content is large 69560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell * enough to meaningfully scroll, provided it is a view that can scroll. 70560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell */ 71560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell public static final int OVER_SCROLL_IF_CONTENT_SCROLLS = 1; 72560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell 73560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell /** 74560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell * Never allow a user to over-scroll this view. 75560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell */ 76560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell public static final int OVER_SCROLL_NEVER = 2; 77560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell 78ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell private static final long FAKE_FRAME_TIME = 10; 79ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell 80a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye /** @hide */ 81a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @IntDef({ 82a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye IMPORTANT_FOR_ACCESSIBILITY_AUTO, 83a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye IMPORTANT_FOR_ACCESSIBILITY_YES, 84a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye IMPORTANT_FOR_ACCESSIBILITY_NO, 85a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS 86a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye }) 87a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @Retention(RetentionPolicy.SOURCE) 88a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye private @interface ImportantForAccessibility {} 89a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye 9025121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov /** 9125121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * Automatically determine whether a view is important for accessibility. 9225121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov */ 9325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public static final int IMPORTANT_FOR_ACCESSIBILITY_AUTO = 0x00000000; 9425121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov 9525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov /** 9625121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * The view is important for accessibility. 9725121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov */ 9825121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public static final int IMPORTANT_FOR_ACCESSIBILITY_YES = 0x00000001; 9925121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov 10025121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov /** 10125121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * The view is not important for accessibility. 10225121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov */ 10325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public static final int IMPORTANT_FOR_ACCESSIBILITY_NO = 0x00000002; 10425121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov 1058a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell /** 106b5b909e4544fd4d1d0bdf445b8588a7233d5c71fAlan Viverette * The view is not important for accessibility, nor are any of its 107b5b909e4544fd4d1d0bdf445b8588a7233d5c71fAlan Viverette * descendant views. 108b5b909e4544fd4d1d0bdf445b8588a7233d5c71fAlan Viverette */ 109b5b909e4544fd4d1d0bdf445b8588a7233d5c71fAlan Viverette public static final int IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS = 0x00000004; 110b5b909e4544fd4d1d0bdf445b8588a7233d5c71fAlan Viverette 111a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye /** @hide */ 112a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @IntDef({ 113a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye ACCESSIBILITY_LIVE_REGION_NONE, 114a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye ACCESSIBILITY_LIVE_REGION_POLITE, 115a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye ACCESSIBILITY_LIVE_REGION_ASSERTIVE 116a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye }) 117a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @Retention(RetentionPolicy.SOURCE) 118a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye private @interface AccessibilityLiveRegion {} 119a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye 120b5b909e4544fd4d1d0bdf445b8588a7233d5c71fAlan Viverette /** 121086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * Live region mode specifying that accessibility services should not 122086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * automatically announce changes to this view. This is the default live 123086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * region mode for most views. 124086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * <p> 125086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * Use with {@link ViewCompat#setAccessibilityLiveRegion(View, int)}. 126086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette */ 127086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette public static final int ACCESSIBILITY_LIVE_REGION_NONE = 0x00000000; 128086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette 129086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette /** 130086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * Live region mode specifying that accessibility services should announce 131086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * changes to this view. 132086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * <p> 133086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * Use with {@link ViewCompat#setAccessibilityLiveRegion(View, int)}. 134086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette */ 135086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette public static final int ACCESSIBILITY_LIVE_REGION_POLITE = 0x00000001; 136086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette 137086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette /** 138086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * Live region mode specifying that accessibility services should interrupt 139086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * ongoing speech to immediately announce changes to this view. 140086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * <p> 141086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * Use with {@link ViewCompat#setAccessibilityLiveRegion(View, int)}. 142086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette */ 143086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette public static final int ACCESSIBILITY_LIVE_REGION_ASSERTIVE = 0x00000002; 144086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette 145a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye /** @hide */ 146a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @IntDef({LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYER_TYPE_HARDWARE}) 147a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @Retention(RetentionPolicy.SOURCE) 148a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye private @interface LayerType {} 149a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye 150086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette /** 1518a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * Indicates that the view does not have a layer. 1528a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell */ 1538a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell public static final int LAYER_TYPE_NONE = 0; 1548a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell 1558a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell /** 1568a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <p>Indicates that the view has a software layer. A software layer is backed 1578a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * by a bitmap and causes the view to be rendered using Android's software 1588a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * rendering pipeline, even if hardware acceleration is enabled.</p> 1598a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * 1608a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <p>Software layers have various usages:</p> 1618a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <p>When the application is not using hardware acceleration, a software layer 1628a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * is useful to apply a specific color filter and/or blending mode and/or 1638a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * translucency to a view and all its children.</p> 1648a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <p>When the application is using hardware acceleration, a software layer 1658a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * is useful to render drawing primitives not supported by the hardware 1668a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * accelerated pipeline. It can also be used to cache a complex view tree 1678a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * into a texture and reduce the complexity of drawing operations. For instance, 1688a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * when animating a complex view tree with a translation, a software layer can 1698a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * be used to render the view tree only once.</p> 1708a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <p>Software layers should be avoided when the affected view tree updates 1718a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * often. Every update will require to re-render the software layer, which can 1728a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * potentially be slow (particularly when hardware acceleration is turned on 1738a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * since the layer will have to be uploaded into a hardware texture after every 1748a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * update.)</p> 1758a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell */ 1768a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell public static final int LAYER_TYPE_SOFTWARE = 1; 1778a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell 1788a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell /** 1798a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <p>Indicates that the view has a hardware layer. A hardware layer is backed 1808a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * by a hardware specific texture (generally Frame Buffer Objects or FBO on 1818a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * OpenGL hardware) and causes the view to be rendered using Android's hardware 1828a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * rendering pipeline, but only if hardware acceleration is turned on for the 1838a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * view hierarchy. When hardware acceleration is turned off, hardware layers 1848a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * behave exactly as {@link #LAYER_TYPE_SOFTWARE software layers}.</p> 1858a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * 1868a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <p>A hardware layer is useful to apply a specific color filter and/or 1878a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * blending mode and/or translucency to a view and all its children.</p> 1888a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <p>A hardware layer can be used to cache a complex view tree into a 1898a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * texture and reduce the complexity of drawing operations. For instance, 1908a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * when animating a complex view tree with a translation, a hardware layer can 1918a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * be used to render the view tree only once.</p> 1928a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <p>A hardware layer can also be used to increase the rendering quality when 1938a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * rotation transformations are applied on a view. It can also be used to 1948a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * prevent potential clipping issues when applying 3D transforms on a view.</p> 1958a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell */ 1968a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell public static final int LAYER_TYPE_HARDWARE = 2; 1978a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell 198a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye /** @hide */ 199a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @IntDef({ 200a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye LAYOUT_DIRECTION_LTR, 201a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye LAYOUT_DIRECTION_RTL, 202a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye LAYOUT_DIRECTION_INHERIT, 203a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye LAYOUT_DIRECTION_LOCALE}) 204a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @Retention(RetentionPolicy.SOURCE) 205a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye private @interface LayoutDirectionMode {} 206a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye 207a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye /** @hide */ 208a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @IntDef({ 209a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye LAYOUT_DIRECTION_LTR, 210a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye LAYOUT_DIRECTION_RTL 211a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye }) 212a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @Retention(RetentionPolicy.SOURCE) 213a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye private @interface ResolvedLayoutDirectionMode {} 214a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye 2151d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell /** 2161d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * Horizontal layout direction of this view is from Left to Right. 2171d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell */ 2181d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell public static final int LAYOUT_DIRECTION_LTR = 0; 2191d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell 2201d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell /** 2211d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * Horizontal layout direction of this view is from Right to Left. 2221d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell */ 2231d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell public static final int LAYOUT_DIRECTION_RTL = 1; 2241d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell 2251d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell /** 2261d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * Horizontal layout direction of this view is inherited from its parent. 2271d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * Use with {@link #setLayoutDirection}. 2281d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell */ 2291d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell public static final int LAYOUT_DIRECTION_INHERIT = 2; 2301d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell 2311d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell /** 2321d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * Horizontal layout direction of this view is from deduced from the default language 2331d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * script for the locale. Use with {@link #setLayoutDirection}. 2341d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell */ 2351d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell public static final int LAYOUT_DIRECTION_LOCALE = 3; 2361d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell 237b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell /** 238b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * Bits of {@link #getMeasuredWidthAndState} and 239b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * {@link #getMeasuredWidthAndState} that provide the actual measured size. 240b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell */ 241b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public static final int MEASURED_SIZE_MASK = 0x00ffffff; 242b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell 243b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell /** 244b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * Bits of {@link #getMeasuredWidthAndState} and 245b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * {@link #getMeasuredWidthAndState} that provide the additional state bits. 246b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell */ 247b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public static final int MEASURED_STATE_MASK = 0xff000000; 248b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell 249b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell /** 250b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * Bit shift of {@link #MEASURED_STATE_MASK} to get to the height bits 251b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * for functions that combine both width and height into a single int, 252b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * such as {@link #getMeasuredState} and the childState argument of 253b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * {@link #resolveSizeAndState(int, int, int)}. 254b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell */ 255b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public static final int MEASURED_HEIGHT_STATE_SHIFT = 16; 256b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell 257b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell /** 258b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * Bit of {@link #getMeasuredWidthAndState} and 259b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * {@link #getMeasuredWidthAndState} that indicates the measured size 260b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * is smaller that the space the view would like to have. 261b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell */ 262b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public static final int MEASURED_STATE_TOO_SMALL = 0x01000000; 263b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell 2641fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell /** 2651fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * Indicates no axis of view scrolling. 2661fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell */ 2671fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public static final int SCROLL_AXIS_NONE = 0; 2681fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 2691fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell /** 2701fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * Indicates scrolling along the horizontal axis. 2711fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell */ 2721fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public static final int SCROLL_AXIS_HORIZONTAL = 1 << 0; 2731fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 2741fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell /** 2751fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * Indicates scrolling along the vertical axis. 2761fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell */ 2771fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public static final int SCROLL_AXIS_VERTICAL = 1 << 1; 2781fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 279bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell interface ViewCompatImpl { 280bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell public boolean canScrollHorizontally(View v, int direction); 281bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell public boolean canScrollVertically(View v, int direction); 282560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell public int getOverScrollMode(View v); 283560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell public void setOverScrollMode(View v, int mode); 2849648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov public void onInitializeAccessibilityEvent(View v, AccessibilityEvent event); 2859648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov public void onPopulateAccessibilityEvent(View v, AccessibilityEvent event); 2869648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov public void onInitializeAccessibilityNodeInfo(View v, AccessibilityNodeInfoCompat info); 287d392c8cae159a3a9a416200f4e117634bdbf064eYigit Boyar public void setAccessibilityDelegate(View v, @Nullable AccessibilityDelegateCompat delegate); 288a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar public boolean hasAccessibilityDelegate(View v); 289c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell public boolean hasTransientState(View view); 290c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell public void setHasTransientState(View view, boolean hasTransientState); 291ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public void postInvalidateOnAnimation(View view); 292ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public void postInvalidateOnAnimation(View view, int left, int top, int right, int bottom); 293ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public void postOnAnimation(View view, Runnable action); 294ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public void postOnAnimationDelayed(View view, Runnable action, long delayMillis); 29525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public int getImportantForAccessibility(View view); 29625121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public void setImportantForAccessibility(View view, int mode); 2972e8572c7a0f35ca607038064d47d7f683ebed4efMaxim Bogatov public boolean isImportantForAccessibility(View view); 2980d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv public boolean performAccessibilityAction(View view, int action, Bundle arguments); 29925121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View view); 30014631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette public float getAlpha(View view); 3018a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell public void setLayerType(View view, int layerType, Paint paint); 30297341bdc5bea1d7bf777de65228039142d249f38Adam Powell public int getLayerType(View view); 3030af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov public int getLabelFor(View view); 3046debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell public void setLabelFor(View view, int id); 3056debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell public void setLayerPaint(View view, Paint paint); 3061d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell public int getLayoutDirection(View view); 3071d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell public void setLayoutDirection(View view, int layoutDirection); 3083cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell public ViewParent getParentForAccessibility(View view); 309c029e15f5a4709214cb433a562256586824a0f33Adam Powell public boolean isOpaque(View view); 310b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public int resolveSizeAndState(int size, int measureSpec, int childMeasuredState); 311b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public int getMeasuredWidthAndState(View view); 312b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public int getMeasuredHeightAndState(View view); 313b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public int getMeasuredState(View view); 314086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette public int getAccessibilityLiveRegion(View view); 315086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette public void setAccessibilityLiveRegion(View view, int mode); 316e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell public int getPaddingStart(View view); 317e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell public int getPaddingEnd(View view); 318e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell public void setPaddingRelative(View view, int start, int top, int end, int bottom); 319a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell public void dispatchStartTemporaryDetach(View view); 320a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell public void dispatchFinishTemporaryDetach(View view); 321d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getX(View view); 322d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getY(View view); 323d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getRotation(View view); 324d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getRotationX(View view); 325d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getRotationY(View view); 326d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getScaleX(View view); 327d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getScaleY(View view); 328c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell public float getTranslationX(View view); 329c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell public float getTranslationY(View view); 330f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell public int getMinimumWidth(View view); 331f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell public int getMinimumHeight(View view); 332d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public ViewPropertyAnimatorCompat animate(View view); 333d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setRotation(View view, float value); 334d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setRotationX(View view, float value); 335d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setRotationY(View view, float value); 336d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setScaleX(View view, float value); 337d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setScaleY(View view, float value); 338d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setTranslationX(View view, float value); 339d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setTranslationY(View view, float value); 340d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setX(View view, float value); 341d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setY(View view, float value); 342d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setAlpha(View view, float value); 343d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setPivotX(View view, float value); 344d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setPivotY(View view, float value); 345d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getPivotX(View view); 346d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getPivotY(View view); 34749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void setElevation(View view, float elevation); 34849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public float getElevation(View view); 34949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void setTranslationZ(View view, float translationZ); 35049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public float getTranslationZ(View view); 3516484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu public void setClipBounds(View view, Rect clipBounds); 3526484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu public Rect getClipBounds(View view); 3530bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu public void setTransitionName(View view, String transitionName); 3540bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu public String getTransitionName(View view); 35549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public int getWindowSystemUiVisibility(View view); 35649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void requestApplyInsets(View view); 3570f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira public void setChildrenDrawingOrderEnabled(ViewGroup viewGroup, boolean enabled); 358f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell public boolean getFitsSystemWindows(View view); 35903526560f132021f8fd7290259762ab362d4d567Doris Liu public boolean hasOverlappingRendering(View view); 3608c9ce11dec24a32f438406286404be7ac294011dChris Banes void setFitsSystemWindows(View view, boolean fitSystemWindows); 361bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell void jumpDrawablesToCurrentState(View v); 362ea4f700ac38424954c56df5138ff794def50b019Chris Banes void setOnApplyWindowInsetsListener(View view, OnApplyWindowInsetsListener listener); 3633040adc60c191aca58e34a01428db628604924c5Chris Banes WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets); 3643040adc60c191aca58e34a01428db628604924c5Chris Banes WindowInsetsCompat dispatchApplyWindowInsets(View v, WindowInsetsCompat insets); 3655e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes void setSaveFromParentEnabled(View view, boolean enabled); 366b645de790756e27bbe92d133216b7ac79cca7679Chris Banes void setActivated(View view, boolean activated); 367fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes boolean isPaddingRelative(View view); 368a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes ColorStateList getBackgroundTintList(View view); 369a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes void setBackgroundTintList(View view, ColorStateList tintList); 370a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes PorterDuff.Mode getBackgroundTintMode(View view); 371a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes void setBackgroundTintMode(View view, PorterDuff.Mode mode); 3721fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell void setNestedScrollingEnabled(View view, boolean enabled); 3731fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell boolean isNestedScrollingEnabled(View view); 3741fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell boolean startNestedScroll(View view, int axes); 3751fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell void stopNestedScroll(View view); 3761fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell boolean hasNestedScrollingParent(View view); 3771fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell boolean dispatchNestedScroll(View view, int dxConsumed, int dyConsumed, int dxUnconsumed, 3781fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell int dyUnconsumed, int[] offsetInWindow); 3791fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell boolean dispatchNestedPreScroll(View view, int dx, int dy, int[] consumed, 3801fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell int[] offsetInWindow); 3811fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell boolean dispatchNestedFling(View view, float velocityX, float velocityY, boolean consumed); 3821fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell boolean dispatchNestedPreFling(View view, float velocityX, float velocityY); 383f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes boolean isLaidOut(View view); 384a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell int combineMeasuredStates(int curState, int newState); 385a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell public float getZ(View view); 386f6610f183f0afe6e392dea804474f722d82083fdChris Banes public boolean isAttachedToWindow(View view); 387bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell } 388bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell 389bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell static class BaseViewCompatImpl implements ViewCompatImpl { 390a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell private Method mDispatchStartTemporaryDetach; 391a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell private Method mDispatchFinishTemporaryDetach; 392a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell private boolean mTempDetachBound; 393d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase WeakHashMap<View, ViewPropertyAnimatorCompat> mViewPropertyAnimatorCompatMap = null; 394d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 395a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell 396bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell public boolean canScrollHorizontally(View v, int direction) { 397f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar return (v instanceof ScrollingView) && 398f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar canScrollingViewScrollHorizontally((ScrollingView) v, direction); 399bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell } 400bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell public boolean canScrollVertically(View v, int direction) { 401f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar return (v instanceof ScrollingView) && 402f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar canScrollingViewScrollVertically((ScrollingView) v, direction); 403bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell } 404560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell public int getOverScrollMode(View v) { 405560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell return OVER_SCROLL_NEVER; 406560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell } 407560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell public void setOverScrollMode(View v, int mode) { 408560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell // Do nothing; API doesn't exist 409560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell } 4109648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov public void setAccessibilityDelegate(View v, AccessibilityDelegateCompat delegate) { 4119648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov // Do nothing; API doesn't exist 4129648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov } 413a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar 414a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar @Override 415a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar public boolean hasAccessibilityDelegate(View v) { 416a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar return false; 417a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar } 418a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar 4199648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov public void onPopulateAccessibilityEvent(View v, AccessibilityEvent event) { 4209648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov // Do nothing; API doesn't exist 4219648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov } 4229648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov public void onInitializeAccessibilityEvent(View v, AccessibilityEvent event) { 4239648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov // Do nothing; API doesn't exist 4249648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov } 4259648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov public void onInitializeAccessibilityNodeInfo(View v, AccessibilityNodeInfoCompat info) { 4269648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov // Do nothing; API doesn't exist 4279648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov } 428c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell public boolean hasTransientState(View view) { 429c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell // A view can't have transient state if transient state wasn't supported. 430c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell return false; 431c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell } 432c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell public void setHasTransientState(View view, boolean hasTransientState) { 433c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell // Do nothing; API doesn't exist 434c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell } 435ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public void postInvalidateOnAnimation(View view) { 436009b4ef9d97e1cc237477e3284fc305bb1438cc9Adam Powell view.invalidate(); 437ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 438ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public void postInvalidateOnAnimation(View view, int left, int top, int right, int bottom) { 439009b4ef9d97e1cc237477e3284fc305bb1438cc9Adam Powell view.invalidate(left, top, right, bottom); 440ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 441ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public void postOnAnimation(View view, Runnable action) { 442ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell view.postDelayed(action, getFrameTime()); 443ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 444ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public void postOnAnimationDelayed(View view, Runnable action, long delayMillis) { 445ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell view.postDelayed(action, getFrameTime() + delayMillis); 446ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 447ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell long getFrameTime() { 448ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell return FAKE_FRAME_TIME; 449ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 45025121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public int getImportantForAccessibility(View view) { 45125121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov return 0; 45225121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov } 45325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public void setImportantForAccessibility(View view, int mode) { 45425121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov 45525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov } 4562e8572c7a0f35ca607038064d47d7f683ebed4efMaxim Bogatov public boolean isImportantForAccessibility(View view) { 4572e8572c7a0f35ca607038064d47d7f683ebed4efMaxim Bogatov return true; 4582e8572c7a0f35ca607038064d47d7f683ebed4efMaxim Bogatov } 4590d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv public boolean performAccessibilityAction(View view, int action, Bundle arguments) { 4600d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv return false; 4610d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv } 46225121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View view) { 46325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov return null; 46425121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov } 46514631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette public float getAlpha(View view) { 46614631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette return 1.0f; 46714631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette } 4688a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell public void setLayerType(View view, int layerType, Paint paint) { 4696debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell // No-op until layers became available (HC) 4708a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell } 47197341bdc5bea1d7bf777de65228039142d249f38Adam Powell public int getLayerType(View view) { 47297341bdc5bea1d7bf777de65228039142d249f38Adam Powell return LAYER_TYPE_NONE; 47397341bdc5bea1d7bf777de65228039142d249f38Adam Powell } 4740af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov public int getLabelFor(View view) { 4750af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov return 0; 4760af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov } 4770af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov public void setLabelFor(View view, int id) { 4780af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov 4790af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov } 4806debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell public void setLayerPaint(View view, Paint p) { 4816debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell // No-op until layers became available (HC) 4826debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell } 4831d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell 4841d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell @Override 4851d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell public int getLayoutDirection(View view) { 4861d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell return LAYOUT_DIRECTION_LTR; 4871d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell } 4881d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell 4891d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell @Override 4901d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell public void setLayoutDirection(View view, int layoutDirection) { 4911d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell // No-op 4921d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell } 4933cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell 4943cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell @Override 4953cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell public ViewParent getParentForAccessibility(View view) { 4963cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell return view.getParent(); 4973cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell } 498c029e15f5a4709214cb433a562256586824a0f33Adam Powell 499c029e15f5a4709214cb433a562256586824a0f33Adam Powell @Override 500c029e15f5a4709214cb433a562256586824a0f33Adam Powell public boolean isOpaque(View view) { 501c029e15f5a4709214cb433a562256586824a0f33Adam Powell final Drawable bg = view.getBackground(); 502c029e15f5a4709214cb433a562256586824a0f33Adam Powell if (bg != null) { 503c029e15f5a4709214cb433a562256586824a0f33Adam Powell return bg.getOpacity() == PixelFormat.OPAQUE; 504c029e15f5a4709214cb433a562256586824a0f33Adam Powell } 505c029e15f5a4709214cb433a562256586824a0f33Adam Powell return false; 506c029e15f5a4709214cb433a562256586824a0f33Adam Powell } 507b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell 508b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public int resolveSizeAndState(int size, int measureSpec, int childMeasuredState) { 509b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell return View.resolveSize(size, measureSpec); 510b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell } 511b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell 512b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell @Override 513b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public int getMeasuredWidthAndState(View view) { 514b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell return view.getMeasuredWidth(); 515b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell } 516b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell 517b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell @Override 518b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public int getMeasuredHeightAndState(View view) { 519b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell return view.getMeasuredHeight(); 520b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell } 521b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell 522b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell @Override 523b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public int getMeasuredState(View view) { 524b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell return 0; 525b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell } 526086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette 527086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette @Override 528086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette public int getAccessibilityLiveRegion(View view) { 529086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette return ACCESSIBILITY_LIVE_REGION_NONE; 530086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette } 531086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette 532086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette @Override 533086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette public void setAccessibilityLiveRegion(View view, int mode) { 534086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette // No-op 535086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette } 536e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell 537e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell @Override 538e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell public int getPaddingStart(View view) { 539e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell return view.getPaddingLeft(); 540e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell } 541e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell 542e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell @Override 543e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell public int getPaddingEnd(View view) { 544e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell return view.getPaddingRight(); 545e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell } 546e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell 547e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell @Override 548e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell public void setPaddingRelative(View view, int start, int top, int end, int bottom) { 549e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell view.setPadding(start, top, end, bottom); 550e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell } 551a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell 552a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell @Override 553a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell public void dispatchStartTemporaryDetach(View view) { 554a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell if (!mTempDetachBound) { 555a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell bindTempDetach(); 556a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } 557a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell if (mDispatchStartTemporaryDetach != null) { 558a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell try { 559a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell mDispatchStartTemporaryDetach.invoke(view); 560a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } catch (Exception e) { 561a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell Log.d(TAG, "Error calling dispatchStartTemporaryDetach", e); 562a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } 563a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } else { 564a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell // Try this instead 565a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell view.onStartTemporaryDetach(); 566a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } 567a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } 568a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell 569a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell @Override 570a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell public void dispatchFinishTemporaryDetach(View view) { 571a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell if (!mTempDetachBound) { 572a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell bindTempDetach(); 573a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } 574a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell if (mDispatchFinishTemporaryDetach != null) { 575a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell try { 576a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell mDispatchFinishTemporaryDetach.invoke(view); 577a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } catch (Exception e) { 578a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell Log.d(TAG, "Error calling dispatchFinishTemporaryDetach", e); 579a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } 580a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } else { 581a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell // Try this instead 582a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell view.onFinishTemporaryDetach(); 583a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } 584a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } 585a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell 58603526560f132021f8fd7290259762ab362d4d567Doris Liu @Override 58703526560f132021f8fd7290259762ab362d4d567Doris Liu public boolean hasOverlappingRendering(View view) { 58803526560f132021f8fd7290259762ab362d4d567Doris Liu return true; 58903526560f132021f8fd7290259762ab362d4d567Doris Liu } 59003526560f132021f8fd7290259762ab362d4d567Doris Liu 591a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell private void bindTempDetach() { 592a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell try { 593a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell mDispatchStartTemporaryDetach = View.class.getDeclaredMethod( 594a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell "dispatchStartTemporaryDetach"); 595a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell mDispatchFinishTemporaryDetach = View.class.getDeclaredMethod( 596a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell "dispatchFinishTemporaryDetach"); 597a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } catch (NoSuchMethodException e) { 598a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell Log.e(TAG, "Couldn't find method", e); 599a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } 600a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell mTempDetachBound = true; 601a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } 602c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell 603c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell @Override 604c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell public float getTranslationX(View view) { 605c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell return 0; 606c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell } 607c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell 608c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell @Override 609c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell public float getTranslationY(View view) { 610c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell return 0; 611c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell } 612f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell 613f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell @Override 614d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getX(View view) { 615d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return 0; 616d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 617d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 618d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 619d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getY(View view) { 620d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return 0; 621d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 622d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 623d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 624d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getRotation(View view) { 625d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return 0; 626d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 627d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 628d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 629d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getRotationX(View view) { 630d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return 0; 631d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 632d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 633d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 634d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getRotationY(View view) { 635d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return 0; 636d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 637d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 638d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 639d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getScaleX(View view) { 640d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return 0; 641d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 642d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 643d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 644d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getScaleY(View view) { 645d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return 0; 646d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 647d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 648d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 649f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell public int getMinimumWidth(View view) { 650a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes return ViewCompatBase.getMinimumWidth(view); 651f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell } 652f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell 653f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell @Override 654f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell public int getMinimumHeight(View view) { 655a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes return ViewCompatBase.getMinimumHeight(view); 656f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell } 657d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 658d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 659d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public ViewPropertyAnimatorCompat animate(View view) { 660d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return new ViewPropertyAnimatorCompat(view); 661d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 662d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 663d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 664d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setRotation(View view, float value) { 665d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase // noop 666d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 667d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 668d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 669d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setTranslationX(View view, float value) { 670d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase // noop 671d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 672d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 673d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 674d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setTranslationY(View view, float value) { 675d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase // noop 676d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 677d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 678d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 679d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setAlpha(View view, float value) { 680d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase // noop 681d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 682d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 683d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 684d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setRotationX(View view, float value) { 685d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase // noop 686d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 687d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 688d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 689d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setRotationY(View view, float value) { 690d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase // noop 691d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 692d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 693d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 694d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setScaleX(View view, float value) { 695d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase // noop 696d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 697d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 698d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 699d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setScaleY(View view, float value) { 700d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase // noop 701d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 702d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 703d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 704d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setX(View view, float value) { 705d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase // noop 706d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 707d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 708d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 709d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setY(View view, float value) { 710d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase // noop 711d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 712d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 713d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 714d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setPivotX(View view, float value) { 715d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase // noop 716d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 717d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 718d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 719d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setPivotY(View view, float value) { 720d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase // noop 721d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 722d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 723d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 724d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getPivotX(View view) { 725d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return 0; 726d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 727d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 728d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 729d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getPivotY(View view) { 730d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return 0; 731d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 7320bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu 7330bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu @Override 7340bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu public void setTransitionName(View view, String transitionName) { 7350bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu } 7360bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu 7370bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu @Override 7380bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu public String getTransitionName(View view) { 7390bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu return null; 7400bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu } 74149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 74249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @Override 74349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public int getWindowSystemUiVisibility(View view) { 74449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return 0; 74549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 74649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 74749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @Override 74849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void requestApplyInsets(View view) { 74949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 75049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 75149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @Override 75249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void setElevation(View view, float elevation) { 75349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 75449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 75549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @Override 75649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public float getElevation(View view) { 75749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return 0f; 75849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 75949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 76049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @Override 76149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void setTranslationZ(View view, float translationZ) { 76249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 76349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 76449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @Override 76549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public float getTranslationZ(View view) { 76649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return 0f; 76749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 7680f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira 7690f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira @Override 7706484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu public void setClipBounds(View view, Rect clipBounds) { 7716484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu } 7726484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu 7736484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu @Override 7746484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu public Rect getClipBounds(View view) { 7756484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu return null; 7766484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu } 7776484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu 7786484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu @Override 7790f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira public void setChildrenDrawingOrderEnabled(ViewGroup viewGroup, boolean enabled) { 7800f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira // noop 7810f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira } 782f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell 783f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell @Override 784f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell public boolean getFitsSystemWindows(View view) { 785f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell return false; 786f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell } 787bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell 788bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell @Override 7898c9ce11dec24a32f438406286404be7ac294011dChris Banes public void setFitsSystemWindows(View view, boolean fitSystemWindows) { 7908c9ce11dec24a32f438406286404be7ac294011dChris Banes // noop 7918c9ce11dec24a32f438406286404be7ac294011dChris Banes } 7928c9ce11dec24a32f438406286404be7ac294011dChris Banes 7938c9ce11dec24a32f438406286404be7ac294011dChris Banes @Override 794bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell public void jumpDrawablesToCurrentState(View view) { 795bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell // Do nothing; API didn't exist. 796bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell } 797ea4f700ac38424954c56df5138ff794def50b019Chris Banes 798ea4f700ac38424954c56df5138ff794def50b019Chris Banes @Override 799ea4f700ac38424954c56df5138ff794def50b019Chris Banes public void setOnApplyWindowInsetsListener(View view, 800ea4f700ac38424954c56df5138ff794def50b019Chris Banes OnApplyWindowInsetsListener listener) { 801ea4f700ac38424954c56df5138ff794def50b019Chris Banes // noop 802ea4f700ac38424954c56df5138ff794def50b019Chris Banes } 8035e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes 8045e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes @Override 8053040adc60c191aca58e34a01428db628604924c5Chris Banes public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { 8063040adc60c191aca58e34a01428db628604924c5Chris Banes return insets; 8073040adc60c191aca58e34a01428db628604924c5Chris Banes } 8083040adc60c191aca58e34a01428db628604924c5Chris Banes 8093040adc60c191aca58e34a01428db628604924c5Chris Banes @Override 8103040adc60c191aca58e34a01428db628604924c5Chris Banes public WindowInsetsCompat dispatchApplyWindowInsets(View v, WindowInsetsCompat insets) { 8113040adc60c191aca58e34a01428db628604924c5Chris Banes return insets; 8123040adc60c191aca58e34a01428db628604924c5Chris Banes } 8133040adc60c191aca58e34a01428db628604924c5Chris Banes 8143040adc60c191aca58e34a01428db628604924c5Chris Banes @Override 8155e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes public void setSaveFromParentEnabled(View v, boolean enabled) { 8165e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes // noop 8175e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes } 818b645de790756e27bbe92d133216b7ac79cca7679Chris Banes 819b645de790756e27bbe92d133216b7ac79cca7679Chris Banes @Override 820b645de790756e27bbe92d133216b7ac79cca7679Chris Banes public void setActivated(View view, boolean activated) { 821b645de790756e27bbe92d133216b7ac79cca7679Chris Banes // noop 822b645de790756e27bbe92d133216b7ac79cca7679Chris Banes } 823fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes 824fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes @Override 825fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes public boolean isPaddingRelative(View view) { 826fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes return false; 827fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes } 828a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes 8291fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public void setNestedScrollingEnabled(View view, boolean enabled) { 8301fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell if (view instanceof NestedScrollingChild) { 8311fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell ((NestedScrollingChild) view).setNestedScrollingEnabled(enabled); 8321fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 8331fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 8341fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 8351fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 8361fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public boolean isNestedScrollingEnabled(View view) { 8371fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell if (view instanceof NestedScrollingChild) { 8381fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ((NestedScrollingChild) view).isNestedScrollingEnabled(); 8391fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 8401fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return false; 8411fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 8421fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 843a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes @Override 844a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes public ColorStateList getBackgroundTintList(View view) { 845a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes return ViewCompatBase.getBackgroundTintList(view); 846a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes } 847a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes 848a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes @Override 849a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes public void setBackgroundTintList(View view, ColorStateList tintList) { 850a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes ViewCompatBase.setBackgroundTintList(view, tintList); 851a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes } 852a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes 853a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes @Override 854a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes public void setBackgroundTintMode(View view, PorterDuff.Mode mode) { 855a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes ViewCompatBase.setBackgroundTintMode(view, mode); 856a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes } 857a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes 858a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes @Override 859a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes public PorterDuff.Mode getBackgroundTintMode(View view) { 860a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes return ViewCompatBase.getBackgroundTintMode(view); 861a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes } 862f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar 863f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar private boolean canScrollingViewScrollHorizontally(ScrollingView view, int direction) { 864f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar final int offset = view.computeHorizontalScrollOffset(); 865f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar final int range = view.computeHorizontalScrollRange() - 866f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar view.computeHorizontalScrollExtent(); 867f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar if (range == 0) return false; 868f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar if (direction < 0) { 869f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar return offset > 0; 870f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar } else { 871f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar return offset < range - 1; 872f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar } 873f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar } 874f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar 875f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar private boolean canScrollingViewScrollVertically(ScrollingView view, int direction) { 876f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar final int offset = view.computeVerticalScrollOffset(); 877f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar final int range = view.computeVerticalScrollRange() - 878f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar view.computeVerticalScrollExtent(); 879f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar if (range == 0) return false; 880f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar if (direction < 0) { 881f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar return offset > 0; 882f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar } else { 883f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar return offset < range - 1; 884f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar } 885f9b9ce76405345744bd57482d21c35a657836f87Yigit Boyar } 8861fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 8871fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public boolean startNestedScroll(View view, int axes) { 8881fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell if (view instanceof NestedScrollingChild) { 8891fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ((NestedScrollingChild) view).startNestedScroll(axes); 8901fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 8911fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return false; 8921fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 8931fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 8941fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 8951fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public void stopNestedScroll(View view) { 8961fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell if (view instanceof NestedScrollingChild) { 8971fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell ((NestedScrollingChild) view).stopNestedScroll(); 8981fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 8991fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 9001fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 9011fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 9021fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public boolean hasNestedScrollingParent(View view) { 9031fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell if (view instanceof NestedScrollingChild) { 9041fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ((NestedScrollingChild) view).hasNestedScrollingParent(); 9051fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 9061fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return false; 9071fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 9081fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 9091fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 9101fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public boolean dispatchNestedScroll(View view, int dxConsumed, int dyConsumed, 9111fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) { 9121fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell if (view instanceof NestedScrollingChild) { 9131fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ((NestedScrollingChild) view).dispatchNestedScroll(dxConsumed, dyConsumed, 9141fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell dxUnconsumed, dyUnconsumed, offsetInWindow); 9151fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 9161fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return false; 9171fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 9181fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 9191fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 9201fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public boolean dispatchNestedPreScroll(View view, int dx, int dy, 9211fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell int[] consumed, int[] offsetInWindow) { 9221fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell if (view instanceof NestedScrollingChild) { 9231fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ((NestedScrollingChild) view).dispatchNestedPreScroll(dx, dy, consumed, 9241fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell offsetInWindow); 9251fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 9261fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return false; 9271fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 9281fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 9291fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 9301fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public boolean dispatchNestedFling(View view, float velocityX, float velocityY, 9311fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell boolean consumed) { 9321fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell if (view instanceof NestedScrollingChild) { 9331fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ((NestedScrollingChild) view).dispatchNestedFling(velocityX, velocityY, 9341fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell consumed); 9351fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 9361fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return false; 9371fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 9381fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 9391fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 9401fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public boolean dispatchNestedPreFling(View view, float velocityX, float velocityY) { 9411fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell if (view instanceof NestedScrollingChild) { 9421fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ((NestedScrollingChild) view).dispatchNestedPreFling(velocityX, velocityY); 9431fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 9441fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return false; 9451fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 946f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes 947f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes @Override 948f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes public boolean isLaidOut(View view) { 949f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes return ViewCompatBase.isLaidOut(view); 950f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes } 951a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell 952a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell @Override 953a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell public int combineMeasuredStates(int curState, int newState) { 954a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell return curState | newState; 955a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell } 956a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell 957a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell @Override 958a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell public float getZ(View view) { 959a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell return getTranslationZ(view) + getElevation(view); 960a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell } 961f6610f183f0afe6e392dea804474f722d82083fdChris Banes 962f6610f183f0afe6e392dea804474f722d82083fdChris Banes @Override 963f6610f183f0afe6e392dea804474f722d82083fdChris Banes public boolean isAttachedToWindow(View view) { 964f6610f183f0afe6e392dea804474f722d82083fdChris Banes return ViewCompatBase.isAttachedToWindow(view); 965f6610f183f0afe6e392dea804474f722d82083fdChris Banes } 966bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell } 967bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell 968c029e15f5a4709214cb433a562256586824a0f33Adam Powell static class EclairMr1ViewCompatImpl extends BaseViewCompatImpl { 969c029e15f5a4709214cb433a562256586824a0f33Adam Powell @Override 970c029e15f5a4709214cb433a562256586824a0f33Adam Powell public boolean isOpaque(View view) { 971c029e15f5a4709214cb433a562256586824a0f33Adam Powell return ViewCompatEclairMr1.isOpaque(view); 972c029e15f5a4709214cb433a562256586824a0f33Adam Powell } 9730f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira 9740f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira @Override 9750f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira public void setChildrenDrawingOrderEnabled(ViewGroup viewGroup, boolean enabled) { 9760f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira ViewCompatEclairMr1.setChildrenDrawingOrderEnabled(viewGroup, enabled); 9770f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira } 978c029e15f5a4709214cb433a562256586824a0f33Adam Powell } 979c029e15f5a4709214cb433a562256586824a0f33Adam Powell 980c029e15f5a4709214cb433a562256586824a0f33Adam Powell static class GBViewCompatImpl extends EclairMr1ViewCompatImpl { 9819648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov @Override 982560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell public int getOverScrollMode(View v) { 983560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell return ViewCompatGingerbread.getOverScrollMode(v); 984560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell } 9859648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov @Override 986560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell public void setOverScrollMode(View v, int mode) { 987560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell ViewCompatGingerbread.setOverScrollMode(v, mode); 988560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell } 989560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell } 990560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell 991ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell static class HCViewCompatImpl extends GBViewCompatImpl { 99214631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette @Override 993ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell long getFrameTime() { 994ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell return ViewCompatHC.getFrameTime(); 995ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 99614631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette @Override 99714631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette public float getAlpha(View view) { 99814631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette return ViewCompatHC.getAlpha(view); 99914631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette } 100014631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette @Override 100114631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette public void setLayerType(View view, int layerType, Paint paint) { 10028a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell ViewCompatHC.setLayerType(view, layerType, paint); 10038a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell } 100414631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette @Override 100514631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette public int getLayerType(View view) { 100697341bdc5bea1d7bf777de65228039142d249f38Adam Powell return ViewCompatHC.getLayerType(view); 100797341bdc5bea1d7bf777de65228039142d249f38Adam Powell } 10086debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell @Override 10096debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell public void setLayerPaint(View view, Paint paint) { 10106debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell // Make sure the paint is correct; this will be cheap if it's the same 10116debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell // instance as was used to call setLayerType earlier. 10126debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell setLayerType(view, getLayerType(view), paint); 10136debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell // This is expensive, but the only way to accomplish this before JB-MR1. 10146debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell view.invalidate(); 10156debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell } 1016b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell @Override 1017b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public int resolveSizeAndState(int size, int measureSpec, int childMeasuredState) { 1018b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell return ViewCompatHC.resolveSizeAndState(size, measureSpec, childMeasuredState); 1019b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell } 1020b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell @Override 1021b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public int getMeasuredWidthAndState(View view) { 1022b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell return ViewCompatHC.getMeasuredWidthAndState(view); 1023b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell } 1024b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell @Override 1025b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public int getMeasuredHeightAndState(View view) { 1026b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell return ViewCompatHC.getMeasuredHeightAndState(view); 1027b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell } 1028b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell @Override 1029b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public int getMeasuredState(View view) { 1030b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell return ViewCompatHC.getMeasuredState(view); 1031b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell } 1032c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell @Override 1033c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell public float getTranslationX(View view) { 1034c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell return ViewCompatHC.getTranslationX(view); 1035c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell } 1036c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell @Override 1037c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell public float getTranslationY(View view) { 1038c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell return ViewCompatHC.getTranslationY(view); 1039c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell } 1040d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1041d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setTranslationX(View view, float value) { 1042d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase ViewCompatHC.setTranslationX(view, value); 1043d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1044d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1045d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setTranslationY(View view, float value) { 1046d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase ViewCompatHC.setTranslationY(view, value); 1047d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1048d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1049d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setAlpha(View view, float value) { 1050d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase ViewCompatHC.setAlpha(view, value); 1051d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1052d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1053d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setX(View view, float value) { 1054d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase ViewCompatHC.setX(view, value); 1055d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1056d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1057d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setY(View view, float value) { 1058d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase ViewCompatHC.setY(view, value); 1059d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1060d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1061d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setRotation(View view, float value) { 1062d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase ViewCompatHC.setRotation(view, value); 1063d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1064d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1065d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setRotationX(View view, float value) { 1066d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase ViewCompatHC.setRotationX(view, value); 1067d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1068d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1069d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setRotationY(View view, float value) { 1070d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase ViewCompatHC.setRotationY(view, value); 1071d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1072d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1073d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setScaleX(View view, float value) { 1074d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase ViewCompatHC.setScaleX(view, value); 1075d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1076d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1077d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setScaleY(View view, float value) { 1078d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase ViewCompatHC.setScaleY(view, value); 1079d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1080d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1081d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setPivotX(View view, float value) { 1082d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase ViewCompatHC.setPivotX(view, value); 1083d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1084d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1085d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public void setPivotY(View view, float value) { 1086d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase ViewCompatHC.setPivotY(view, value); 1087d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1088d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1089d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getX(View view) { 1090d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return ViewCompatHC.getX(view); 1091d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1092d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 1093d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1094d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getY(View view) { 1095d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return ViewCompatHC.getY(view); 1096d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1097d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 1098d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1099d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getRotation(View view) { 1100d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return ViewCompatHC.getRotation(view); 1101d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1102d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 1103d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1104d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getRotationX(View view) { 1105d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return ViewCompatHC.getRotationX(view); 1106d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1107d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 1108d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1109d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getRotationY(View view) { 1110d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return ViewCompatHC.getRotationY(view); 1111d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1112d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 1113d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1114d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getScaleX(View view) { 1115d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return ViewCompatHC.getScaleX(view); 1116d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1117d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 1118d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1119d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getScaleY(View view) { 1120d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return ViewCompatHC.getScaleY(view); 1121d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1122d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 1123d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1124d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getPivotX(View view) { 1125d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return ViewCompatHC.getPivotX(view); 1126d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1127d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1128d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public float getPivotY(View view) { 1129d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return ViewCompatHC.getPivotY(view); 1130d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1131bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell @Override 1132bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell public void jumpDrawablesToCurrentState(View view) { 1133bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell ViewCompatHC.jumpDrawablesToCurrentState(view); 1134bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell } 11355e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes 11365e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes @Override 11375e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes public void setSaveFromParentEnabled(View view, boolean enabled) { 11385e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes ViewCompatHC.setSaveFromParentEnabled(view, enabled); 11395e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes } 1140b645de790756e27bbe92d133216b7ac79cca7679Chris Banes 1141b645de790756e27bbe92d133216b7ac79cca7679Chris Banes @Override 1142b645de790756e27bbe92d133216b7ac79cca7679Chris Banes public void setActivated(View view, boolean activated) { 1143b645de790756e27bbe92d133216b7ac79cca7679Chris Banes ViewCompatHC.setActivated(view, activated); 1144b645de790756e27bbe92d133216b7ac79cca7679Chris Banes } 1145a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell 1146a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell @Override 1147a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell public int combineMeasuredStates(int curState, int newState) { 1148a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell return ViewCompatHC.combineMeasuredStates(curState, newState); 1149a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell } 1150ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 1151ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell 1152ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell static class ICSViewCompatImpl extends HCViewCompatImpl { 1153a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar static Field mAccessibilityDelegateField; 1154a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar static boolean accessibilityDelegateCheckFailed = false; 11559648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov @Override 1156bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell public boolean canScrollHorizontally(View v, int direction) { 1157bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell return ViewCompatICS.canScrollHorizontally(v, direction); 1158bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell } 11599648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov @Override 1160bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell public boolean canScrollVertically(View v, int direction) { 1161bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell return ViewCompatICS.canScrollVertically(v, direction); 1162bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell } 11639648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov @Override 11649648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov public void onPopulateAccessibilityEvent(View v, AccessibilityEvent event) { 11659648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov ViewCompatICS.onPopulateAccessibilityEvent(v, event); 11669648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov } 11679648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov @Override 11689648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov public void onInitializeAccessibilityEvent(View v, AccessibilityEvent event) { 11699648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov ViewCompatICS.onInitializeAccessibilityEvent(v, event); 11709648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov } 11719648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov @Override 11729648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov public void onInitializeAccessibilityNodeInfo(View v, AccessibilityNodeInfoCompat info) { 1173956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov ViewCompatICS.onInitializeAccessibilityNodeInfo(v, info.getInfo()); 11749648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov } 11759648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov @Override 1176d392c8cae159a3a9a416200f4e117634bdbf064eYigit Boyar public void setAccessibilityDelegate(View v, 1177d392c8cae159a3a9a416200f4e117634bdbf064eYigit Boyar @Nullable AccessibilityDelegateCompat delegate) { 1178d392c8cae159a3a9a416200f4e117634bdbf064eYigit Boyar ViewCompatICS.setAccessibilityDelegate(v, 1179d392c8cae159a3a9a416200f4e117634bdbf064eYigit Boyar delegate == null ? null : delegate.getBridge()); 11809648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov } 1181a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar 1182a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar @Override 1183a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar public boolean hasAccessibilityDelegate(View v) { 1184a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar if (accessibilityDelegateCheckFailed) { 1185a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar return false; // View implementation might have changed. 1186a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar } 1187a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar if (mAccessibilityDelegateField == null) { 1188a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar try { 1189a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar mAccessibilityDelegateField = View.class 1190a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar .getDeclaredField("mAccessibilityDelegate"); 1191a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar mAccessibilityDelegateField.setAccessible(true); 1192a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar } catch (Throwable t) { 1193a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar accessibilityDelegateCheckFailed = true; 1194a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar return false; 1195a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar } 1196a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar } 1197a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar try { 1198a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar return mAccessibilityDelegateField.get(v) != null; 1199a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar } catch (Throwable t) { 1200a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar accessibilityDelegateCheckFailed = true; 1201a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar return false; 1202a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar } 1203a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar } 1204a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar 1205d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase @Override 1206d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public ViewPropertyAnimatorCompat animate(View view) { 1207d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase if (mViewPropertyAnimatorCompatMap == null) { 1208d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase mViewPropertyAnimatorCompatMap = 1209d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase new WeakHashMap<View, ViewPropertyAnimatorCompat>(); 1210d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1211d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase ViewPropertyAnimatorCompat vpa = mViewPropertyAnimatorCompatMap.get(view); 1212d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase if (vpa == null) { 1213d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase vpa = new ViewPropertyAnimatorCompat(view); 1214d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase mViewPropertyAnimatorCompatMap.put(view, vpa); 1215d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 1216d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return vpa; 1217d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 12188c9ce11dec24a32f438406286404be7ac294011dChris Banes 12198c9ce11dec24a32f438406286404be7ac294011dChris Banes @Override 12208c9ce11dec24a32f438406286404be7ac294011dChris Banes public void setFitsSystemWindows(View view, boolean fitSystemWindows) { 12218c9ce11dec24a32f438406286404be7ac294011dChris Banes ViewCompatICS.setFitsSystemWindows(view, fitSystemWindows); 12228c9ce11dec24a32f438406286404be7ac294011dChris Banes } 1223bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell } 1224bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell 1225c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell static class JBViewCompatImpl extends ICSViewCompatImpl { 1226c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell @Override 1227c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell public boolean hasTransientState(View view) { 1228c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell return ViewCompatJB.hasTransientState(view); 1229c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell } 1230c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell @Override 1231c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell public void setHasTransientState(View view, boolean hasTransientState) { 1232c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell ViewCompatJB.setHasTransientState(view, hasTransientState); 1233c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell } 1234ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell @Override 1235ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public void postInvalidateOnAnimation(View view) { 1236ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell ViewCompatJB.postInvalidateOnAnimation(view); 1237ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 1238ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell @Override 1239ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public void postInvalidateOnAnimation(View view, int left, int top, int right, int bottom) { 1240ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell ViewCompatJB.postInvalidateOnAnimation(view, left, top, right, bottom); 1241ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 1242ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell @Override 1243ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public void postOnAnimation(View view, Runnable action) { 1244ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell ViewCompatJB.postOnAnimation(view, action); 1245ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 1246ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell @Override 1247ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public void postOnAnimationDelayed(View view, Runnable action, long delayMillis) { 1248ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell ViewCompatJB.postOnAnimationDelayed(view, action, delayMillis); 1249ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 125025121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov @Override 125125121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public int getImportantForAccessibility(View view) { 125225121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov return ViewCompatJB.getImportantForAccessibility(view); 125325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov } 125425121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov @Override 125525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public void setImportantForAccessibility(View view, int mode) { 125612ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette // IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS is not available 125712ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette // on this platform so replace with IMPORTANT_FOR_ACCESSIBILITY_NO 125812ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette // which is closer semantically. 125912ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette if (mode == IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS) { 126012ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette mode = IMPORTANT_FOR_ACCESSIBILITY_NO; 126112ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette } 126225121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov ViewCompatJB.setImportantForAccessibility(view, mode); 126325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov } 126425121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov @Override 12650d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv public boolean performAccessibilityAction(View view, int action, Bundle arguments) { 12660d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv return ViewCompatJB.performAccessibilityAction(view, action, arguments); 12670d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv } 12680d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv @Override 126925121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View view) { 127025121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov Object compat = ViewCompatJB.getAccessibilityNodeProvider(view); 127125121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov if (compat != null) { 127225121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov return new AccessibilityNodeProviderCompat(compat); 127325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov } 127425121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov return null; 127525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov } 12763cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell 12773cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell @Override 12783cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell public ViewParent getParentForAccessibility(View view) { 12793cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell return ViewCompatJB.getParentForAccessibility(view); 12803cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell } 1281f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell 1282f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell @Override 1283f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell public int getMinimumWidth(View view) { 1284f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell return ViewCompatJB.getMinimumWidth(view); 1285f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell } 1286f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell 1287f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell @Override 1288f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell public int getMinimumHeight(View view) { 1289f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell return ViewCompatJB.getMinimumHeight(view); 1290f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell } 129149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 129249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @Override 129349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void requestApplyInsets(View view) { 129449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes ViewCompatJB.requestApplyInsets(view); 129549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 1296f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell 1297f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell @Override 1298f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell public boolean getFitsSystemWindows(View view) { 1299f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell return ViewCompatJB.getFitsSystemWindows(view); 1300f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell } 130103526560f132021f8fd7290259762ab362d4d567Doris Liu 130203526560f132021f8fd7290259762ab362d4d567Doris Liu @Override 130303526560f132021f8fd7290259762ab362d4d567Doris Liu public boolean hasOverlappingRendering(View view) { 130403526560f132021f8fd7290259762ab362d4d567Doris Liu return ViewCompatJB.hasOverlappingRendering(view); 130503526560f132021f8fd7290259762ab362d4d567Doris Liu } 1306c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell } 1307c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell 13080af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov static class JbMr1ViewCompatImpl extends JBViewCompatImpl { 13090af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov 13100af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov @Override 13110af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov public int getLabelFor(View view) { 13120af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov return ViewCompatJellybeanMr1.getLabelFor(view); 13130af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov } 13140af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov 13150af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov @Override 13160af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov public void setLabelFor(View view, int id) { 13170af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov ViewCompatJellybeanMr1.setLabelFor(view, id); 13180af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov } 13196debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell 13206debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell @Override 13216debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell public void setLayerPaint(View view, Paint paint) { 13226debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell ViewCompatJellybeanMr1.setLayerPaint(view, paint); 13236debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell } 13241d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell 13251d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell @Override 13261d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell public int getLayoutDirection(View view) { 13271d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell return ViewCompatJellybeanMr1.getLayoutDirection(view); 13281d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell } 13291d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell 13301d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell @Override 13311d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell public void setLayoutDirection(View view, int layoutDirection) { 13321d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell ViewCompatJellybeanMr1.setLayoutDirection(view, layoutDirection); 13331d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell } 1334e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell 1335e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell @Override 1336e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell public int getPaddingStart(View view) { 1337e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell return ViewCompatJellybeanMr1.getPaddingStart(view); 1338e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell } 1339e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell 1340e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell @Override 1341e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell public int getPaddingEnd(View view) { 1342e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell return ViewCompatJellybeanMr1.getPaddingEnd(view); 1343e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell } 1344e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell 1345e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell @Override 1346e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell public void setPaddingRelative(View view, int start, int top, int end, int bottom) { 1347e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell ViewCompatJellybeanMr1.setPaddingRelative(view, start, top, end, bottom); 1348e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell } 134949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 135049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @Override 135149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public int getWindowSystemUiVisibility(View view) { 135249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return ViewCompatJellybeanMr1.getWindowSystemUiVisibility(view); 135349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 1354fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes 1355fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes @Override 1356fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes public boolean isPaddingRelative(View view) { 1357fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes return ViewCompatJellybeanMr1.isPaddingRelative(view); 1358fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes } 13590af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov } 13600af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov 13616484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu static class JbMr2ViewCompatImpl extends JbMr1ViewCompatImpl { 13626484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu @Override 13636484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu public void setClipBounds(View view, Rect clipBounds) { 13646484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu ViewCompatJellybeanMr2.setClipBounds(view, clipBounds); 13656484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu } 13666484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu 13676484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu @Override 13686484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu public Rect getClipBounds(View view) { 13696484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu return ViewCompatJellybeanMr2.getClipBounds(view); 13706484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu } 13716484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu } 13726484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu 13736484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu static class KitKatViewCompatImpl extends JbMr2ViewCompatImpl { 1374086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette @Override 1375086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette public int getAccessibilityLiveRegion(View view) { 1376086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette return ViewCompatKitKat.getAccessibilityLiveRegion(view); 1377086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette } 1378086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette 1379086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette @Override 1380086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette public void setAccessibilityLiveRegion(View view, int mode) { 1381086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette ViewCompatKitKat.setAccessibilityLiveRegion(view, mode); 1382086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette } 138312ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette 138412ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette @Override 138512ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette public void setImportantForAccessibility(View view, int mode) { 138612ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette ViewCompatJB.setImportantForAccessibility(view, mode); 138712ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette } 1388f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes 1389f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes @Override 1390f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes public boolean isLaidOut(View view) { 1391f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes return ViewCompatKitKat.isLaidOut(view); 1392f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes } 1393f6610f183f0afe6e392dea804474f722d82083fdChris Banes 1394f6610f183f0afe6e392dea804474f722d82083fdChris Banes @Override 1395f6610f183f0afe6e392dea804474f722d82083fdChris Banes public boolean isAttachedToWindow(View view) { 1396f6610f183f0afe6e392dea804474f722d82083fdChris Banes return ViewCompatKitKat.isAttachedToWindow(view); 1397f6610f183f0afe6e392dea804474f722d82083fdChris Banes } 1398086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette } 1399086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette 14001fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell static class LollipopViewCompatImpl extends KitKatViewCompatImpl { 14010bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu @Override 14020bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu public void setTransitionName(View view, String transitionName) { 14031fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell ViewCompatLollipop.setTransitionName(view, transitionName); 14040bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu } 14050bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu 14060bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu @Override 14070bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu public String getTransitionName(View view) { 14081fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.getTransitionName(view); 14090bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu } 141049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 141149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @Override 141249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void requestApplyInsets(View view) { 14131fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell ViewCompatLollipop.requestApplyInsets(view); 141449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 141549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 141649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @Override 141749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void setElevation(View view, float elevation) { 14181fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell ViewCompatLollipop.setElevation(view, elevation); 141949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 142049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 142149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @Override 142249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public float getElevation(View view) { 14231fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.getElevation(view); 142449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 142549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 142649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @Override 142749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public void setTranslationZ(View view, float translationZ) { 14281fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell ViewCompatLollipop.setTranslationZ(view, translationZ); 142949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 143049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 143149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes @Override 143249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public float getTranslationZ(View view) { 14331fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.getTranslationZ(view); 143449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 1435ea4f700ac38424954c56df5138ff794def50b019Chris Banes 1436ea4f700ac38424954c56df5138ff794def50b019Chris Banes @Override 1437ea4f700ac38424954c56df5138ff794def50b019Chris Banes public void setOnApplyWindowInsetsListener(View view, OnApplyWindowInsetsListener listener) { 14381fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell ViewCompatLollipop.setOnApplyWindowInsetsListener(view, listener); 14391fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 14401fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 14411fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 14421fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public void setNestedScrollingEnabled(View view, boolean enabled) { 14431fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell ViewCompatLollipop.setNestedScrollingEnabled(view, enabled); 14441fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 14451fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 14461fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 14471fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public boolean isNestedScrollingEnabled(View view) { 14481fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.isNestedScrollingEnabled(view); 14491fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 14501fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 14511fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 14521fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public boolean startNestedScroll(View view, int axes) { 14531fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.startNestedScroll(view, axes); 14541fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 14551fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 14561fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 14571fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public void stopNestedScroll(View view) { 14581fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell ViewCompatLollipop.stopNestedScroll(view); 14591fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 14601fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 14611fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 14621fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public boolean hasNestedScrollingParent(View view) { 14631fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.hasNestedScrollingParent(view); 14641fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 14651fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 14661fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 14671fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public boolean dispatchNestedScroll(View view, int dxConsumed, int dyConsumed, 14681fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) { 14691fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.dispatchNestedScroll(view, dxConsumed, dyConsumed, 14701fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell dxUnconsumed, dyUnconsumed, offsetInWindow); 14711fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 14721fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 14731fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 14741fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public boolean dispatchNestedPreScroll(View view, int dx, int dy, 14751fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell int[] consumed, int[] offsetInWindow) { 14761fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.dispatchNestedPreScroll(view, dx, dy, consumed, 14771fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell offsetInWindow); 14781fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 14791fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 14801fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 14811fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public boolean dispatchNestedFling(View view, float velocityX, float velocityY, 14821fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell boolean consumed) { 14831fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.dispatchNestedFling(view, velocityX, velocityY, consumed); 14841fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 14851fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 14861fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell @Override 14871fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public boolean dispatchNestedPreFling(View view, float velocityX, float velocityY) { 14881fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.dispatchNestedPreFling(view, velocityX, velocityY); 1489ea4f700ac38424954c56df5138ff794def50b019Chris Banes } 14902e8572c7a0f35ca607038064d47d7f683ebed4efMaxim Bogatov 14912e8572c7a0f35ca607038064d47d7f683ebed4efMaxim Bogatov @Override 14922e8572c7a0f35ca607038064d47d7f683ebed4efMaxim Bogatov public boolean isImportantForAccessibility(View view) { 14931fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.isImportantForAccessibility(view); 14942e8572c7a0f35ca607038064d47d7f683ebed4efMaxim Bogatov } 1495a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes 1496a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes @Override 1497a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes public ColorStateList getBackgroundTintList(View view) { 14981fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.getBackgroundTintList(view); 1499a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes } 1500a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes 1501a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes @Override 1502a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes public void setBackgroundTintList(View view, ColorStateList tintList) { 15031fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell ViewCompatLollipop.setBackgroundTintList(view, tintList); 1504a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes } 1505a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes 1506a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes @Override 1507a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes public void setBackgroundTintMode(View view, PorterDuff.Mode mode) { 15081fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell ViewCompatLollipop.setBackgroundTintMode(view, mode); 1509a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes } 1510a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes 1511a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes @Override 1512a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes public PorterDuff.Mode getBackgroundTintMode(View view) { 15131fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.getBackgroundTintMode(view); 1514a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes } 15153040adc60c191aca58e34a01428db628604924c5Chris Banes 15163040adc60c191aca58e34a01428db628604924c5Chris Banes @Override 15173040adc60c191aca58e34a01428db628604924c5Chris Banes public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { 15181fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.onApplyWindowInsets(v, insets); 15193040adc60c191aca58e34a01428db628604924c5Chris Banes } 15203040adc60c191aca58e34a01428db628604924c5Chris Banes 15213040adc60c191aca58e34a01428db628604924c5Chris Banes @Override 15223040adc60c191aca58e34a01428db628604924c5Chris Banes public WindowInsetsCompat dispatchApplyWindowInsets(View v, WindowInsetsCompat insets) { 15231fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return ViewCompatLollipop.dispatchApplyWindowInsets(v, insets); 15243040adc60c191aca58e34a01428db628604924c5Chris Banes } 1525a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell 1526a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell @Override 1527a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell public float getZ(View view) { 1528a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell return ViewCompatLollipop.getZ(view); 1529a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell } 15300bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu } 15310bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu 1532bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell static final ViewCompatImpl IMPL; 1533bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell static { 1534560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell final int version = android.os.Build.VERSION.SDK_INT; 1535a52784195525cdb1f2bb4d8dde1b8b314f480957Chet Haase if (version >= 21) { 15361fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell IMPL = new LollipopViewCompatImpl(); 15370bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu } else if (version >= 19) { 1538086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette IMPL = new KitKatViewCompatImpl(); 1539086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette } else if (version >= 17) { 15400af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov IMPL = new JbMr1ViewCompatImpl(); 15410af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov } else if (version >= 16) { 1542c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell IMPL = new JBViewCompatImpl(); 1543c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell } else if (version >= 14) { 1544bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell IMPL = new ICSViewCompatImpl(); 1545ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } else if (version >= 11) { 1546ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell IMPL = new HCViewCompatImpl(); 1547560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell } else if (version >= 9) { 1548560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell IMPL = new GBViewCompatImpl(); 15490f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira } else if (version >= 7) { 15500f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira IMPL = new EclairMr1ViewCompatImpl(); 1551bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell } else { 1552bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell IMPL = new BaseViewCompatImpl(); 1553bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell } 1554bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell } 1555bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell 15560574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov /** 15570574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Check if this view can be scrolled horizontally in a certain direction. 15580574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * 15590574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param v The View against which to invoke the method. 15600574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param direction Negative to check scrolling left, positive to check scrolling right. 15610574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @return true if this view can be scrolled in the specified direction, false otherwise. 15620574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov */ 1563bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell public static boolean canScrollHorizontally(View v, int direction) { 1564bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell return IMPL.canScrollHorizontally(v, direction); 1565bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell } 1566bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell 15670574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov /** 15680574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Check if this view can be scrolled vertically in a certain direction. 15690574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * 15700574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param v The View against which to invoke the method. 15710574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param direction Negative to check scrolling up, positive to check scrolling down. 15720574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @return true if this view can be scrolled in the specified direction, false otherwise. 15730574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov */ 1574bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell public static boolean canScrollVertically(View v, int direction) { 1575bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell return IMPL.canScrollVertically(v, direction); 1576bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell } 1577560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell 15780574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov /** 15790574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Returns the over-scroll mode for this view. The result will be 15800574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * one of {@link #OVER_SCROLL_ALWAYS} (default), {@link #OVER_SCROLL_IF_CONTENT_SCROLLS} 15810574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * (allow over-scrolling only if the view content is larger than the container), 15820574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * or {@link #OVER_SCROLL_NEVER}. 15830574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * 15840574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param v The View against which to invoke the method. 15850574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @return This view's over-scroll mode. 15860574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov */ 1587a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @OverScroll 1588560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell public static int getOverScrollMode(View v) { 1589560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell return IMPL.getOverScrollMode(v); 1590560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell } 1591560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell 15920574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov /** 15930574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Set the over-scroll mode for this view. Valid over-scroll modes are 15940574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * {@link #OVER_SCROLL_ALWAYS} (default), {@link #OVER_SCROLL_IF_CONTENT_SCROLLS} 15950574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * (allow over-scrolling only if the view content is larger than the container), 15960574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * or {@link #OVER_SCROLL_NEVER}. 15970574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * 15980574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Setting the over-scroll mode of a view will have an effect only if the 15990574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * view is capable of scrolling. 16000574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * 16010574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param v The View against which to invoke the method. 16020574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param overScrollMode The new over-scroll mode for this view. 16030574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov */ 1604a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye public static void setOverScrollMode(View v, @OverScroll int overScrollMode) { 16050574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov IMPL.setOverScrollMode(v, overScrollMode); 1606560114f591be31d0fb73c26a1ee1cc0a15184abaAdam Powell } 16079648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov 16080574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov /** 16090574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Called from {@link View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)} 16100574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * giving a chance to this View to populate the accessibility event with its 16110574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * text content. While this method is free to modify event 16120574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * attributes other than text content, doing so should normally be performed in 16130574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * {@link View#onInitializeAccessibilityEvent(AccessibilityEvent)}. 16140574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <p> 16150574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Example: Adding formatted date string to an accessibility event in addition 16160574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * to the text added by the super implementation: 16170574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <pre> public void onPopulateAccessibilityEvent(AccessibilityEvent event) { 16180574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * super.onPopulateAccessibilityEvent(event); 16190574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * final int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY; 16200574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * String selectedDateUtterance = DateUtils.formatDateTime(mContext, 16210574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * mCurrentDate.getTimeInMillis(), flags); 16220574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * event.getText().add(selectedDateUtterance); 16230574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * }</pre> 16240574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <p> 16250574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * If an {@link android.view.View.AccessibilityDelegate} has been specified via calling 16260574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * {@link View#setAccessibilityDelegate(android.view.View.AccessibilityDelegate)} its 16270574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * {@link android.view.View.AccessibilityDelegate#onPopulateAccessibilityEvent(View, 16280574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * AccessibilityEvent)} 16290574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * is responsible for handling this call. 16300574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * </p> 16310574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <p class="note"><strong>Note:</strong> Always call the super implementation before adding 16320574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * information to the event, in case the default implementation has basic information to add. 16330574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * </p> 16340574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * 16350574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param v The View against which to invoke the method. 16360574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param event The accessibility event which to populate. 16370574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * 16380574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @see View#sendAccessibilityEvent(int) 16390574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @see View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) 16400574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov */ 16419648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov public static void onPopulateAccessibilityEvent(View v, AccessibilityEvent event) { 16429648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov IMPL.onPopulateAccessibilityEvent(v, event); 16439648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov } 16449648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov 16450574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov /** 16460574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Initializes an {@link AccessibilityEvent} with information about 16470574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * this View which is the event source. In other words, the source of 16480574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * an accessibility event is the view whose state change triggered firing 16490574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * the event. 16500574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <p> 16510574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Example: Setting the password property of an event in addition 16520574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * to properties set by the super implementation: 16530574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <pre> public void onInitializeAccessibilityEvent(AccessibilityEvent event) { 16540574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * super.onInitializeAccessibilityEvent(event); 16550574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * event.setPassword(true); 16560574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * }</pre> 16570574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <p> 16580574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * If an {@link android.view.View.AccessibilityDelegate} has been specified via calling 16590574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * {@link View#setAccessibilityDelegate(android.view.View.AccessibilityDelegate)} its 16600574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * {@link android.view.View.AccessibilityDelegate#onInitializeAccessibilityEvent(View, 16610574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * AccessibilityEvent)} 16620574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * is responsible for handling this call. 16630574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * </p> 16640574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <p class="note"><strong>Note:</strong> Always call the super implementation before adding 16650574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * information to the event, in case the default implementation has basic information to add. 16660574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * </p> 16670574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * 16680574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param v The View against which to invoke the method. 16690574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param event The event to initialize. 16700574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * 16710574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @see View#sendAccessibilityEvent(int) 16720574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @see View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) 16730574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov */ 16749648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov public static void onInitializeAccessibilityEvent(View v, AccessibilityEvent event) { 16759648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov IMPL.onInitializeAccessibilityEvent(v, event); 16769648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov } 16779648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov 16780574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov /** 16790574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Initializes an {@link android.view.accessibility.AccessibilityNodeInfo} with information 16800574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * about this view. The base implementation sets: 16810574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <ul> 16820574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setParent(View)},</li> 16830574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setBoundsInParent(Rect)},</li> 16840574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setBoundsInScreen(Rect)},</li> 16850574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setPackageName(CharSequence)},</li> 16860574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setClassName(CharSequence)},</li> 16870574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setContentDescription(CharSequence)},</li> 16880574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setEnabled(boolean)},</li> 16890574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setClickable(boolean)},</li> 16900574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setFocusable(boolean)},</li> 16910574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setFocused(boolean)},</li> 16920574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setLongClickable(boolean)},</li> 16930574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <li>{@link android.view.accessibility.AccessibilityNodeInfo#setSelected(boolean)},</li> 16940574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * </ul> 16950574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <p> 16960574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Subclasses should override this method, call the super implementation, 16970574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * and set additional attributes. 16980574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * </p> 16990574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * <p> 17000574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * If an {@link android.view.View.AccessibilityDelegate} has been specified via calling 17010574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * {@link View#setAccessibilityDelegate(android.view.View.AccessibilityDelegate)} its 17020574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * {@link android.view.View.AccessibilityDelegate#onInitializeAccessibilityNodeInfo(View, 17030574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * android.view.accessibility.AccessibilityNodeInfo)} 17040574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * is responsible for handling this call. 17050574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * </p> 17060574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * 17070574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param v The View against which to invoke the method. 17080574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param info The instance to initialize. 17090574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov */ 17109648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov public static void onInitializeAccessibilityNodeInfo(View v, AccessibilityNodeInfoCompat info) { 17119648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov IMPL.onInitializeAccessibilityNodeInfo(v, info); 17129648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov } 17139648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov 17140574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov /** 17150574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * Sets a delegate for implementing accessibility support via compositon as 17160574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * opposed to inheritance. The delegate's primary use is for implementing 17170574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * backwards compatible widgets. For more details see 17180574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * {@link android.view.View.AccessibilityDelegate}. 17190574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * 17200574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param v The View against which to invoke the method. 17210574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @param delegate The delegate instance. 17220574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * 17230574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov * @see android.view.View.AccessibilityDelegate 17240574ca37da4619afe4e26753f5a1b4de314b6565Svetoslav Ganov */ 17259648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov public static void setAccessibilityDelegate(View v, AccessibilityDelegateCompat delegate) { 17269648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov IMPL.setAccessibilityDelegate(v, delegate); 17279648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov } 1728c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell 1729c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell /** 1730a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar * Checks whether provided View has an accessibility delegate attached to it. 1731a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar * 1732a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar * @param v The View instance to check 1733a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar * @return True if the View has an accessibility delegate 1734a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar */ 1735a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar public static boolean hasAccessibilityDelegate(View v) { 1736a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar return IMPL.hasAccessibilityDelegate(v); 1737a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar } 1738a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar 1739a910619e83d0052e1d81aa5fe532821a2f99d76cYigit Boyar /** 1740c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * Indicates whether the view is currently tracking transient state that the 1741c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * app should not need to concern itself with saving and restoring, but that 1742c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * the framework should take special note to preserve when possible. 1743c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * 1744c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * @param view View to check for transient state 1745c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * @return true if the view has transient state 1746c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell */ 1747c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell public static boolean hasTransientState(View view) { 1748c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell return IMPL.hasTransientState(view); 1749c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell } 1750c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell 1751c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell /** 1752c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * Set whether this view is currently tracking transient state that the 1753c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * framework should attempt to preserve when possible. 1754c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * 1755c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * @param view View tracking transient state 1756c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * @param hasTransientState true if this view has transient state 1757c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell */ 1758c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell public static void setHasTransientState(View view, boolean hasTransientState) { 1759c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell IMPL.setHasTransientState(view, hasTransientState); 1760c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell } 1761ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell 1762ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell /** 1763ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * <p>Cause an invalidate to happen on the next animation time step, typically the 1764ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * next display frame.</p> 1765ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * 1766ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * <p>This method can be invoked from outside of the UI thread 1767ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * only when this View is attached to a window.</p> 1768ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * 1769ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * @param view View to invalidate 1770ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell */ 1771ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public static void postInvalidateOnAnimation(View view) { 1772ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell IMPL.postInvalidateOnAnimation(view); 1773ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 1774ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell 1775ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell /** 1776ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * <p>Cause an invalidate of the specified area to happen on the next animation 1777ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * time step, typically the next display frame.</p> 1778ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * 1779ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * <p>This method can be invoked from outside of the UI thread 1780ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * only when this View is attached to a window.</p> 1781ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * 1782ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * @param view View to invalidate 1783ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * @param left The left coordinate of the rectangle to invalidate. 1784ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * @param top The top coordinate of the rectangle to invalidate. 1785ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * @param right The right coordinate of the rectangle to invalidate. 1786ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * @param bottom The bottom coordinate of the rectangle to invalidate. 1787ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell */ 1788ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public static void postInvalidateOnAnimation(View view, int left, int top, 1789ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell int right, int bottom) { 1790ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell IMPL.postInvalidateOnAnimation(view, left, top, right, bottom); 1791ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 1792ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell 1793ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell /** 1794ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * <p>Causes the Runnable to execute on the next animation time step. 1795ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * The runnable will be run on the user interface thread.</p> 1796ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * 1797ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * <p>This method can be invoked from outside of the UI thread 1798ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * only when this View is attached to a window.</p> 1799ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * 1800ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * @param view View to post this Runnable to 1801ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * @param action The Runnable that will be executed. 1802ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell */ 1803ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public static void postOnAnimation(View view, Runnable action) { 1804ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell IMPL.postOnAnimation(view, action); 1805ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 1806ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell 1807ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell /** 1808ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * <p>Causes the Runnable to execute on the next animation time step, 1809ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * after the specified amount of time elapses. 1810ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * The runnable will be run on the user interface thread.</p> 1811ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * 1812ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * <p>This method can be invoked from outside of the UI thread 1813ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * only when this View is attached to a window.</p> 1814ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * 1815ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * @param view The view to post this Runnable to 1816ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * @param action The Runnable that will be executed. 1817ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * @param delayMillis The delay (in milliseconds) until the Runnable 1818ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * will be executed. 1819ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell */ 1820ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public static void postOnAnimationDelayed(View view, Runnable action, long delayMillis) { 1821ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell IMPL.postOnAnimationDelayed(view, action, delayMillis); 1822ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 182325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov 182425121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov /** 182525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * Gets the mode for determining whether this View is important for accessibility 182625121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * which is if it fires accessibility events and if it is reported to 182725121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * accessibility services that query the screen. 182825121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * 182925121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * @param view The view whose property to get. 183025121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * @return The mode for determining whether a View is important for accessibility. 183125121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * 183225121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * @see #IMPORTANT_FOR_ACCESSIBILITY_YES 183325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * @see #IMPORTANT_FOR_ACCESSIBILITY_NO 1834b5b909e4544fd4d1d0bdf445b8588a7233d5c71fAlan Viverette * @see #IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS 183525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * @see #IMPORTANT_FOR_ACCESSIBILITY_AUTO 183625121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov */ 1837a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @ImportantForAccessibility 183825121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public static int getImportantForAccessibility(View view) { 183925121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov return IMPL.getImportantForAccessibility(view); 184025121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov } 184125121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov 184225121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov /** 184325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * Sets how to determine whether this view is important for accessibility 184425121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * which is if it fires accessibility events and if it is reported to 184525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * accessibility services that query the screen. 184612ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette * <p> 184712ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette * <em>Note:</em> If the current paltform version does not support the 184812ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette * {@link #IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS} mode, then 184912ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette * {@link #IMPORTANT_FOR_ACCESSIBILITY_NO} will be used as it is the 185012ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette * closest terms of semantics. 185112ba769d9e9b121829c69daf0f6350e808028a6aAlan Viverette * </p> 185225121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * 185325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * @param view The view whose property to set. 185425121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * @param mode How to determine whether this view is important for accessibility. 185525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * 185625121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * @see #IMPORTANT_FOR_ACCESSIBILITY_YES 185725121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * @see #IMPORTANT_FOR_ACCESSIBILITY_NO 1858b5b909e4544fd4d1d0bdf445b8588a7233d5c71fAlan Viverette * @see #IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS 185925121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * @see #IMPORTANT_FOR_ACCESSIBILITY_AUTO 186025121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov */ 1861a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye public static void setImportantForAccessibility(View view, 1862a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @ImportantForAccessibility int mode) { 186325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov IMPL.setImportantForAccessibility(view, mode); 186425121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov } 186525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov 186625121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov /** 18670d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv * Performs the specified accessibility action on the view. For 18680d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv * possible accessibility actions look at {@link AccessibilityNodeInfoCompat}. 18690d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv * <p> 18700d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv * If an {@link AccessibilityDelegateCompat} has been specified via calling 18710d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv * {@link #setAccessibilityDelegate(View, AccessibilityDelegateCompat)} its 18720d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv * {@link AccessibilityDelegateCompat#performAccessibilityAction(View, int, Bundle)} 18730d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv * is responsible for handling this call. 18740d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv * </p> 18750d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv * 18760d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv * @param action The action to perform. 18770d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv * @param arguments Optional action arguments. 18780d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv * @return Whether the action was performed. 18790d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv */ 18800d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv public static boolean performAccessibilityAction(View view, int action, Bundle arguments) { 18810d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv return IMPL.performAccessibilityAction(view, action, arguments); 18820d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv } 18830d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv 18840d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv /** 188525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * Gets the provider for managing a virtual view hierarchy rooted at this View 1886e13cf48dc33e3865794d145ae8f4daed0bb2274bSvetoslav Ganov * and reported to {@link android.accessibilityservice.AccessibilityService}s 188725121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * that explore the window content. 188825121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * <p> 188925121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * If this method returns an instance, this instance is responsible for managing 1890e13cf48dc33e3865794d145ae8f4daed0bb2274bSvetoslav Ganov * {@link AccessibilityNodeInfoCompat}s describing the virtual sub-tree rooted at 189125121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * this View including the one representing the View itself. Similarly the returned 189225121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * instance is responsible for performing accessibility actions on any virtual 189325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * view or the root view itself. 189425121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * </p> 189525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * <p> 189625121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * If an {@link AccessibilityDelegateCompat} has been specified via calling 189714631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette * {@link #setAccessibilityDelegate(View, AccessibilityDelegateCompat)} its 189825121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * {@link AccessibilityDelegateCompat#getAccessibilityNodeProvider(View)} 189925121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * is responsible for handling this call. 190025121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * </p> 190125121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * 190225121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * @param view The view whose property to get. 190325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * @return The provider. 190425121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * 190525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov * @see AccessibilityNodeProviderCompat 190625121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov */ 190725121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public static AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View view) { 190825121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov return IMPL.getAccessibilityNodeProvider(view); 190925121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov } 19108a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell 19118a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell /** 191214631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette * The opacity of the view. This is a value from 0 to 1, where 0 means the view is 191314631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette * completely transparent and 1 means the view is completely opaque. 191414631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette * 191514631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette * <p>By default this is 1.0f. Prior to API 11, the returned value is always 1.0f. 191614631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette * @return The opacity of the view. 191714631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette */ 191814631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette public static float getAlpha(View view) { 191914631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette return IMPL.getAlpha(view); 192014631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette } 192114631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette 192214631dece1ee9ddd5f430aa4b8eb048e27065d71Alan Viverette /** 19238a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <p>Specifies the type of layer backing this view. The layer can be 19248a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * {@link #LAYER_TYPE_NONE disabled}, {@link #LAYER_TYPE_SOFTWARE software} or 19258a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * {@link #LAYER_TYPE_HARDWARE hardware}.</p> 19268a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * 19278a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <p>A layer is associated with an optional {@link android.graphics.Paint} 19288a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * instance that controls how the layer is composed on screen. The following 19298a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * properties of the paint are taken into account when composing the layer:</p> 19308a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <ul> 19318a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <li>{@link android.graphics.Paint#getAlpha() Translucency (alpha)}</li> 19328a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <li>{@link android.graphics.Paint#getXfermode() Blending mode}</li> 19338a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <li>{@link android.graphics.Paint#getColorFilter() Color filter}</li> 19348a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * </ul> 19358a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * 19368a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <p>If this view has an alpha value set to < 1.0 by calling 19378a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * setAlpha(float), the alpha value of the layer's paint is replaced by 19388a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * this view's alpha value. Calling setAlpha(float) is therefore 19398a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * equivalent to setting a hardware layer on this view and providing a paint with 19408a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * the desired alpha value.<p> 19418a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * 19428a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * <p>Refer to the documentation of {@link #LAYER_TYPE_NONE disabled}, 19438a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * {@link #LAYER_TYPE_SOFTWARE software} and {@link #LAYER_TYPE_HARDWARE hardware} 19448a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * for more information on when and how to use layers.</p> 19458a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * 19468a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * @param layerType The ype of layer to use with this view, must be one of 19478a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * {@link #LAYER_TYPE_NONE}, {@link #LAYER_TYPE_SOFTWARE} or 19488a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * {@link #LAYER_TYPE_HARDWARE} 19498a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * @param paint The paint used to compose the layer. This argument is optional 19508a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * and can be null. It is ignored when the layer type is 19518a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * {@link #LAYER_TYPE_NONE} 19528a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * 19538a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * @param view View to set the layer type for 19548a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * @param layerType The type of layer to use with this view, must be one of 19558a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * {@link #LAYER_TYPE_NONE}, {@link #LAYER_TYPE_SOFTWARE} or 19568a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * {@link #LAYER_TYPE_HARDWARE} 19578a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * @param paint The paint used to compose the layer. This argument is optional 19588a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * and can be null. It is ignored when the layer type is 19598a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell * {@link #LAYER_TYPE_NONE} 19608a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell */ 1961a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye public static void setLayerType(View view, @LayerType int layerType, Paint paint) { 19628a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell IMPL.setLayerType(view, layerType, paint); 19638a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell } 196497341bdc5bea1d7bf777de65228039142d249f38Adam Powell 196597341bdc5bea1d7bf777de65228039142d249f38Adam Powell /** 196697341bdc5bea1d7bf777de65228039142d249f38Adam Powell * Indicates what type of layer is currently associated with this view. By default 196797341bdc5bea1d7bf777de65228039142d249f38Adam Powell * a view does not have a layer, and the layer type is {@link #LAYER_TYPE_NONE}. 196897341bdc5bea1d7bf777de65228039142d249f38Adam Powell * Refer to the documentation of 196997341bdc5bea1d7bf777de65228039142d249f38Adam Powell * {@link #setLayerType(android.view.View, int, android.graphics.Paint)} 197097341bdc5bea1d7bf777de65228039142d249f38Adam Powell * for more information on the different types of layers. 197197341bdc5bea1d7bf777de65228039142d249f38Adam Powell * 197297341bdc5bea1d7bf777de65228039142d249f38Adam Powell * @param view The view to fetch the layer type from 197397341bdc5bea1d7bf777de65228039142d249f38Adam Powell * @return {@link #LAYER_TYPE_NONE}, {@link #LAYER_TYPE_SOFTWARE} or 197497341bdc5bea1d7bf777de65228039142d249f38Adam Powell * {@link #LAYER_TYPE_HARDWARE} 197597341bdc5bea1d7bf777de65228039142d249f38Adam Powell * 197697341bdc5bea1d7bf777de65228039142d249f38Adam Powell * @see #setLayerType(android.view.View, int, android.graphics.Paint) 197797341bdc5bea1d7bf777de65228039142d249f38Adam Powell * @see #LAYER_TYPE_NONE 197897341bdc5bea1d7bf777de65228039142d249f38Adam Powell * @see #LAYER_TYPE_SOFTWARE 197997341bdc5bea1d7bf777de65228039142d249f38Adam Powell * @see #LAYER_TYPE_HARDWARE 198097341bdc5bea1d7bf777de65228039142d249f38Adam Powell */ 1981a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @LayerType 198297341bdc5bea1d7bf777de65228039142d249f38Adam Powell public static int getLayerType(View view) { 198397341bdc5bea1d7bf777de65228039142d249f38Adam Powell return IMPL.getLayerType(view); 198497341bdc5bea1d7bf777de65228039142d249f38Adam Powell } 19850af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov 19860af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov /** 19870af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov * Gets the id of a view for which a given view serves as a label for 19880af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov * accessibility purposes. 19890af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov * 19900af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov * @param view The view on which to invoke the corresponding method. 19910af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov * @return The labeled view id. 19920af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov */ 19930af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov public static int getLabelFor(View view) { 19940af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov return IMPL.getLabelFor(view); 19950af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov } 19960af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov 19970af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov /** 19980af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov * Sets the id of a view for which a given view serves as a label for 19990af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov * accessibility purposes. 20000af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov * 20010af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov * @param view The view on which to invoke the corresponding method. 20020af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov * @param labeledId The labeled view id. 20030af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov */ 2004a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye public static void setLabelFor(View view, @IdRes int labeledId) { 20050af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov IMPL.setLabelFor(view, labeledId); 20060af001b9e0d173f6b9836e66539bf764b897c36fSvetoslav Ganov } 20076debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell 20086debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell /** 20096debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * Updates the {@link Paint} object used with the current layer (used only if the current 20106debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * layer type is not set to {@link #LAYER_TYPE_NONE}). Changed properties of the Paint 20116debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * provided to {@link #setLayerType(android.view.View, int, android.graphics.Paint)} 20126debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * will be used the next time the View is redrawn, but 20136debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * {@link #setLayerPaint(android.view.View, android.graphics.Paint)} 20146debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * must be called to ensure that the view gets redrawn immediately. 20156debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * 20166debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * <p>A layer is associated with an optional {@link android.graphics.Paint} 20176debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * instance that controls how the layer is composed on screen. The following 20186debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * properties of the paint are taken into account when composing the layer:</p> 20196debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * <ul> 20206debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * <li>{@link android.graphics.Paint#getAlpha() Translucency (alpha)}</li> 20216debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * <li>{@link android.graphics.Paint#getXfermode() Blending mode}</li> 20226debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * <li>{@link android.graphics.Paint#getColorFilter() Color filter}</li> 20236debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * </ul> 20246debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * 20256debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * <p>If this view has an alpha value set to < 1.0 by calling 20266debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * View#setAlpha(float), the alpha value of the layer's paint is replaced by 20276debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * this view's alpha value. Calling View#setAlpha(float) is therefore 20286debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * equivalent to setting a hardware layer on this view and providing a paint with 20296debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * the desired alpha value.</p> 20306debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * 20311d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * @param view View to set a layer paint for 20326debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * @param paint The paint used to compose the layer. This argument is optional 20336debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * and can be null. It is ignored when the layer type is 20346debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * {@link #LAYER_TYPE_NONE} 20356debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell * 20361d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * @see #setLayerType(View, int, android.graphics.Paint) 20376debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell */ 20386debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell public static void setLayerPaint(View view, Paint paint) { 20396debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell IMPL.setLayerPaint(view, paint); 20406debd2bbcae1cd285d2e21db633998b7801f9f40Adam Powell } 20411d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell 20421d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell /** 20431d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * Returns the resolved layout direction for this view. 20441d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * 20451d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * @param view View to get layout direction for 20461d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * @return {@link #LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns 20471d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * {@link #LAYOUT_DIRECTION_LTR} if the layout direction is not RTL. 20481d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * 20491d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * For compatibility, this will return {@link #LAYOUT_DIRECTION_LTR} if API version 20501d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * is lower than Jellybean MR1 (API 17) 20511d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell */ 2052a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @ResolvedLayoutDirectionMode 20531d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell public static int getLayoutDirection(View view) { 20541d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell return IMPL.getLayoutDirection(view); 20551d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell } 20561d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell 20571d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell /** 20581d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * Set the layout direction for this view. This will propagate a reset of layout direction 20591d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * resolution to the view's children and resolve layout direction for this view. 20601d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * 20611d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * @param view View to set layout direction for 20621d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * @param layoutDirection the layout direction to set. Should be one of: 20631d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * 20641d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * {@link #LAYOUT_DIRECTION_LTR}, 20651d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * {@link #LAYOUT_DIRECTION_RTL}, 20661d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * {@link #LAYOUT_DIRECTION_INHERIT}, 20671d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * {@link #LAYOUT_DIRECTION_LOCALE}. 20681d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * 20691d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * Resolution will be done if the value is set to LAYOUT_DIRECTION_INHERIT. The resolution 20701d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * proceeds up the parent chain of the view to get the value. If there is no parent, then it 20711d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell * will return the default {@link #LAYOUT_DIRECTION_LTR}. 20721d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell */ 2073a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye public static void setLayoutDirection(View view, @LayoutDirectionMode int layoutDirection) { 20741d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell IMPL.setLayoutDirection(view, layoutDirection); 20751d26501f0c8e9f3577f651938a03f6b3a1a672c7Adam Powell } 20763cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell 20773cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell /** 20783cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell * Gets the parent for accessibility purposes. Note that the parent for 20793cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell * accessibility is not necessary the immediate parent. It is the first 20803cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell * predecessor that is important for accessibility. 20813cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell * 20823cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell * @param view View to retrieve parent for 20833cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell * @return The parent for use in accessibility inspection 20843cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell */ 20853cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell public static ViewParent getParentForAccessibility(View view) { 20863cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell return IMPL.getParentForAccessibility(view); 20873cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell } 2088c029e15f5a4709214cb433a562256586824a0f33Adam Powell 2089c029e15f5a4709214cb433a562256586824a0f33Adam Powell /** 2090c029e15f5a4709214cb433a562256586824a0f33Adam Powell * Indicates whether this View is opaque. An opaque View guarantees that it will 2091c029e15f5a4709214cb433a562256586824a0f33Adam Powell * draw all the pixels overlapping its bounds using a fully opaque color. 2092c029e15f5a4709214cb433a562256586824a0f33Adam Powell * 2093c029e15f5a4709214cb433a562256586824a0f33Adam Powell * On API 7 and above this will call View's true isOpaque method. On previous platform 2094c029e15f5a4709214cb433a562256586824a0f33Adam Powell * versions it will check the opacity of the view's background drawable if present. 2095c029e15f5a4709214cb433a562256586824a0f33Adam Powell * 2096c029e15f5a4709214cb433a562256586824a0f33Adam Powell * @return True if this View is guaranteed to be fully opaque, false otherwise. 2097c029e15f5a4709214cb433a562256586824a0f33Adam Powell */ 2098c029e15f5a4709214cb433a562256586824a0f33Adam Powell public static boolean isOpaque(View view) { 2099c029e15f5a4709214cb433a562256586824a0f33Adam Powell return IMPL.isOpaque(view); 2100c029e15f5a4709214cb433a562256586824a0f33Adam Powell } 2101b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell 2102b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell /** 2103b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * Utility to reconcile a desired size and state, with constraints imposed 2104b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * by a MeasureSpec. Will take the desired size, unless a different size 2105b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * is imposed by the constraints. The returned value is a compound integer, 2106b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * with the resolved size in the {@link #MEASURED_SIZE_MASK} bits and 2107b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * optionally the bit {@link #MEASURED_STATE_TOO_SMALL} set if the resulting 2108b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * size is smaller than the size the view wants to be. 2109b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * 2110b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * @param size How big the view wants to be 2111b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * @param measureSpec Constraints imposed by the parent 2112b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * @return Size information bit mask as defined by 2113b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * {@link #MEASURED_SIZE_MASK} and {@link #MEASURED_STATE_TOO_SMALL}. 2114b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell */ 2115b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public static int resolveSizeAndState(int size, int measureSpec, int childMeasuredState) { 2116b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell return IMPL.resolveSizeAndState(size, measureSpec, childMeasuredState); 2117b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell } 2118b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell 2119b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell /** 2120b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * Return the full width measurement information for this view as computed 2121b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * by the most recent call to {@link android.view.View#measure(int, int)}. 2122b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * This result is a bit mask as defined by {@link #MEASURED_SIZE_MASK} and 2123b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * {@link #MEASURED_STATE_TOO_SMALL}. 2124b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * This should be used during measurement and layout calculations only. Use 2125b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * {@link android.view.View#getWidth()} to see how wide a view is after layout. 2126b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * 2127b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * @return The measured width of this view as a bit mask. 2128b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell */ 2129b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public static int getMeasuredWidthAndState(View view) { 2130b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell return IMPL.getMeasuredWidthAndState(view); 2131b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell } 2132b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell 2133b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell /** 2134b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * Return the full height measurement information for this view as computed 2135b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * by the most recent call to {@link android.view.View#measure(int, int)}. 2136b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * This result is a bit mask as defined by {@link #MEASURED_SIZE_MASK} and 2137b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * {@link #MEASURED_STATE_TOO_SMALL}. 2138b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * This should be used during measurement and layout calculations only. Use 2139b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * {@link android.view.View#getHeight()} to see how wide a view is after layout. 2140b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * 2141b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * @return The measured width of this view as a bit mask. 2142b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell */ 2143b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public static int getMeasuredHeightAndState(View view) { 2144b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell return IMPL.getMeasuredHeightAndState(view); 2145b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell } 2146b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell 2147b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell /** 2148b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * Return only the state bits of {@link #getMeasuredWidthAndState} 2149b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * and {@link #getMeasuredHeightAndState}, combined into one integer. 2150b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * The width component is in the regular bits {@link #MEASURED_STATE_MASK} 2151b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * and the height component is at the shifted bits 2152b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell * {@link #MEASURED_HEIGHT_STATE_SHIFT}>>{@link #MEASURED_STATE_MASK}. 2153b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell */ 2154b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell public static int getMeasuredState(View view) { 2155b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell return IMPL.getMeasuredState(view); 2156b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell } 2157086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette 2158086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette /** 2159a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell * Merge two states as returned by {@link #getMeasuredState(View)}. 2160a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell * @param curState The current state as returned from a view or the result 2161a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell * of combining multiple views. 2162a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell * @param newState The new view state to combine. 2163a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell * @return Returns a new integer reflecting the combination of the two 2164a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell * states. 2165a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell */ 2166a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell public static int combineMeasuredStates(int curState, int newState) { 2167a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell return IMPL.combineMeasuredStates(curState, newState); 2168a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell } 2169a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell 2170a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell /** 2171086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * Gets the live region mode for the specified View. 2172086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * 2173086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * @param view The view from which to obtain the live region mode 2174086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * @return The live region mode for the view. 2175086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * 2176086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * @see ViewCompat#setAccessibilityLiveRegion(View, int) 2177086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette */ 2178a3ff3273e976adf19770651dcf473fa67b38eb22Tor Norbye @AccessibilityLiveRegion 2179e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell public static int getAccessibilityLiveRegion(View view) { 2180086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette return IMPL.getAccessibilityLiveRegion(view); 2181086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette } 2182086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette 2183086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette /** 2184086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * Sets the live region mode for the specified view. This indicates to 2185086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * accessibility services whether they should automatically notify the user 2186086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * about changes to the view's content description or text, or to the 2187086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * content descriptions or text of the view's children (where applicable). 2188086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * <p> 2189086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * For example, in a login screen with a TextView that displays an "incorrect 2190086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * password" notification, that view should be marked as a live region with 2191086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * mode {@link #ACCESSIBILITY_LIVE_REGION_POLITE}. 2192086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * <p> 2193086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * To disable change notifications for this view, use 2194086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * {@link #ACCESSIBILITY_LIVE_REGION_NONE}. This is the default live region 2195086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * mode for most views. 2196086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * <p> 2197086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * To indicate that the user should be notified of changes, use 2198086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * {@link #ACCESSIBILITY_LIVE_REGION_POLITE}. 2199086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * <p> 2200086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * If the view's changes should interrupt ongoing speech and notify the user 2201086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * immediately, use {@link #ACCESSIBILITY_LIVE_REGION_ASSERTIVE}. 2202086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * 2203086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * @param view The view on which to set the live region mode 2204086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * @param mode The live region mode for this view, one of: 2205086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * <ul> 2206086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * <li>{@link #ACCESSIBILITY_LIVE_REGION_NONE} 2207086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * <li>{@link #ACCESSIBILITY_LIVE_REGION_POLITE} 2208086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * <li>{@link #ACCESSIBILITY_LIVE_REGION_ASSERTIVE} 2209086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette * </ul> 2210086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette */ 22115e8ef0460dfca1e3806b491fa886995baf0cfe9cTor Norbye public static void setAccessibilityLiveRegion(View view, @AccessibilityLiveRegion int mode) { 2212086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette IMPL.setAccessibilityLiveRegion(view, mode); 2213086e7db1ab6ef49b4b7974c471b70f81b2d13aefAlan Viverette } 2214e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell 2215e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell /** 2216e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * Returns the start padding of the specified view depending on its resolved layout direction. 2217e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * If there are inset and enabled scrollbars, this value may include the space 2218e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * required to display the scrollbars as well. 2219e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * 2220e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * @param view The view to get padding for 2221e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * @return the start padding in pixels 2222e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell */ 2223e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell public static int getPaddingStart(View view) { 2224e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell return IMPL.getPaddingStart(view); 2225e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell } 2226e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell 2227e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell /** 2228e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * Returns the end padding of the specified view depending on its resolved layout direction. 2229e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * If there are inset and enabled scrollbars, this value may include the space 2230e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * required to display the scrollbars as well. 2231e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * 2232e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * @param view The view to get padding for 2233e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * @return the end padding in pixels 2234e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell */ 2235e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell public static int getPaddingEnd(View view) { 2236e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell return IMPL.getPaddingEnd(view); 2237e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell } 2238e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell 2239e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell /** 2240e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * Sets the relative padding. The view may add on the space required to display 2241e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * the scrollbars, depending on the style and visibility of the scrollbars. 2242e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * So the values returned from {@link #getPaddingStart}, {@link View#getPaddingTop}, 2243e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * {@link #getPaddingEnd} and {@link View#getPaddingBottom} may be different 2244e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * from the values set in this call. 2245e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * 2246e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * @param view The view on which to set relative padding 2247e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * @param start the start padding in pixels 2248e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * @param top the top padding in pixels 2249e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * @param end the end padding in pixels 2250e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell * @param bottom the bottom padding in pixels 2251e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell */ 2252e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell public static void setPaddingRelative(View view, int start, int top, int end, int bottom) { 2253e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell IMPL.setPaddingRelative(view, start, top, end, bottom); 2254e096e4c526feeb64833b5a75649ec36d75d7cbbfAdam Powell } 2255a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell 2256a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell /** 2257a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell * Notify a view that it is being temporarily detached. 2258a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell */ 2259a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell public static void dispatchStartTemporaryDetach(View view) { 2260a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell IMPL.dispatchStartTemporaryDetach(view); 2261a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } 2262a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell 2263a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell /** 2264a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell * Notify a view that its temporary detach has ended; the view is now reattached. 2265a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell */ 2266a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell public static void dispatchFinishTemporaryDetach(View view) { 2267a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell IMPL.dispatchFinishTemporaryDetach(view); 2268a6613ed42e0dee0cac3da01f5450e2d61c270b52Adam Powell } 2269c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell 2270c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell /** 2271c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell * The horizontal location of this view relative to its {@link View#getLeft() left} position. 2272c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell * This position is post-layout, in addition to wherever the object's 2273c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell * layout placed it. 2274c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell * 2275d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will return 0.</p> 2276d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2277c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell * @return The horizontal position of this view relative to its left position, in pixels. 2278c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell */ 2279f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell public static float getTranslationX(View view) { 2280f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell return IMPL.getTranslationX(view); 2281c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell } 2282c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell 2283c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell /** 2284c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell * The vertical location of this view relative to its {@link View#getTop() left} position. 2285c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell * This position is post-layout, in addition to wherever the object's 2286c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell * layout placed it. 2287c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell * 2288d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will return 0.</p> 2289d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2290c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell * @return The vertical position of this view relative to its top position, in pixels. 2291c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell */ 2292f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell public static float getTranslationY(View view) { 2293f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell return IMPL.getTranslationY(view); 2294f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell } 2295f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell 2296f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell /** 2297f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell * Returns the minimum width of the view. 2298f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell * 2299f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell * <p>Prior to API 16 this will return 0.</p> 2300f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell * 2301f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell * @return the minimum width the view will try to be. 2302f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell */ 2303f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell public static int getMinimumWidth(View view) { 2304f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell return IMPL.getMinimumWidth(view); 2305f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell } 2306f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell 2307f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell /** 2308f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell * Returns the minimum height of the view. 2309f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell * 2310f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell * <p>Prior to API 16 this will return 0.</p> 2311f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell * 2312f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell * @return the minimum height the view will try to be. 2313f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell */ 2314f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell public static int getMinimumHeight(View view) { 2315f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell return IMPL.getMinimumHeight(view); 2316c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell } 2317d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2318d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2319d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * This method returns a ViewPropertyAnimator object, which can be used to animate 2320d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * specific properties on this View. 2321d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2322d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 14, this method will do nothing.</p> 2323d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2324d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @return ViewPropertyAnimator The ViewPropertyAnimator associated with this View. 2325d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 2326d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public static ViewPropertyAnimatorCompat animate(View view) { 2327d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return IMPL.animate(view); 2328d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2329d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2330d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2331d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Sets the horizontal location of this view relative to its left position. 2332d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * This effectively positions the object post-layout, in addition to wherever the object's 2333d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * layout placed it. 2334d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2335d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will have no effect.</p> 2336d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2337d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @param value The horizontal position of this view relative to its left position, 2338d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * in pixels. 2339d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 2340d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public static void setTranslationX(View view, float value) { 2341d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase IMPL.setTranslationX(view, value); 2342d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2343d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2344d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2345d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Sets the vertical location of this view relative to its top position. 2346d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * This effectively positions the object post-layout, in addition to wherever the object's 2347d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * layout placed it. 2348d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2349d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will have no effect.</p> 2350d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2351d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @param value The vertical position of this view relative to its top position, 2352d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * in pixels. 2353d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2354d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @attr ref android.R.styleable#View_translationY 2355d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 2356d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public static void setTranslationY(View view, float value) { 2357d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase IMPL.setTranslationY(view, value); 2358d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2359d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2360d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2361d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Sets the opacity of the view. This is a value from 0 to 1, where 0 means the view is 2362d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * completely transparent and 1 means the view is completely opaque.</p> 2363d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2364d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p> Note that setting alpha to a translucent value (0 < alpha < 1) can have significant 2365d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * performance implications, especially for large views. It is best to use the alpha property 2366d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * sparingly and transiently, as in the case of fading animations.</p> 2367d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2368d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will have no effect.</p> 2369d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2370d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @param value The opacity of the view. 2371d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 237270acb0c19be3831a2080e4f902324de16bfbf62eTor Norbye public static void setAlpha(View view, @FloatRange(from=0.0, to=1.0) float value) { 2373d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase IMPL.setAlpha(view, value); 2374d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2375d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2376d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2377d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Sets the visual x position of this view, in pixels. This is equivalent to setting the 2378d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * {@link #setTranslationX(View, float) translationX} property to be the difference between 2379d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * the x value passed in and the current left property of the view as determined 2380d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * by the layout bounds. 2381d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2382d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will have no effect.</p> 2383d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2384d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @param value The visual x position of this view, in pixels. 2385d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 2386d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public static void setX(View view, float value) { 2387d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase IMPL.setX(view, value); 2388d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2389d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2390d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2391d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Sets the visual y position of this view, in pixels. This is equivalent to setting the 2392d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * {@link #setTranslationY(View, float) translationY} property to be the difference between 2393d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * the y value passed in and the current top property of the view as determined by the 2394d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * layout bounds. 2395d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2396d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will have no effect.</p> 2397d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2398d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @param value The visual y position of this view, in pixels. 2399d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 2400d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public static void setY(View view, float value) { 2401d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase IMPL.setY(view, value); 2402d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2403d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2404d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2405d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Sets the degrees that the view is rotated around the pivot point. Increasing values 2406d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * result in clockwise rotation. 2407d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2408d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will have no effect.</p> 2409d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2410d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @param value The degrees of rotation. 2411d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 2412d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public static void setRotation(View view, float value) { 2413d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase IMPL.setRotation(view, value); 2414d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2415d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2416d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2417d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Sets the degrees that the view is rotated around the horizontal axis through the pivot point. 2418d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Increasing values result in clockwise rotation from the viewpoint of looking down the 2419d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * x axis. 2420d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2421d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will have no effect.</p> 2422d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2423d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @param value The degrees of X rotation. 2424d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 2425d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public static void setRotationX(View view, float value) { 2426d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase IMPL.setRotationX(view, value); 2427d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2428d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2429d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2430d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Sets the degrees that the view is rotated around the vertical axis through the pivot point. 2431d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Increasing values result in counter-clockwise rotation from the viewpoint of looking 2432d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * down the y axis. 2433d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2434d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will have no effect.</p> 2435d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2436d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @param value The degrees of Y rotation. 2437d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 2438d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public static void setRotationY(View view, float value) { 2439d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase IMPL.setRotationY(view, value); 2440d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2441d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2442d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2443d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Sets the amount that the view is scaled in x around the pivot point, as a proportion of 2444d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * the view's unscaled width. A value of 1 means that no scaling is applied. 2445d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2446d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will have no effect.</p> 2447d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2448d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @param value The scaling factor. 2449d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 2450d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public static void setScaleX(View view, float value) { 2451d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase IMPL.setScaleX(view, value); 2452d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2453d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2454d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2455d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Sets the amount that the view is scaled in Y around the pivot point, as a proportion of 2456d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * the view's unscaled width. A value of 1 means that no scaling is applied. 2457d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2458d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will have no effect.</p> 2459d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2460d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @param value The scaling factor. 2461d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 2462d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase public static void setScaleY(View view, float value) { 2463d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase IMPL.setScaleY(view, value); 2464d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2465d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2466d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2467d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * The x location of the point around which the view is 2468d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * {@link #setRotation(View, float) rotated} and {@link #setScaleX(View, float) scaled}. 2469d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2470d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will have no effect.</p> 2471d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2472d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 2473f633e9521802aeadfea1aec5724348b8eafd1b1dDake Gu public static float getPivotX(View view) { 2474d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return IMPL.getPivotX(view); 2475d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2476d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2477d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2478d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Sets the x location of the point around which the view is 2479d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * {@link #setRotation(View, float) rotated} and {@link #setScaleX(View, float) scaled}. 2480d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * By default, the pivot point is centered on the object. 2481d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Setting this property disables this behavior and causes the view to use only the 2482d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * explicitly set pivotX and pivotY values. 2483d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2484d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will have no effect.</p> 2485d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2486d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @param value The x location of the pivot point. 2487d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 2488f633e9521802aeadfea1aec5724348b8eafd1b1dDake Gu public static void setPivotX(View view, float value) { 2489d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase IMPL.setPivotX(view, value); 2490d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2491d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2492d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2493d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * The y location of the point around which the view is {@link #setRotation(View, 2494d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * float) rotated} and {@link #setScaleY(View, float) scaled}. 2495d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2496d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will return 0.</p> 2497d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2498d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @return The y location of the pivot point. 2499d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 2500f633e9521802aeadfea1aec5724348b8eafd1b1dDake Gu public static float getPivotY(View view) { 2501d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return IMPL.getPivotY(view); 2502d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2503d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2504d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase /** 2505d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Sets the y location of the point around which the view is 2506d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * {@link #setRotation(View, float) rotated} and {@link #setScaleY(View, float) scaled}. 2507d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * By default, the pivot point is centered on the object. 2508d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * Setting this property disables this behavior and causes the view to use only the 2509d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * explicitly set pivotX and pivotY values. 2510d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2511d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * <p>Prior to API 11 this will have no effect.</p> 2512d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * 2513d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase * @param value The y location of the pivot point. 2514d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase */ 2515f633e9521802aeadfea1aec5724348b8eafd1b1dDake Gu public static void setPivotY(View view, float value) { 2516d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase IMPL.setPivotX(view, value); 2517d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2518d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2519f633e9521802aeadfea1aec5724348b8eafd1b1dDake Gu public static float getRotation(View view) { 2520d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return IMPL.getRotation(view); 2521d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2522d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2523f633e9521802aeadfea1aec5724348b8eafd1b1dDake Gu public static float getRotationX(View view) { 2524d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return IMPL.getRotationX(view); 2525d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2526d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2527f633e9521802aeadfea1aec5724348b8eafd1b1dDake Gu public static float getRotationY(View view) { 2528d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return IMPL.getRotationY(view); 2529d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2530d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2531f633e9521802aeadfea1aec5724348b8eafd1b1dDake Gu public static float getScaleX(View view) { 2532d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return IMPL.getScaleX(view); 2533d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2534d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2535f633e9521802aeadfea1aec5724348b8eafd1b1dDake Gu public static float getScaleY(View view) { 2536d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return IMPL.getScaleY(view); 2537d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2538d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2539f633e9521802aeadfea1aec5724348b8eafd1b1dDake Gu public static float getX(View view) { 2540d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return IMPL.getX(view); 2541d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2542d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 2543f633e9521802aeadfea1aec5724348b8eafd1b1dDake Gu public static float getY(View view) { 2544d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase return IMPL.getY(view); 2545d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase } 2546d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase 25470bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu /** 254849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Sets the base elevation of this view, in pixels. 254949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 255049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static void setElevation(View view, float elevation) { 255149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes IMPL.setElevation(view, elevation); 255249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 255349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 255449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 255549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The base elevation of this view relative to its parent, in pixels. 255649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 255749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @return The base depth position of the view, in pixels. 255849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 255949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static float getElevation(View view) { 256049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return IMPL.getElevation(view); 256149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 256249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 256349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 256449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Sets the depth location of this view relative to its {@link #getElevation(View) elevation}. 256549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 256649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static void setTranslationZ(View view, float translationZ) { 256749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes IMPL.setTranslationZ(view, translationZ); 256849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 256949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 257049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 257149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * The depth location of this view relative to its {@link #getElevation(View) elevation}. 257249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * 257349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @return The depth of this view relative to its elevation. 257449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 257549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static float getTranslationZ(View view) { 257649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return IMPL.getTranslationZ(view); 257749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 257849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 257949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 25800bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu * Sets the name of the View to be used to identify Views in Transitions. 25810bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu * Names should be unique in the View hierarchy. 25820bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu * 25830bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu * @param view The View against which to invoke the method. 25840bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu * @param transitionName The name of the View to uniquely identify it for Transitions. 25850bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu */ 2586f633e9521802aeadfea1aec5724348b8eafd1b1dDake Gu public static void setTransitionName(View view, String transitionName) { 25870bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu IMPL.setTransitionName(view, transitionName); 25880bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu } 25890bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu 25900bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu /** 25910bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu * Returns the name of the View to be used to identify Views in Transitions. 25920bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu * Names should be unique in the View hierarchy. 25930bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu * 25940bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu * <p>This returns null if the View has not been given a name.</p> 25950bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu * 25960bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu * @param view The View against which to invoke the method. 25970bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu * @return The name used of the View to be used to identify Views in Transitions or null 25980bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu * if no name has been given. 25990bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu */ 2600f633e9521802aeadfea1aec5724348b8eafd1b1dDake Gu public static String getTransitionName(View view) { 26010bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu return IMPL.getTransitionName(view); 26020bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu } 26030bf2af5f2d3034e7c8e4aadb076d258122906e1dDake Gu 260449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 260549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Returns the current system UI visibility that is currently set for the entire window. 260649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 260749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static int getWindowSystemUiVisibility(View view) { 260849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes return IMPL.getWindowSystemUiVisibility(view); 260949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 261049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 261149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes /** 261249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Ask that a new dispatch of {@code View.onApplyWindowInsets(WindowInsets)} be performed. This 261349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * falls back to {@code View.requestFitSystemWindows()} where available. 261449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes */ 261549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static void requestApplyInsets(View view) { 261649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes IMPL.requestApplyInsets(view); 261749c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 261849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 26190f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira /** 26200f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira * Tells the ViewGroup whether to draw its children in the order defined by the method 2621bb3bde43f526bd40bed541da6c8256d0dde328a4Mindy Pereira * {@code ViewGroup.getChildDrawingOrder(int, int)}. 26220f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira * 26230f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira * @param enabled true if the order of the children when drawing is determined by 2624bb3bde43f526bd40bed541da6c8256d0dde328a4Mindy Pereira * {@link ViewGroup#getChildDrawingOrder(int, int)}, false otherwise 26250f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira * 26260f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira * <p>Prior to API 7 this will have no effect.</p> 26270f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira */ 26280f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira public static void setChildrenDrawingOrderEnabled(ViewGroup viewGroup, boolean enabled) { 26290f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira IMPL.setChildrenDrawingOrderEnabled(viewGroup, enabled); 26300f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira } 26310f3c6c1be783cfb67a2d11a1a027de0847949064Mindy Pereira 2632f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell /** 2633f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell * Returns true if this view should adapt to fit system window insets. This method will always 2634f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell * return false before API 16 (Jellybean). 2635f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell */ 2636f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell public static boolean getFitsSystemWindows(View v) { 2637f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell return IMPL.getFitsSystemWindows(v); 2638f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell } 2639f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell 2640bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell /** 26418c9ce11dec24a32f438406286404be7ac294011dChris Banes * Sets whether or not this view should account for system screen decorations 26428c9ce11dec24a32f438406286404be7ac294011dChris Banes * such as the status bar and inset its content; that is, controlling whether 26438c9ce11dec24a32f438406286404be7ac294011dChris Banes * the default implementation of {@link View#fitSystemWindows(Rect)} will be 26448c9ce11dec24a32f438406286404be7ac294011dChris Banes * executed. See that method for more details. 26458c9ce11dec24a32f438406286404be7ac294011dChris Banes */ 26468c9ce11dec24a32f438406286404be7ac294011dChris Banes public static void setFitsSystemWindows(View view, boolean fitSystemWindows) { 26478c9ce11dec24a32f438406286404be7ac294011dChris Banes IMPL.setFitsSystemWindows(view, fitSystemWindows); 26488c9ce11dec24a32f438406286404be7ac294011dChris Banes } 26498c9ce11dec24a32f438406286404be7ac294011dChris Banes 26508c9ce11dec24a32f438406286404be7ac294011dChris Banes /** 2651bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell * On API 11 devices and above, call <code>Drawable.jumpToCurrentState()</code> 2652bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell * on all Drawable objects associated with this view. 2653bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell * <p> 2654bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell * On API 21 and above, also calls <code>StateListAnimator#jumpToCurrentState()</code> 2655bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell * if there is a StateListAnimator attached to this view. 2656bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell */ 2657bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell public static void jumpDrawablesToCurrentState(View v) { 2658bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell IMPL.jumpDrawablesToCurrentState(v); 2659bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell } 2660bc7c32772fbc966091181ce7fa933ca4083679acAdam Powell 2661ea4f700ac38424954c56df5138ff794def50b019Chris Banes /** 2662ea4f700ac38424954c56df5138ff794def50b019Chris Banes * Set an {@link OnApplyWindowInsetsListener} to take over the policy for applying 2663ea4f700ac38424954c56df5138ff794def50b019Chris Banes * window insets to this view. This will only take effect on devices with API 21 or above. 2664ea4f700ac38424954c56df5138ff794def50b019Chris Banes */ 2665ea4f700ac38424954c56df5138ff794def50b019Chris Banes public static void setOnApplyWindowInsetsListener(View v, 2666ea4f700ac38424954c56df5138ff794def50b019Chris Banes OnApplyWindowInsetsListener listener) { 2667ea4f700ac38424954c56df5138ff794def50b019Chris Banes IMPL.setOnApplyWindowInsetsListener(v, listener); 2668ea4f700ac38424954c56df5138ff794def50b019Chris Banes } 2669ea4f700ac38424954c56df5138ff794def50b019Chris Banes 26705e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes /** 26713040adc60c191aca58e34a01428db628604924c5Chris Banes * Called when the view should apply {@link WindowInsetsCompat} according to its internal policy. 26723040adc60c191aca58e34a01428db628604924c5Chris Banes * 26733040adc60c191aca58e34a01428db628604924c5Chris Banes * <p>Clients may supply an {@link OnApplyWindowInsetsListener} to a view. If one is set 26743040adc60c191aca58e34a01428db628604924c5Chris Banes * it will be called during dispatch instead of this method. The listener may optionally 26753040adc60c191aca58e34a01428db628604924c5Chris Banes * call this method from its own implementation if it wishes to apply the view's default 26763040adc60c191aca58e34a01428db628604924c5Chris Banes * insets policy in addition to its own.</p> 26773040adc60c191aca58e34a01428db628604924c5Chris Banes * 26783040adc60c191aca58e34a01428db628604924c5Chris Banes * @param view The View against which to invoke the method. 26793040adc60c191aca58e34a01428db628604924c5Chris Banes * @param insets Insets to apply 26803040adc60c191aca58e34a01428db628604924c5Chris Banes * @return The supplied insets with any applied insets consumed 26813040adc60c191aca58e34a01428db628604924c5Chris Banes */ 26823040adc60c191aca58e34a01428db628604924c5Chris Banes public static WindowInsetsCompat onApplyWindowInsets(View view, WindowInsetsCompat insets) { 26833040adc60c191aca58e34a01428db628604924c5Chris Banes return IMPL.onApplyWindowInsets(view, insets); 26843040adc60c191aca58e34a01428db628604924c5Chris Banes } 26853040adc60c191aca58e34a01428db628604924c5Chris Banes 26863040adc60c191aca58e34a01428db628604924c5Chris Banes /** 26873040adc60c191aca58e34a01428db628604924c5Chris Banes * Request to apply the given window insets to this view or another view in its subtree. 26883040adc60c191aca58e34a01428db628604924c5Chris Banes * 26893040adc60c191aca58e34a01428db628604924c5Chris Banes * <p>This method should be called by clients wishing to apply insets corresponding to areas 26903040adc60c191aca58e34a01428db628604924c5Chris Banes * obscured by window decorations or overlays. This can include the status and navigation bars, 26913040adc60c191aca58e34a01428db628604924c5Chris Banes * action bars, input methods and more. New inset categories may be added in the future. 26923040adc60c191aca58e34a01428db628604924c5Chris Banes * The method returns the insets provided minus any that were applied by this view or its 26933040adc60c191aca58e34a01428db628604924c5Chris Banes * children.</p> 26943040adc60c191aca58e34a01428db628604924c5Chris Banes * 26953040adc60c191aca58e34a01428db628604924c5Chris Banes * @param insets Insets to apply 26963040adc60c191aca58e34a01428db628604924c5Chris Banes * @return The provided insets minus the insets that were consumed 26973040adc60c191aca58e34a01428db628604924c5Chris Banes */ 26983040adc60c191aca58e34a01428db628604924c5Chris Banes public static WindowInsetsCompat dispatchApplyWindowInsets(View view, 26993040adc60c191aca58e34a01428db628604924c5Chris Banes WindowInsetsCompat insets) { 27003040adc60c191aca58e34a01428db628604924c5Chris Banes return IMPL.dispatchApplyWindowInsets(view, insets); 27013040adc60c191aca58e34a01428db628604924c5Chris Banes } 27023040adc60c191aca58e34a01428db628604924c5Chris Banes 27033040adc60c191aca58e34a01428db628604924c5Chris Banes /** 27045e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes * Controls whether the entire hierarchy under this view will save its 27055e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes * state when a state saving traversal occurs from its parent. 27065e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes * 27075e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes * @param enabled Set to false to <em>disable</em> state saving, or true 27085e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes * (the default) to allow it. 27095e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes */ 27105e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes public static void setSaveFromParentEnabled(View v, boolean enabled) { 27115e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes IMPL.setSaveFromParentEnabled(v, enabled); 27125e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes } 27135e63ab9505a3a4d11374cbbec418c1aba921409dChris Banes 2714b645de790756e27bbe92d133216b7ac79cca7679Chris Banes /** 2715b645de790756e27bbe92d133216b7ac79cca7679Chris Banes * Changes the activated state of this view. A view can be activated or not. 2716b645de790756e27bbe92d133216b7ac79cca7679Chris Banes * Note that activation is not the same as selection. Selection is 2717b645de790756e27bbe92d133216b7ac79cca7679Chris Banes * a transient property, representing the view (hierarchy) the user is 2718b645de790756e27bbe92d133216b7ac79cca7679Chris Banes * currently interacting with. Activation is a longer-term state that the 2719b645de790756e27bbe92d133216b7ac79cca7679Chris Banes * user can move views in and out of. 2720b645de790756e27bbe92d133216b7ac79cca7679Chris Banes * 2721b645de790756e27bbe92d133216b7ac79cca7679Chris Banes * @param activated true if the view must be activated, false otherwise 2722b645de790756e27bbe92d133216b7ac79cca7679Chris Banes */ 2723b645de790756e27bbe92d133216b7ac79cca7679Chris Banes public static void setActivated(View view, boolean activated) { 2724b645de790756e27bbe92d133216b7ac79cca7679Chris Banes IMPL.setActivated(view, activated); 2725b645de790756e27bbe92d133216b7ac79cca7679Chris Banes } 2726b645de790756e27bbe92d133216b7ac79cca7679Chris Banes 2727fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes /** 272803526560f132021f8fd7290259762ab362d4d567Doris Liu * Returns whether this View has content which overlaps. 272903526560f132021f8fd7290259762ab362d4d567Doris Liu * 273003526560f132021f8fd7290259762ab362d4d567Doris Liu * <p>This function, intended to be overridden by specific View types, is an optimization when 273103526560f132021f8fd7290259762ab362d4d567Doris Liu * alpha is set on a view. If rendering overlaps in a view with alpha < 1, that view is drawn to 273203526560f132021f8fd7290259762ab362d4d567Doris Liu * an offscreen buffer and then composited into place, which can be expensive. If the view has 273303526560f132021f8fd7290259762ab362d4d567Doris Liu * no overlapping rendering, the view can draw each primitive with the appropriate alpha value 273403526560f132021f8fd7290259762ab362d4d567Doris Liu * directly. An example of overlapping rendering is a TextView with a background image, such as 273503526560f132021f8fd7290259762ab362d4d567Doris Liu * a Button. An example of non-overlapping rendering is a TextView with no background, or an 273603526560f132021f8fd7290259762ab362d4d567Doris Liu * ImageView with only the foreground image. The default implementation returns true; subclasses 273703526560f132021f8fd7290259762ab362d4d567Doris Liu * should override if they have cases which can be optimized.</p> 273803526560f132021f8fd7290259762ab362d4d567Doris Liu * 273903526560f132021f8fd7290259762ab362d4d567Doris Liu * @return true if the content in this view might overlap, false otherwise. 274003526560f132021f8fd7290259762ab362d4d567Doris Liu */ 274103526560f132021f8fd7290259762ab362d4d567Doris Liu public static boolean hasOverlappingRendering(View view) { 274203526560f132021f8fd7290259762ab362d4d567Doris Liu return IMPL.hasOverlappingRendering(view); 274303526560f132021f8fd7290259762ab362d4d567Doris Liu } 274403526560f132021f8fd7290259762ab362d4d567Doris Liu 274503526560f132021f8fd7290259762ab362d4d567Doris Liu /** 2746fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes * Return if the padding as been set through relative values 2747fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes * {@code View.setPaddingRelative(int, int, int, int)} or thru 2748fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes * 2749fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes * @return true if the padding is relative or false if it is not. 2750fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes */ 2751fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes public static boolean isPaddingRelative(View view) { 2752fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes return IMPL.isPaddingRelative(view); 2753fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes } 2754fd1eb27a3700de31507de34fd1bcc51830fe876cChris Banes 2755a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes /** 2756a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * Return the tint applied to the background drawable, if specified. 2757a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * <p> 2758a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * Only returns meaningful info when running on API v21 or newer, or if {@code view} 2759a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * implements the {@code TintableBackgroundView} interface. 2760a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes */ 2761a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes public static ColorStateList getBackgroundTintList(View view) { 2762a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes return IMPL.getBackgroundTintList(view); 2763a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes } 2764a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes 2765a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes /** 2766a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * Applies a tint to the background drawable. 2767a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * <p> 2768a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * This will always take effect when running on API v21 or newer. When running on platforms 2769a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * previous to API v21, it will only take effect if {@code view} implement the 2770a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * {@code TintableBackgroundView} interface. 2771a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes */ 2772a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes public static void setBackgroundTintList(View view, ColorStateList tintList) { 2773a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes IMPL.setBackgroundTintList(view, tintList); 2774a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes } 2775a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes 2776a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes /** 2777a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * Return the blending mode used to apply the tint to the background 2778a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * drawable, if specified. 2779a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * <p> 2780a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * Only returns meaningful info when running on API v21 or newer, or if {@code view} 2781a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * implements the {@code TintableBackgroundView} interface. 2782a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes */ 2783a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes public static PorterDuff.Mode getBackgroundTintMode(View view) { 2784a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes return IMPL.getBackgroundTintMode(view); 2785a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes } 2786a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes 2787a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes /** 2788a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * Specifies the blending mode used to apply the tint specified by 2789a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * {@link #setBackgroundTintList(android.view.View, android.content.res.ColorStateList)} to 2790a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * the background drawable. The default mode is {@link PorterDuff.Mode#SRC_IN}. 2791a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * <p> 2792a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * This will always take effect when running on API v21 or newer. When running on platforms 2793a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * previous to API v21, it will only take effect if {@code view} implement the 2794a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes * {@code TintableBackgroundView} interface. 2795a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes */ 2796a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes public static void setBackgroundTintMode(View view, PorterDuff.Mode mode) { 2797a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes IMPL.setBackgroundTintMode(view, mode); 2798a5f106fbd09335ae504c39b1ee1e0caa3f1238e3Chris Banes } 2799d7d27e9ebe5c7325e67e1a8af265378bd2056cadChet Haase // TODO: getters for various view properties (rotation, etc) 28001fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 28011fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell /** 28021fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * Enable or disable nested scrolling for this view. 28031fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28041fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>If this property is set to true the view will be permitted to initiate nested 28051fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * scrolling operations with a compatible parent view in the current hierarchy. If this 28061fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * view does not implement nested scrolling this will have no effect. Disabling nested scrolling 28071fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * while a nested scroll is in progress has the effect of 28081fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * {@link #stopNestedScroll(View) stopping} the nested scroll.</p> 28091fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28101fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param enabled true to enable nested scrolling, false to disable 28111fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28121fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @see #isNestedScrollingEnabled(View) 28131fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell */ 28141fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public static void setNestedScrollingEnabled(View view, boolean enabled) { 28151fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell IMPL.setNestedScrollingEnabled(view, enabled); 28161fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 28171fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 28181fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell /** 28191fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * Returns true if nested scrolling is enabled for this view. 28201fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28211fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>If nested scrolling is enabled and this View class implementation supports it, 28221fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * this view will act as a nested scrolling child view when applicable, forwarding data 28231fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * about the scroll operation in progress to a compatible and cooperating nested scrolling 28241fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * parent.</p> 28251fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28261fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @return true if nested scrolling is enabled 28271fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28281fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @see #setNestedScrollingEnabled(View, boolean) 28291fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell */ 28301fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public static boolean isNestedScrollingEnabled(View view) { 28311fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return IMPL.isNestedScrollingEnabled(view); 28321fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 28331fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 28341fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell /** 28351fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * Begin a nestable scroll operation along the given axes. 28361fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28371fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>A view starting a nested scroll promises to abide by the following contract:</p> 28381fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28391fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>The view will call startNestedScroll upon initiating a scroll operation. In the case 28401fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * of a touch scroll this corresponds to the initial {@link MotionEvent#ACTION_DOWN}. 28411fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * In the case of touch scrolling the nested scroll will be terminated automatically in 28421fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * the same manner as {@link ViewParent#requestDisallowInterceptTouchEvent(boolean)}. 28431fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * In the event of programmatic scrolling the caller must explicitly call 28441fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * {@link #stopNestedScroll(View)} to indicate the end of the nested scroll.</p> 28451fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28461fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>If <code>startNestedScroll</code> returns true, a cooperative parent was found. 28471fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * If it returns false the caller may ignore the rest of this contract until the next scroll. 28481fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * Calling startNestedScroll while a nested scroll is already in progress will return true.</p> 28491fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28501fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>At each incremental step of the scroll the caller should invoke 28511fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * {@link #dispatchNestedPreScroll(View, int, int, int[], int[]) dispatchNestedPreScroll} 28521fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * once it has calculated the requested scrolling delta. If it returns true the nested scrolling 28531fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * parent at least partially consumed the scroll and the caller should adjust the amount it 28541fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * scrolls by.</p> 28551fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28561fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>After applying the remainder of the scroll delta the caller should invoke 28571fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * {@link #dispatchNestedScroll(View, int, int, int, int, int[]) dispatchNestedScroll}, passing 28581fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * both the delta consumed and the delta unconsumed. A nested scrolling parent may treat 28591fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * these values differently. See 28601fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * {@link NestedScrollingParent#onNestedScroll(View, int, int, int, int)}. 28611fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * </p> 28621fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28631fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param axes Flags consisting of a combination of {@link ViewCompat#SCROLL_AXIS_HORIZONTAL} 28641fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * and/or {@link ViewCompat#SCROLL_AXIS_VERTICAL}. 28651fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @return true if a cooperative parent was found and nested scrolling has been enabled for 28661fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * the current gesture. 28671fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28681fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @see #stopNestedScroll(View) 28691fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @see #dispatchNestedPreScroll(View, int, int, int[], int[]) 28701fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @see #dispatchNestedScroll(View, int, int, int, int, int[]) 28711fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell */ 28721fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public static boolean startNestedScroll(View view, int axes) { 28731fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return IMPL.startNestedScroll(view, axes); 28741fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 28751fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 28761fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell /** 28771fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * Stop a nested scroll in progress. 28781fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28791fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>Calling this method when a nested scroll is not currently in progress is harmless.</p> 28801fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28811fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @see #startNestedScroll(View, int) 28821fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell */ 28831fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public static void stopNestedScroll(View view) { 28841fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell IMPL.stopNestedScroll(view); 28851fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 28861fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 28871fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell /** 28881fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * Returns true if this view has a nested scrolling parent. 28891fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28901fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>The presence of a nested scrolling parent indicates that this view has initiated 28911fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * a nested scroll and it was accepted by an ancestor view further up the view hierarchy.</p> 28921fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 28931fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @return whether this view has a nested scrolling parent 28941fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell */ 28951fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public static boolean hasNestedScrollingParent(View view) { 28961fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return IMPL.hasNestedScrollingParent(view); 28971fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 28981fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 28991fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell /** 29001fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * Dispatch one step of a nested scroll in progress. 29011fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 29021fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>Implementations of views that support nested scrolling should call this to report 29031fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * info about a scroll in progress to the current nested scrolling parent. If a nested scroll 29041fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * is not currently in progress or nested scrolling is not 29051fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * {@link #isNestedScrollingEnabled(View) enabled} for this view this method does nothing.</p> 29061fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 29071fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>Compatible View implementations should also call 29081fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * {@link #dispatchNestedPreScroll(View, int, int, int[], int[]) dispatchNestedPreScroll} before 29091fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * consuming a component of the scroll event themselves.</p> 29101fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 29111fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param dxConsumed Horizontal distance in pixels consumed by this view during this scroll step 29121fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param dyConsumed Vertical distance in pixels consumed by this view during this scroll step 29131fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param dxUnconsumed Horizontal scroll distance in pixels not consumed by this view 29141fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param dyUnconsumed Horizontal scroll distance in pixels not consumed by this view 29151fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param offsetInWindow Optional. If not null, on return this will contain the offset 29161fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * in local view coordinates of this view from before this operation 29171fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * to after it completes. View implementations may use this to adjust 29181fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * expected input coordinate tracking. 29191fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @return true if the event was dispatched, false if it could not be dispatched. 29201fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @see #dispatchNestedPreScroll(View, int, int, int[], int[]) 29211fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell */ 29221fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public static boolean dispatchNestedScroll(View view, int dxConsumed, int dyConsumed, 29231fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) { 29241fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return IMPL.dispatchNestedScroll(view, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, 29251fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell offsetInWindow); 29261fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 29271fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 29281fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell /** 29291fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * Dispatch one step of a nested scroll in progress before this view consumes any portion of it. 29301fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 29311fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>Nested pre-scroll events are to nested scroll events what touch intercept is to touch. 29321fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <code>dispatchNestedPreScroll</code> offers an opportunity for the parent view in a nested 29331fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * scrolling operation to consume some or all of the scroll operation before the child view 29341fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * consumes it.</p> 29351fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 29361fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param dx Horizontal scroll distance in pixels 29371fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param dy Vertical scroll distance in pixels 29381fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param consumed Output. If not null, consumed[0] will contain the consumed component of dx 29391fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * and consumed[1] the consumed dy. 29401fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param offsetInWindow Optional. If not null, on return this will contain the offset 29411fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * in local view coordinates of this view from before this operation 29421fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * to after it completes. View implementations may use this to adjust 29431fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * expected input coordinate tracking. 29441fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @return true if the parent consumed some or all of the scroll delta 29451fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @see #dispatchNestedScroll(View, int, int, int, int, int[]) 29461fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell */ 29471fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public static boolean dispatchNestedPreScroll(View view, int dx, int dy, int[] consumed, 29481fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell int[] offsetInWindow) { 29491fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return IMPL.dispatchNestedPreScroll(view, dx, dy, consumed, offsetInWindow); 29501fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 29511fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 29521fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell /** 29531fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * Dispatch a fling to a nested scrolling parent. 29541fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 29551fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>This method should be used to indicate that a nested scrolling child has detected 29561fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * suitable conditions for a fling. Generally this means that a touch scroll has ended with a 29571fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * {@link VelocityTracker velocity} in the direction of scrolling that meets or exceeds 29581fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * the {@link ViewConfiguration#getScaledMinimumFlingVelocity() minimum fling velocity} 29591fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * along a scrollable axis.</p> 29601fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 29611fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>If a nested scrolling child view would normally fling but it is at the edge of 29621fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * its own content, it can use this method to delegate the fling to its nested scrolling 29631fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * parent instead. The parent may optionally consume the fling or observe a child fling.</p> 29641fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 29651fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param velocityX Horizontal fling velocity in pixels per second 29661fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param velocityY Vertical fling velocity in pixels per second 29671fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param consumed true if the child consumed the fling, false otherwise 29681fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @return true if the nested scrolling parent consumed or otherwise reacted to the fling 29691fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell */ 29701fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public static boolean dispatchNestedFling(View view, float velocityX, float velocityY, 29711fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell boolean consumed) { 29721fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return IMPL.dispatchNestedFling(view, velocityX, velocityY, consumed); 29731fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 29741fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell 29751fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell /** 29761fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * Dispatch a fling to a nested scrolling parent before it is processed by this view. 29771fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 29781fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>Nested pre-fling events are to nested fling events what touch intercept is to touch 29791fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * and what nested pre-scroll is to nested scroll. <code>dispatchNestedPreFling</code> 29801fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * offsets an opportunity for the parent view in a nested fling to fully consume the fling 29811fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * before the child view consumes it. If this method returns <code>true</code>, a nested 29821fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * parent view consumed the fling and this view should not scroll as a result.</p> 29831fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 29841fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>For a better user experience, only one view in a nested scrolling chain should consume 29851fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * the fling at a time. If a parent view consumed the fling this method will return false. 29861fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * Custom view implementations should account for this in two ways:</p> 29871fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 29881fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <ul> 29891fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <li>If a custom view is paged and needs to settle to a fixed page-point, do not 29901fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * call <code>dispatchNestedPreFling</code>; consume the fling and settle to a valid 29911fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * position regardless.</li> 29921fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <li>If a nested parent does consume the fling, this view should not scroll at all, 29931fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * even to settle back to a valid idle position.</li> 29941fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * </ul> 29951fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 29961fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * <p>Views should also not offer fling velocities to nested parent views along an axis 29971fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * where scrolling is not currently supported; a {@link android.widget.ScrollView ScrollView} 29981fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * should not offer a horizontal fling velocity to its parents since scrolling along that 29991fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * axis is not permitted and carrying velocity along that motion does not make sense.</p> 30001fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * 30011fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param velocityX Horizontal fling velocity in pixels per second 30021fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @param velocityY Vertical fling velocity in pixels per second 30031fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell * @return true if a nested scrolling parent consumed the fling 30041fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell */ 30051fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell public static boolean dispatchNestedPreFling(View view, float velocityX, float velocityY) { 30061fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell return IMPL.dispatchNestedPreFling(view, velocityX, velocityY); 30071fcce4485ef99aca928ebfb877859c5ecd47716cAdam Powell } 3008f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes 3009f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes /** 3010f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes * Returns true if {@code view} has been through at least one layout since it 3011f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes * was last attached to or detached from a window. 3012f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes */ 3013f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes public static boolean isLaidOut(View view) { 3014f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes return IMPL.isLaidOut(view); 3015f91071ff037056101389f2cbfc5fadb0229a36a7Chris Banes } 3016a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell 3017a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell /** 3018a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell * The visual z position of this view, in pixels. This is equivalent to the 3019a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell * {@link #setTranslationZ(View, float) translationZ} property plus the current 3020a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell * {@link #getElevation(View) elevation} property. 3021a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell * 3022a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell * @return The visual z position of this view, in pixels. 3023a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell */ 3024a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell public static float getZ(View view) { 3025a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell return IMPL.getZ(view); 3026a966c6cda6a3aa562fcfdb842b6c6b35bdd6a3dcAdam Powell } 3027a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes 3028a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes /** 3029a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes * Offset this view's vertical location by the specified number of pixels. 3030a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes * 3031a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes * @param offset the number of pixels to offset the view by 3032a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes */ 3033a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes public static void offsetTopAndBottom(View view, int offset) { 3034a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes view.offsetTopAndBottom(offset); 3035a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes 3036a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes if (offset != 0 && Build.VERSION.SDK_INT < 11) { 3037a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes // We need to manually invalidate pre-honeycomb 3038a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes view.invalidate(); 3039a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes } 3040a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes } 3041a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes /** 3042a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes * Offset this view's horizontal location by the specified amount of pixels. 3043a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes * 3044a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes * @param offset the number of pixels to offset the view by 3045a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes */ 3046a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes public static void offsetLeftAndRight(View view, int offset) { 3047a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes view.offsetLeftAndRight(offset); 3048a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes 3049a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes if (offset != 0 && Build.VERSION.SDK_INT < 11) { 3050a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes // We need to manually invalidate pre-honeycomb 3051a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes view.invalidate(); 3052a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes } 3053a6a508b2296730ca6954aaebcca52a9962a5cb55Chris Banes } 3054f6610f183f0afe6e392dea804474f722d82083fdChris Banes 3055f6610f183f0afe6e392dea804474f722d82083fdChris Banes /** 30566484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * Sets a rectangular area on this view to which the view will be clipped 30576484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * when it is drawn. Setting the value to null will remove the clip bounds 30586484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * and the view will draw normally, using its full bounds. 30596484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * 30606484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * <p>Prior to API 18 this does nothing.</p> 30616484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * 30626484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * @param view The view to set clipBounds. 30636484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * @param clipBounds The rectangular area, in the local coordinates of 30646484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * this view, to which future drawing operations will be clipped. 30656484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu */ 30666484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu public static void setClipBounds(View view, Rect clipBounds) { 30676484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu IMPL.setClipBounds(view, clipBounds); 30686484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu } 30696484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu 30706484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu /** 30716484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * Returns a copy of the current {@link #setClipBounds(View, Rect)}. 30726484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * 30736484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * <p>Prior to API 18 this will return null.</p> 30746484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * 30756484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * @return A copy of the current clip bounds if clip bounds are set, 30766484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu * otherwise null. 30776484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu */ 30786484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu public static Rect getClipBounds(View view) { 30796484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu return IMPL.getClipBounds(view); 30806484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu } 30816484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu 30826484522a0b7b9c0895098b44fc6cf5b6d9cbef57Dake Gu /** 3083f6610f183f0afe6e392dea804474f722d82083fdChris Banes * Returns true if the provided view is currently attached to a window. 3084f6610f183f0afe6e392dea804474f722d82083fdChris Banes */ 3085f6610f183f0afe6e392dea804474f722d82083fdChris Banes public static boolean isAttachedToWindow(View view) { 3086f6610f183f0afe6e392dea804474f722d82083fdChris Banes return IMPL.isAttachedToWindow(view); 3087f6610f183f0afe6e392dea804474f722d82083fdChris Banes } 3088bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell} 3089