1c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell/* 2c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * Copyright (C) 2012 The Android Open Source Project 3c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * 4c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * Licensed under the Apache License, Version 2.0 (the "License"); 5c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * you may not use this file except in compliance with the License. 6c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * You may obtain a copy of the License at 7c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * 8c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * http://www.apache.org/licenses/LICENSE-2.0 9c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * 10c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * Unless required by applicable law or agreed to in writing, software 11c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * distributed under the License is distributed on an "AS IS" BASIS, 12c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * See the License for the specific language governing permissions and 14c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * limitations under the License. 15c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell */ 16c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell 17c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powellpackage android.support.v4.view; 18c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell 190d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanvimport android.os.Bundle; 20c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powellimport android.view.View; 213cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powellimport android.view.ViewParent; 22c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell 23c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell/** 24c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell * Jellybean-specific View API access 25c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell */ 2684bbe6fe39c63a7e67a3ca937981a463c11ac9edScott Mainclass ViewCompatJB { 27c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell 28c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell public static boolean hasTransientState(View view) { 29c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell return view.hasTransientState(); 30c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell } 31c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell 32c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell public static void setHasTransientState(View view, boolean hasTransientState) { 33c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell view.setHasTransientState(hasTransientState); 34c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell } 35c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell 36ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public static void postInvalidateOnAnimation(View view) { 37ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell view.postInvalidateOnAnimation(); 38ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 39ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell 40ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public static void postInvalidateOnAnimation(View view, int left, int top, 41ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell int right, int bottom) { 42ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell view.postInvalidate(left, top, right, bottom); 43ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 44ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell 45ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public static void postOnAnimation(View view, Runnable action) { 46ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell view.postOnAnimation(action); 47ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 48ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell 49ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell public static void postOnAnimationDelayed(View view, Runnable action, long delayMillis) { 50ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell view.postOnAnimationDelayed(action, delayMillis); 51ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell } 5225121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov 5325121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public static int getImportantForAccessibility(View view) { 5425121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov return view.getImportantForAccessibility(); 5525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov } 5625121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov 5725121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public static void setImportantForAccessibility(View view, int mode) { 5825121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov view.setImportantForAccessibility(mode); 5925121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov } 6025121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov 610d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv public static boolean performAccessibilityAction(View view, int action, Bundle arguments) { 620d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv return view.performAccessibilityAction(action, arguments); 630d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv } 640d4ffdf13a16b1ce2f3bc458002374cdd25663c3alanv 6525121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov public static Object getAccessibilityNodeProvider(View view) { 6625121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov return view.getAccessibilityNodeProvider(); 6725121559b53b9f6c7ef7159203d42e11b9aee281Svetoslav Ganov } 683cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell 693cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell public static ViewParent getParentForAccessibility(View view) { 703cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell return view.getParentForAccessibility(); 713cf6141d516a0a6170823b1bda5c0b6d7500e76cAdam Powell } 72f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell 73f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell public static int getMinimumWidth(View view) { 74f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell return view.getMinimumWidth(); 75f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell } 76f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell 77f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell public static int getMinimumHeight(View view) { 78f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell return view.getMinimumHeight(); 79f2b93981846ce21a06b6a92a5a6ba70a29c345edAdam Powell } 8049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes 8149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes public static void requestApplyInsets(View view) { 8249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes view.requestFitSystemWindows(); 8349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes } 84f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell 85f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell public static boolean getFitsSystemWindows(View view) { 86f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell return view.getFitsSystemWindows(); 87f9c35128decbd812ff2497852ccacbd1ffbbd811Adam Powell } 88c95beb648f59c89c6bd7b0eed0a8b266a1b287e2Adam Powell} 89