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
19d392c8cae159a3a9a416200f4e117634bdbf064eYigit Boyarimport android.support.annotation.Nullable;
20bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powellimport android.view.View;
219648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganovimport android.view.View.AccessibilityDelegate;
229648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganovimport android.view.accessibility.AccessibilityEvent;
239648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganovimport android.view.accessibility.AccessibilityNodeInfo;
24bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell
25bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell/**
269648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov * Helper for accessing newer features in View introduced in ICS.
27bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell */
28bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powellclass ViewCompatICS {
299648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
30bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell    public static boolean canScrollHorizontally(View v, int direction) {
31bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell        return v.canScrollHorizontally(direction);
32bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell    }
33bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell
34bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell    public static boolean canScrollVertically(View v, int direction) {
35bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell        return v.canScrollVertically(direction);
36bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell    }
379648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
38d392c8cae159a3a9a416200f4e117634bdbf064eYigit Boyar    public static void setAccessibilityDelegate(View v, @Nullable Object delegate) {
399648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        v.setAccessibilityDelegate((AccessibilityDelegate) delegate);
409648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
419648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
429648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    public static void onPopulateAccessibilityEvent(View v, AccessibilityEvent event) {
439648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        v.onPopulateAccessibilityEvent(event);
449648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
459648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
469648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    public static void onInitializeAccessibilityEvent(View v, AccessibilityEvent event) {
479648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        v.onInitializeAccessibilityEvent(event);
489648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
499648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov
509648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    public static void onInitializeAccessibilityNodeInfo(View v, Object info) {
519648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov        v.onInitializeAccessibilityNodeInfo((AccessibilityNodeInfo) info);
529648c538bac4f04145c118cc41168d1d7a536312Svetoslav Ganov    }
538c9ce11dec24a32f438406286404be7ac294011dChris Banes
548c9ce11dec24a32f438406286404be7ac294011dChris Banes    public static void setFitsSystemWindows(View view, boolean fitSystemWindows) {
558c9ce11dec24a32f438406286404be7ac294011dChris Banes        view.setFitsSystemWindows(fitSystemWindows);
568c9ce11dec24a32f438406286404be7ac294011dChris Banes    }
57bc889e39e279fcf8c3d35fc11d8052c002eddf38Adam Powell}
58