Source code
package android.support.v4.view;
import android.content.res.ColorStateList;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.support.annotation.FloatRange;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.support.v4.view.accessibility.AccessibilityNodeProviderCompat;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.WeakHashMap;
public class ViewCompat {
public static final int ACCESSIBILITY_LIVE_REGION_ASSERTIVE = 2;
public static final int ACCESSIBILITY_LIVE_REGION_NONE = 0;
public static final int ACCESSIBILITY_LIVE_REGION_POLITE = 1;
private static final long FAKE_FRAME_TIME = 10;
static final ViewCompatImpl IMPL;
public static final int IMPORTANT_FOR_ACCESSIBILITY_AUTO = 0;
public static final int IMPORTANT_FOR_ACCESSIBILITY_NO = 2;
public static final int IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS = 4;
public static final int IMPORTANT_FOR_ACCESSIBILITY_YES = 1;
public static final int LAYER_TYPE_HARDWARE = 2;
public static final int LAYER_TYPE_NONE = 0;
public static final int LAYER_TYPE_SOFTWARE = 1;
public static final int LAYOUT_DIRECTION_INHERIT = 2;
public static final int LAYOUT_DIRECTION_LOCALE = 3;
public static final int LAYOUT_DIRECTION_LTR = 0;
public static final int LAYOUT_DIRECTION_RTL = 1;
public static final int MEASURED_HEIGHT_STATE_SHIFT = 16;
public static final int MEASURED_SIZE_MASK = 16777215;
public static final int MEASURED_STATE_MASK = -16777216;
public static final int MEASURED_STATE_TOO_SMALL = 16777216;
public static final int OVER_SCROLL_ALWAYS = 0;
public static final int OVER_SCROLL_IF_CONTENT_SCROLLS = 1;
public static final int OVER_SCROLL_NEVER = 2;
public static final int SCROLL_AXIS_HORIZONTAL = 1;
public static final int SCROLL_AXIS_NONE = 0;
public static final int SCROLL_AXIS_VERTICAL = 2;
public static final int SCROLL_INDICATOR_BOTTOM = 2;
public static final int SCROLL_INDICATOR_END = 32;
public static final int SCROLL_INDICATOR_LEFT = 4;
public static final int SCROLL_INDICATOR_RIGHT = 8;
public static final int SCROLL_INDICATOR_START = 16;
public static final int SCROLL_INDICATOR_TOP = 1;
private static final String TAG = "ViewCompat";
@Retention(RetentionPolicy.SOURCE)
public @interface ScrollIndicators {
}
interface ViewCompatImpl {
ViewPropertyAnimatorCompat animate(View view);
boolean canScrollHorizontally(View view, int i);
boolean canScrollVertically(View view, int i);
int combineMeasuredStates(int i, int i2);
WindowInsetsCompat dispatchApplyWindowInsets(View view, WindowInsetsCompat windowInsetsCompat);
void dispatchFinishTemporaryDetach(View view);
boolean dispatchNestedFling(View view, float f, float f2, boolean z);
boolean dispatchNestedPreFling(View view, float f, float f2);
boolean dispatchNestedPreScroll(View view, int i, int i2, int[] iArr, int[] iArr2);
boolean dispatchNestedScroll(View view, int i, int i2, int i3, int i4, int[] iArr);
void dispatchStartTemporaryDetach(View view);
int getAccessibilityLiveRegion(View view);
AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View view);
float getAlpha(View view);
ColorStateList getBackgroundTintList(View view);
Mode getBackgroundTintMode(View view);
Rect getClipBounds(View view);
float getElevation(View view);
boolean getFitsSystemWindows(View view);
int getImportantForAccessibility(View view);
int getLabelFor(View view);
int getLayerType(View view);
int getLayoutDirection(View view);
int getMeasuredHeightAndState(View view);
int getMeasuredState(View view);
int getMeasuredWidthAndState(View view);
int getMinimumHeight(View view);
int getMinimumWidth(View view);
int getOverScrollMode(View view);
int getPaddingEnd(View view);
int getPaddingStart(View view);
ViewParent getParentForAccessibility(View view);
float getPivotX(View view);
float getPivotY(View view);
float getRotation(View view);
float getRotationX(View view);
float getRotationY(View view);
float getScaleX(View view);
float getScaleY(View view);
int getScrollIndicators(View view);
String getTransitionName(View view);
float getTranslationX(View view);
float getTranslationY(View view);
float getTranslationZ(View view);
int getWindowSystemUiVisibility(View view);
float getX(View view);
float getY(View view);
float getZ(View view);
boolean hasAccessibilityDelegate(View view);
boolean hasNestedScrollingParent(View view);
boolean hasOnClickListeners(View view);
boolean hasOverlappingRendering(View view);
boolean hasTransientState(View view);
boolean isAttachedToWindow(View view);
boolean isImportantForAccessibility(View view);
boolean isLaidOut(View view);
boolean isNestedScrollingEnabled(View view);
boolean isOpaque(View view);
boolean isPaddingRelative(View view);
void jumpDrawablesToCurrentState(View view);
WindowInsetsCompat onApplyWindowInsets(View view, WindowInsetsCompat windowInsetsCompat);
void onInitializeAccessibilityEvent(View view, AccessibilityEvent accessibilityEvent);
void onInitializeAccessibilityNodeInfo(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat);
void onPopulateAccessibilityEvent(View view, AccessibilityEvent accessibilityEvent);
boolean performAccessibilityAction(View view, int i, Bundle bundle);
void postInvalidateOnAnimation(View view);
void postInvalidateOnAnimation(View view, int i, int i2, int i3, int i4);
void postOnAnimation(View view, Runnable runnable);
void postOnAnimationDelayed(View view, Runnable runnable, long j);
void requestApplyInsets(View view);
int resolveSizeAndState(int i, int i2, int i3);
void setAccessibilityDelegate(View view, @Nullable AccessibilityDelegateCompat accessibilityDelegateCompat);
void setAccessibilityLiveRegion(View view, int i);
void setActivated(View view, boolean z);
void setAlpha(View view, float f);
void setBackgroundTintList(View view, ColorStateList colorStateList);
void setBackgroundTintMode(View view, Mode mode);
void setChildrenDrawingOrderEnabled(ViewGroup viewGroup, boolean z);
void setClipBounds(View view, Rect rect);
void setElevation(View view, float f);
void setFitsSystemWindows(View view, boolean z);
void setHasTransientState(View view, boolean z);
void setImportantForAccessibility(View view, int i);
void setLabelFor(View view, int i);
void setLayerPaint(View view, Paint paint);
void setLayerType(View view, int i, Paint paint);
void setLayoutDirection(View view, int i);
void setNestedScrollingEnabled(View view, boolean z);
void setOnApplyWindowInsetsListener(View view, OnApplyWindowInsetsListener onApplyWindowInsetsListener);
void setOverScrollMode(View view, int i);
void setPaddingRelative(View view, int i, int i2, int i3, int i4);
void setPivotX(View view, float f);
void setPivotY(View view, float f);
void setRotation(View view, float f);
void setRotationX(View view, float f);
void setRotationY(View view, float f);
void setSaveFromParentEnabled(View view, boolean z);
void setScaleX(View view, float f);
void setScaleY(View view, float f);
void setScrollIndicators(View view, int i);
void setScrollIndicators(View view, int i, int i2);
void setTransitionName(View view, String str);
void setTranslationX(View view, float f);
void setTranslationY(View view, float f);
void setTranslationZ(View view, float f);
void setX(View view, float f);
void setY(View view, float f);
boolean startNestedScroll(View view, int i);
void stopNestedScroll(View view);
}
static class BaseViewCompatImpl implements ViewCompatImpl {
private Method mDispatchFinishTemporaryDetach;
private Method mDispatchStartTemporaryDetach;
private boolean mTempDetachBound;
WeakHashMap<View, ViewPropertyAnimatorCompat> mViewPropertyAnimatorCompatMap = null;
BaseViewCompatImpl() {
}
public boolean canScrollHorizontally(View v, int direction) {
return (v instanceof ScrollingView) && canScrollingViewScrollHorizontally((ScrollingView) v, direction);
}
public boolean canScrollVertically(View v, int direction) {
return (v instanceof ScrollingView) && canScrollingViewScrollVertically((ScrollingView) v, direction);
}
public int getOverScrollMode(View v) {
return 2;
}
public void setOverScrollMode(View v, int mode) {
}
public void setAccessibilityDelegate(View v, AccessibilityDelegateCompat delegate) {
}
public boolean hasAccessibilityDelegate(View v) {
return false;
}
public void onPopulateAccessibilityEvent(View v, AccessibilityEvent event) {
}
public void onInitializeAccessibilityEvent(View v, AccessibilityEvent event) {
}
public void onInitializeAccessibilityNodeInfo(View v, AccessibilityNodeInfoCompat info) {
}
public boolean hasTransientState(View view) {
return false;
}
public void setHasTransientState(View view, boolean hasTransientState) {
}
public void postInvalidateOnAnimation(View view) {
view.invalidate();
}
public void postInvalidateOnAnimation(View view, int left, int top, int right, int bottom) {
view.invalidate(left, top, right, bottom);
}
public void postOnAnimation(View view, Runnable action) {
view.postDelayed(action, getFrameTime());
}
public void postOnAnimationDelayed(View view, Runnable action, long delayMillis) {
view.postDelayed(action, getFrameTime() + delayMillis);
}
long getFrameTime() {
return ViewCompat.FAKE_FRAME_TIME;
}
public int getImportantForAccessibility(View view) {
return 0;
}
public void setImportantForAccessibility(View view, int mode) {
}
public boolean isImportantForAccessibility(View view) {
return true;
}
public boolean performAccessibilityAction(View view, int action, Bundle arguments) {
return false;
}
public AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View view) {
return null;
}
public float getAlpha(View view) {
return 1.0f;
}
public void setLayerType(View view, int layerType, Paint paint) {
}
public int getLayerType(View view) {
return 0;
}
public int getLabelFor(View view) {
return 0;
}
public void setLabelFor(View view, int id) {
}
public void setLayerPaint(View view, Paint p) {
}
public int getLayoutDirection(View view) {
return 0;
}
public void setLayoutDirection(View view, int layoutDirection) {
}
public ViewParent getParentForAccessibility(View view) {
return view.getParent();
}
public boolean isOpaque(View view) {
Drawable bg = view.getBackground();
if (bg == null || bg.getOpacity() != -1) {
return false;
}
return true;
}
public int resolveSizeAndState(int size, int measureSpec, int childMeasuredState) {
return View.resolveSize(size, measureSpec);
}
public int getMeasuredWidthAndState(View view) {
return view.getMeasuredWidth();
}
public int getMeasuredHeightAndState(View view) {
return view.getMeasuredHeight();
}
public int getMeasuredState(View view) {
return 0;
}
public int getAccessibilityLiveRegion(View view) {
return 0;
}
public void setAccessibilityLiveRegion(View view, int mode) {
}
public int getPaddingStart(View view) {
return view.getPaddingLeft();
}
public int getPaddingEnd(View view) {
return view.getPaddingRight();
}
public void setPaddingRelative(View view, int start, int top, int end, int bottom) {
view.setPadding(start, top, end, bottom);
}
public void dispatchStartTemporaryDetach(View view) {
if (!this.mTempDetachBound) {
bindTempDetach();
}
if (this.mDispatchStartTemporaryDetach != null) {
try {
this.mDispatchStartTemporaryDetach.invoke(view, new Object[0]);
return;
} catch (Exception e) {
Log.d("ViewCompat", "Error calling dispatchStartTemporaryDetach", e);
return;
}
}
view.onStartTemporaryDetach();
}
public void dispatchFinishTemporaryDetach(View view) {
if (!this.mTempDetachBound) {
bindTempDetach();
}
if (this.mDispatchFinishTemporaryDetach != null) {
try {
this.mDispatchFinishTemporaryDetach.invoke(view, new Object[0]);
return;
} catch (Exception e) {
Log.d("ViewCompat", "Error calling dispatchFinishTemporaryDetach", e);
return;
}
}
view.onFinishTemporaryDetach();
}
public boolean hasOverlappingRendering(View view) {
return true;
}
private void bindTempDetach() {
try {
this.mDispatchStartTemporaryDetach = View.class.getDeclaredMethod("dispatchStartTemporaryDetach", new Class[0]);
this.mDispatchFinishTemporaryDetach = View.class.getDeclaredMethod("dispatchFinishTemporaryDetach", new Class[0]);
} catch (NoSuchMethodException e) {
Log.e("ViewCompat", "Couldn't find method", e);
}
this.mTempDetachBound = true;
}
public float getTranslationX(View view) {
return 0.0f;
}
public float getTranslationY(View view) {
return 0.0f;
}
public float getX(View view) {
return 0.0f;
}
public float getY(View view) {
return 0.0f;
}
public float getRotation(View view) {
return 0.0f;
}
public float getRotationX(View view) {
return 0.0f;
}
public float getRotationY(View view) {
return 0.0f;
}
public float getScaleX(View view) {
return 0.0f;
}
public float getScaleY(View view) {
return 0.0f;
}
public int getMinimumWidth(View view) {
return ViewCompatBase.getMinimumWidth(view);
}
public int getMinimumHeight(View view) {
return ViewCompatBase.getMinimumHeight(view);
}
public ViewPropertyAnimatorCompat animate(View view) {
return new ViewPropertyAnimatorCompat(view);
}
public void setRotation(View view, float value) {
}
public void setTranslationX(View view, float value) {
}
public void setTranslationY(View view, float value) {
}
public void setAlpha(View view, float value) {
}
public void setRotationX(View view, float value) {
}
public void setRotationY(View view, float value) {
}
public void setScaleX(View view, float value) {
}
public void setScaleY(View view, float value) {
}
public void setX(View view, float value) {
}
public void setY(View view, float value) {
}
public void setPivotX(View view, float value) {
}
public void setPivotY(View view, float value) {
}
public float getPivotX(View view) {
return 0.0f;
}
public float getPivotY(View view) {
return 0.0f;
}
public void setTransitionName(View view, String transitionName) {
}
public String getTransitionName(View view) {
return null;
}
public int getWindowSystemUiVisibility(View view) {
return 0;
}
public void requestApplyInsets(View view) {
}
public void setElevation(View view, float elevation) {
}
public float getElevation(View view) {
return 0.0f;
}
public void setTranslationZ(View view, float translationZ) {
}
public float getTranslationZ(View view) {
return 0.0f;
}
public void setClipBounds(View view, Rect clipBounds) {
}
public Rect getClipBounds(View view) {
return null;
}
public void setChildrenDrawingOrderEnabled(ViewGroup viewGroup, boolean enabled) {
}
public boolean getFitsSystemWindows(View view) {
return false;
}
public void setFitsSystemWindows(View view, boolean fitSystemWindows) {
}
public void jumpDrawablesToCurrentState(View view) {
}
public void setOnApplyWindowInsetsListener(View view, OnApplyWindowInsetsListener listener) {
}
public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) {
return insets;
}
public WindowInsetsCompat dispatchApplyWindowInsets(View v, WindowInsetsCompat insets) {
return insets;
}
public void setSaveFromParentEnabled(View v, boolean enabled) {
}
public void setActivated(View view, boolean activated) {
}
public boolean isPaddingRelative(View view) {
return false;
}
public void setNestedScrollingEnabled(View view, boolean enabled) {
if (view instanceof NestedScrollingChild) {
((NestedScrollingChild) view).setNestedScrollingEnabled(enabled);
}
}
public boolean isNestedScrollingEnabled(View view) {
if (view instanceof NestedScrollingChild) {
return ((NestedScrollingChild) view).isNestedScrollingEnabled();
}
return false;
}
public ColorStateList getBackgroundTintList(View view) {
return ViewCompatBase.getBackgroundTintList(view);
}
public void setBackgroundTintList(View view, ColorStateList tintList) {
ViewCompatBase.setBackgroundTintList(view, tintList);
}
public void setBackgroundTintMode(View view, Mode mode) {
ViewCompatBase.setBackgroundTintMode(view, mode);
}
public Mode getBackgroundTintMode(View view) {
return ViewCompatBase.getBackgroundTintMode(view);
}
private boolean canScrollingViewScrollHorizontally(ScrollingView view, int direction) {
int offset = view.computeHorizontalScrollOffset();
int range = view.computeHorizontalScrollRange() - view.computeHorizontalScrollExtent();
if (range == 0) {
return false;
}
if (direction < 0) {
if (offset <= 0) {
return false;
}
return true;
} else if (offset >= range - 1) {
return false;
} else {
return true;
}
}
private boolean canScrollingViewScrollVertically(ScrollingView view, int direction) {
int offset = view.computeVerticalScrollOffset();
int range = view.computeVerticalScrollRange() - view.computeVerticalScrollExtent();
if (range == 0) {
return false;
}
if (direction < 0) {
if (offset <= 0) {
return false;
}
return true;
} else if (offset >= range - 1) {
return false;
} else {
return true;
}
}
public boolean startNestedScroll(View view, int axes) {
if (view instanceof NestedScrollingChild) {
return ((NestedScrollingChild) view).startNestedScroll(axes);
}
return false;
}
public void stopNestedScroll(View view) {
if (view instanceof NestedScrollingChild) {
((NestedScrollingChild) view).stopNestedScroll();
}
}
public boolean hasNestedScrollingParent(View view) {
if (view instanceof NestedScrollingChild) {
return ((NestedScrollingChild) view).hasNestedScrollingParent();
}
return false;
}
public boolean dispatchNestedScroll(View view, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) {
if (view instanceof NestedScrollingChild) {
return ((NestedScrollingChild) view).dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow);
}
return false;
}
public boolean dispatchNestedPreScroll(View view, int dx, int dy, int[] consumed, int[] offsetInWindow) {
if (view instanceof NestedScrollingChild) {
return ((NestedScrollingChild) view).dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow);
}
return false;
}
public boolean dispatchNestedFling(View view, float velocityX, float velocityY, boolean consumed) {
if (view instanceof NestedScrollingChild) {
return ((NestedScrollingChild) view).dispatchNestedFling(velocityX, velocityY, consumed);
}
return false;
}
public boolean dispatchNestedPreFling(View view, float velocityX, float velocityY) {
if (view instanceof NestedScrollingChild) {
return ((NestedScrollingChild) view).dispatchNestedPreFling(velocityX, velocityY);
}
return false;
}
public boolean isLaidOut(View view) {
return ViewCompatBase.isLaidOut(view);
}
public int combineMeasuredStates(int curState, int newState) {
return curState | newState;
}
public float getZ(View view) {
return getTranslationZ(view) + getElevation(view);
}
public boolean isAttachedToWindow(View view) {
return ViewCompatBase.isAttachedToWindow(view);
}
public boolean hasOnClickListeners(View view) {
return false;
}
public int getScrollIndicators(View view) {
return 0;
}
public void setScrollIndicators(View view, int indicators) {
}
public void setScrollIndicators(View view, int indicators, int mask) {
}
}
static class EclairMr1ViewCompatImpl extends BaseViewCompatImpl {
EclairMr1ViewCompatImpl() {
}
public boolean isOpaque(View view) {
return ViewCompatEclairMr1.isOpaque(view);
}
public void setChildrenDrawingOrderEnabled(ViewGroup viewGroup, boolean enabled) {
ViewCompatEclairMr1.setChildrenDrawingOrderEnabled(viewGroup, enabled);
}
}
static class GBViewCompatImpl extends EclairMr1ViewCompatImpl {
GBViewCompatImpl() {
}
public int getOverScrollMode(View v) {
return ViewCompatGingerbread.getOverScrollMode(v);
}
public void setOverScrollMode(View v, int mode) {
ViewCompatGingerbread.setOverScrollMode(v, mode);
}
}
static class HCViewCompatImpl extends GBViewCompatImpl {
HCViewCompatImpl() {
}
long getFrameTime() {
return ViewCompatHC.getFrameTime();
}
public float getAlpha(View view) {
return ViewCompatHC.getAlpha(view);
}
public void setLayerType(View view, int layerType, Paint paint) {
ViewCompatHC.setLayerType(view, layerType, paint);
}
public int getLayerType(View view) {
return ViewCompatHC.getLayerType(view);
}
public void setLayerPaint(View view, Paint paint) {
setLayerType(view, getLayerType(view), paint);
view.invalidate();
}
public int resolveSizeAndState(int size, int measureSpec, int childMeasuredState) {
return ViewCompatHC.resolveSizeAndState(size, measureSpec, childMeasuredState);
}
public int getMeasuredWidthAndState(View view) {
return ViewCompatHC.getMeasuredWidthAndState(view);
}
public int getMeasuredHeightAndState(View view) {
return ViewCompatHC.getMeasuredHeightAndState(view);
}
public int getMeasuredState(View view) {
return ViewCompatHC.getMeasuredState(view);
}
public float getTranslationX(View view) {
return ViewCompatHC.getTranslationX(view);
}
public float getTranslationY(View view) {
return ViewCompatHC.getTranslationY(view);
}
public void setTranslationX(View view, float value) {
ViewCompatHC.setTranslationX(view, value);
}
public void setTranslationY(View view, float value) {
ViewCompatHC.setTranslationY(view, value);
}
public void setAlpha(View view, float value) {
ViewCompatHC.setAlpha(view, value);
}
public void setX(View view, float value) {
ViewCompatHC.setX(view, value);
}
public void setY(View view, float value) {
ViewCompatHC.setY(view, value);
}
public void setRotation(View view, float value) {
ViewCompatHC.setRotation(view, value);
}
public void setRotationX(View view, float value) {
ViewCompatHC.setRotationX(view, value);
}
public void setRotationY(View view, float value) {
ViewCompatHC.setRotationY(view, value);
}
public void setScaleX(View view, float value) {
ViewCompatHC.setScaleX(view, value);
}
public void setScaleY(View view, float value) {
ViewCompatHC.setScaleY(view, value);
}
public void setPivotX(View view, float value) {
ViewCompatHC.setPivotX(view, value);
}
public void setPivotY(View view, float value) {
ViewCompatHC.setPivotY(view, value);
}
public float getX(View view) {
return ViewCompatHC.getX(view);
}
public float getY(View view) {
return ViewCompatHC.getY(view);
}
public float getRotation(View view) {
return ViewCompatHC.getRotation(view);
}
public float getRotationX(View view) {
return ViewCompatHC.getRotationX(view);
}
public float getRotationY(View view) {
return ViewCompatHC.getRotationY(view);
}
public float getScaleX(View view) {
return ViewCompatHC.getScaleX(view);
}
public float getScaleY(View view) {
return ViewCompatHC.getScaleY(view);
}
public float getPivotX(View view) {
return ViewCompatHC.getPivotX(view);
}
public float getPivotY(View view) {
return ViewCompatHC.getPivotY(view);
}
public void jumpDrawablesToCurrentState(View view) {
ViewCompatHC.jumpDrawablesToCurrentState(view);
}
public void setSaveFromParentEnabled(View view, boolean enabled) {
ViewCompatHC.setSaveFromParentEnabled(view, enabled);
}
public void setActivated(View view, boolean activated) {
ViewCompatHC.setActivated(view, activated);
}
public int combineMeasuredStates(int curState, int newState) {
return ViewCompatHC.combineMeasuredStates(curState, newState);
}
}
static class ICSViewCompatImpl extends HCViewCompatImpl {
static boolean accessibilityDelegateCheckFailed = false;
static Field mAccessibilityDelegateField;
ICSViewCompatImpl() {
}
public boolean canScrollHorizontally(View v, int direction) {
return ViewCompatICS.canScrollHorizontally(v, direction);
}
public boolean canScrollVertically(View v, int direction) {
return ViewCompatICS.canScrollVertically(v, direction);
}
public void onPopulateAccessibilityEvent(View v, AccessibilityEvent event) {
ViewCompatICS.onPopulateAccessibilityEvent(v, event);
}
public void onInitializeAccessibilityEvent(View v, AccessibilityEvent event) {
ViewCompatICS.onInitializeAccessibilityEvent(v, event);
}
public void onInitializeAccessibilityNodeInfo(View v, AccessibilityNodeInfoCompat info) {
ViewCompatICS.onInitializeAccessibilityNodeInfo(v, info.getInfo());
}
public void setAccessibilityDelegate(View v, @Nullable AccessibilityDelegateCompat delegate) {
ViewCompatICS.setAccessibilityDelegate(v, delegate == null ? null : delegate.getBridge());
}
public boolean hasAccessibilityDelegate(View v) {
boolean z = true;
if (accessibilityDelegateCheckFailed) {
return false;
}
if (mAccessibilityDelegateField == null) {
try {
mAccessibilityDelegateField = View.class.getDeclaredField("mAccessibilityDelegate");
mAccessibilityDelegateField.setAccessible(true);
} catch (Throwable th) {
accessibilityDelegateCheckFailed = true;
return false;
}
}
try {
if (mAccessibilityDelegateField.get(v) == null) {
z = false;
}
return z;
} catch (Throwable th2) {
accessibilityDelegateCheckFailed = true;
return false;
}
}
public ViewPropertyAnimatorCompat animate(View view) {
if (this.mViewPropertyAnimatorCompatMap == null) {
this.mViewPropertyAnimatorCompatMap = new WeakHashMap();
}
ViewPropertyAnimatorCompat vpa = (ViewPropertyAnimatorCompat) this.mViewPropertyAnimatorCompatMap.get(view);
if (vpa != null) {
return vpa;
}
vpa = new ViewPropertyAnimatorCompat(view);
this.mViewPropertyAnimatorCompatMap.put(view, vpa);
return vpa;
}
public void setFitsSystemWindows(View view, boolean fitSystemWindows) {
ViewCompatICS.setFitsSystemWindows(view, fitSystemWindows);
}
}
static class ICSMr1ViewCompatImpl extends ICSViewCompatImpl {
ICSMr1ViewCompatImpl() {
}
public boolean hasOnClickListeners(View view) {
return ViewCompatICSMr1.hasOnClickListeners(view);
}
}
static class JBViewCompatImpl extends ICSMr1ViewCompatImpl {
JBViewCompatImpl() {
}
public boolean hasTransientState(View view) {
return ViewCompatJB.hasTransientState(view);
}
public void setHasTransientState(View view, boolean hasTransientState) {
ViewCompatJB.setHasTransientState(view, hasTransientState);
}
public void postInvalidateOnAnimation(View view) {
ViewCompatJB.postInvalidateOnAnimation(view);
}
public void postInvalidateOnAnimation(View view, int left, int top, int right, int bottom) {
ViewCompatJB.postInvalidateOnAnimation(view, left, top, right, bottom);
}
public void postOnAnimation(View view, Runnable action) {
ViewCompatJB.postOnAnimation(view, action);
}
public void postOnAnimationDelayed(View view, Runnable action, long delayMillis) {
ViewCompatJB.postOnAnimationDelayed(view, action, delayMillis);
}
public int getImportantForAccessibility(View view) {
return ViewCompatJB.getImportantForAccessibility(view);
}
public void setImportantForAccessibility(View view, int mode) {
if (mode == 4) {
mode = 2;
}
ViewCompatJB.setImportantForAccessibility(view, mode);
}
public boolean performAccessibilityAction(View view, int action, Bundle arguments) {
return ViewCompatJB.performAccessibilityAction(view, action, arguments);
}
public AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View view) {
Object compat = ViewCompatJB.getAccessibilityNodeProvider(view);
if (compat != null) {
return new AccessibilityNodeProviderCompat(compat);
}
return null;
}
public ViewParent getParentForAccessibility(View view) {
return ViewCompatJB.getParentForAccessibility(view);
}
public int getMinimumWidth(View view) {
return ViewCompatJB.getMinimumWidth(view);
}
public int getMinimumHeight(View view) {
return ViewCompatJB.getMinimumHeight(view);
}
public void requestApplyInsets(View view) {
ViewCompatJB.requestApplyInsets(view);
}
public boolean getFitsSystemWindows(View view) {
return ViewCompatJB.getFitsSystemWindows(view);
}
public boolean hasOverlappingRendering(View view) {
return ViewCompatJB.hasOverlappingRendering(view);
}
}
static class JbMr1ViewCompatImpl extends JBViewCompatImpl {
JbMr1ViewCompatImpl() {
}
public int getLabelFor(View view) {
return ViewCompatJellybeanMr1.getLabelFor(view);
}
public void setLabelFor(View view, int id) {
ViewCompatJellybeanMr1.setLabelFor(view, id);
}
public void setLayerPaint(View view, Paint paint) {
ViewCompatJellybeanMr1.setLayerPaint(view, paint);
}
public int getLayoutDirection(View view) {
return ViewCompatJellybeanMr1.getLayoutDirection(view);
}
public void setLayoutDirection(View view, int layoutDirection) {
ViewCompatJellybeanMr1.setLayoutDirection(view, layoutDirection);
}
public int getPaddingStart(View view) {
return ViewCompatJellybeanMr1.getPaddingStart(view);
}
public int getPaddingEnd(View view) {
return ViewCompatJellybeanMr1.getPaddingEnd(view);
}
public void setPaddingRelative(View view, int start, int top, int end, int bottom) {
ViewCompatJellybeanMr1.setPaddingRelative(view, start, top, end, bottom);
}
public int getWindowSystemUiVisibility(View view) {
return ViewCompatJellybeanMr1.getWindowSystemUiVisibility(view);
}
public boolean isPaddingRelative(View view) {
return ViewCompatJellybeanMr1.isPaddingRelative(view);
}
}
static class JbMr2ViewCompatImpl extends JbMr1ViewCompatImpl {
JbMr2ViewCompatImpl() {
}
public void setClipBounds(View view, Rect clipBounds) {
ViewCompatJellybeanMr2.setClipBounds(view, clipBounds);
}
public Rect getClipBounds(View view) {
return ViewCompatJellybeanMr2.getClipBounds(view);
}
}
static class KitKatViewCompatImpl extends JbMr2ViewCompatImpl {
KitKatViewCompatImpl() {
}
public int getAccessibilityLiveRegion(View view) {
return ViewCompatKitKat.getAccessibilityLiveRegion(view);
}
public void setAccessibilityLiveRegion(View view, int mode) {
ViewCompatKitKat.setAccessibilityLiveRegion(view, mode);
}
public void setImportantForAccessibility(View view, int mode) {
ViewCompatJB.setImportantForAccessibility(view, mode);
}
public boolean isLaidOut(View view) {
return ViewCompatKitKat.isLaidOut(view);
}
public boolean isAttachedToWindow(View view) {
return ViewCompatKitKat.isAttachedToWindow(view);
}
}
static class LollipopViewCompatImpl extends KitKatViewCompatImpl {
LollipopViewCompatImpl() {
}
public void setTransitionName(View view, String transitionName) {
ViewCompatLollipop.setTransitionName(view, transitionName);
}
public String getTransitionName(View view) {
return ViewCompatLollipop.getTransitionName(view);
}
public void requestApplyInsets(View view) {
ViewCompatLollipop.requestApplyInsets(view);
}
public void setElevation(View view, float elevation) {
ViewCompatLollipop.setElevation(view, elevation);
}
public float getElevation(View view) {
return ViewCompatLollipop.getElevation(view);
}
public void setTranslationZ(View view, float translationZ) {
ViewCompatLollipop.setTranslationZ(view, translationZ);
}
public float getTranslationZ(View view) {
return ViewCompatLollipop.getTranslationZ(view);
}
public void setOnApplyWindowInsetsListener(View view, OnApplyWindowInsetsListener listener) {
ViewCompatLollipop.setOnApplyWindowInsetsListener(view, listener);
}
public void setNestedScrollingEnabled(View view, boolean enabled) {
ViewCompatLollipop.setNestedScrollingEnabled(view, enabled);
}
public boolean isNestedScrollingEnabled(View view) {
return ViewCompatLollipop.isNestedScrollingEnabled(view);
}
public boolean startNestedScroll(View view, int axes) {
return ViewCompatLollipop.startNestedScroll(view, axes);
}
public void stopNestedScroll(View view) {
ViewCompatLollipop.stopNestedScroll(view);
}
public boolean hasNestedScrollingParent(View view) {
return ViewCompatLollipop.hasNestedScrollingParent(view);
}
public boolean dispatchNestedScroll(View view, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) {
return ViewCompatLollipop.dispatchNestedScroll(view, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow);
}
public boolean dispatchNestedPreScroll(View view, int dx, int dy, int[] consumed, int[] offsetInWindow) {
return ViewCompatLollipop.dispatchNestedPreScroll(view, dx, dy, consumed, offsetInWindow);
}
public boolean dispatchNestedFling(View view, float velocityX, float velocityY, boolean consumed) {
return ViewCompatLollipop.dispatchNestedFling(view, velocityX, velocityY, consumed);
}
public boolean dispatchNestedPreFling(View view, float velocityX, float velocityY) {
return ViewCompatLollipop.dispatchNestedPreFling(view, velocityX, velocityY);
}
public boolean isImportantForAccessibility(View view) {
return ViewCompatLollipop.isImportantForAccessibility(view);
}
public ColorStateList getBackgroundTintList(View view) {
return ViewCompatLollipop.getBackgroundTintList(view);
}
public void setBackgroundTintList(View view, ColorStateList tintList) {
ViewCompatLollipop.setBackgroundTintList(view, tintList);
}
public void setBackgroundTintMode(View view, Mode mode) {
ViewCompatLollipop.setBackgroundTintMode(view, mode);
}
public Mode getBackgroundTintMode(View view) {
return ViewCompatLollipop.getBackgroundTintMode(view);
}
public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) {
return ViewCompatLollipop.onApplyWindowInsets(v, insets);
}
public WindowInsetsCompat dispatchApplyWindowInsets(View v, WindowInsetsCompat insets) {
return ViewCompatLollipop.dispatchApplyWindowInsets(v, insets);
}
public float getZ(View view) {
return ViewCompatLollipop.getZ(view);
}
}
static class MarshmallowViewCompatImpl extends LollipopViewCompatImpl {
MarshmallowViewCompatImpl() {
}
public void setScrollIndicators(View view, int indicators) {
ViewCompatMarshmallow.setScrollIndicators(view, indicators);
}
public void setScrollIndicators(View view, int indicators, int mask) {
ViewCompatMarshmallow.setScrollIndicators(view, indicators, mask);
}
public int getScrollIndicators(View view) {
return ViewCompatMarshmallow.getScrollIndicators(view);
}
}
static {
int version = VERSION.SDK_INT;
if (version >= 23) {
IMPL = new MarshmallowViewCompatImpl();
} else if (version >= 21) {
IMPL = new LollipopViewCompatImpl();
} else if (version >= 19) {
IMPL = new KitKatViewCompatImpl();
} else if (version >= 17) {
IMPL = new JbMr1ViewCompatImpl();
} else if (version >= 16) {
IMPL = new JBViewCompatImpl();
} else if (version >= 15) {
IMPL = new ICSMr1ViewCompatImpl();
} else if (version >= 14) {
IMPL = new ICSViewCompatImpl();
} else if (version >= 11) {
IMPL = new HCViewCompatImpl();
} else if (version >= 9) {
IMPL = new GBViewCompatImpl();
} else if (version >= 7) {
IMPL = new EclairMr1ViewCompatImpl();
} else {
IMPL = new BaseViewCompatImpl();
}
}
public static boolean canScrollHorizontally(View v, int direction) {
return IMPL.canScrollHorizontally(v, direction);
}
public static boolean canScrollVertically(View v, int direction) {
return IMPL.canScrollVertically(v, direction);
}
public static int getOverScrollMode(View v) {
return IMPL.getOverScrollMode(v);
}
public static void setOverScrollMode(View v, int overScrollMode) {
IMPL.setOverScrollMode(v, overScrollMode);
}
public static void onPopulateAccessibilityEvent(View v, AccessibilityEvent event) {
IMPL.onPopulateAccessibilityEvent(v, event);
}
public static void onInitializeAccessibilityEvent(View v, AccessibilityEvent event) {
IMPL.onInitializeAccessibilityEvent(v, event);
}
public static void onInitializeAccessibilityNodeInfo(View v, AccessibilityNodeInfoCompat info) {
IMPL.onInitializeAccessibilityNodeInfo(v, info);
}
public static void setAccessibilityDelegate(View v, AccessibilityDelegateCompat delegate) {
IMPL.setAccessibilityDelegate(v, delegate);
}
public static boolean hasAccessibilityDelegate(View v) {
return IMPL.hasAccessibilityDelegate(v);
}
public static boolean hasTransientState(View view) {
return IMPL.hasTransientState(view);
}
public static void setHasTransientState(View view, boolean hasTransientState) {
IMPL.setHasTransientState(view, hasTransientState);
}
public static void postInvalidateOnAnimation(View view) {
IMPL.postInvalidateOnAnimation(view);
}
public static void postInvalidateOnAnimation(View view, int left, int top, int right, int bottom) {
IMPL.postInvalidateOnAnimation(view, left, top, right, bottom);
}
public static void postOnAnimation(View view, Runnable action) {
IMPL.postOnAnimation(view, action);
}
public static void postOnAnimationDelayed(View view, Runnable action, long delayMillis) {
IMPL.postOnAnimationDelayed(view, action, delayMillis);
}
public static int getImportantForAccessibility(View view) {
return IMPL.getImportantForAccessibility(view);
}
public static void setImportantForAccessibility(View view, int mode) {
IMPL.setImportantForAccessibility(view, mode);
}
public static boolean performAccessibilityAction(View view, int action, Bundle arguments) {
return IMPL.performAccessibilityAction(view, action, arguments);
}
public static AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View view) {
return IMPL.getAccessibilityNodeProvider(view);
}
public static float getAlpha(View view) {
return IMPL.getAlpha(view);
}
public static void setLayerType(View view, int layerType, Paint paint) {
IMPL.setLayerType(view, layerType, paint);
}
public static int getLayerType(View view) {
return IMPL.getLayerType(view);
}
public static int getLabelFor(View view) {
return IMPL.getLabelFor(view);
}
public static void setLabelFor(View view, @IdRes int labeledId) {
IMPL.setLabelFor(view, labeledId);
}
public static void setLayerPaint(View view, Paint paint) {
IMPL.setLayerPaint(view, paint);
}
public static int getLayoutDirection(View view) {
return IMPL.getLayoutDirection(view);
}
public static void setLayoutDirection(View view, int layoutDirection) {
IMPL.setLayoutDirection(view, layoutDirection);
}
public static ViewParent getParentForAccessibility(View view) {
return IMPL.getParentForAccessibility(view);
}
public static boolean isOpaque(View view) {
return IMPL.isOpaque(view);
}
public static int resolveSizeAndState(int size, int measureSpec, int childMeasuredState) {
return IMPL.resolveSizeAndState(size, measureSpec, childMeasuredState);
}
public static int getMeasuredWidthAndState(View view) {
return IMPL.getMeasuredWidthAndState(view);
}
public static int getMeasuredHeightAndState(View view) {
return IMPL.getMeasuredHeightAndState(view);
}
public static int getMeasuredState(View view) {
return IMPL.getMeasuredState(view);
}
public static int combineMeasuredStates(int curState, int newState) {
return IMPL.combineMeasuredStates(curState, newState);
}
public static int getAccessibilityLiveRegion(View view) {
return IMPL.getAccessibilityLiveRegion(view);
}
public static void setAccessibilityLiveRegion(View view, int mode) {
IMPL.setAccessibilityLiveRegion(view, mode);
}
public static int getPaddingStart(View view) {
return IMPL.getPaddingStart(view);
}
public static int getPaddingEnd(View view) {
return IMPL.getPaddingEnd(view);
}
public static void setPaddingRelative(View view, int start, int top, int end, int bottom) {
IMPL.setPaddingRelative(view, start, top, end, bottom);
}
public static void dispatchStartTemporaryDetach(View view) {
IMPL.dispatchStartTemporaryDetach(view);
}
public static void dispatchFinishTemporaryDetach(View view) {
IMPL.dispatchFinishTemporaryDetach(view);
}
public static float getTranslationX(View view) {
return IMPL.getTranslationX(view);
}
public static float getTranslationY(View view) {
return IMPL.getTranslationY(view);
}
public static int getMinimumWidth(View view) {
return IMPL.getMinimumWidth(view);
}
public static int getMinimumHeight(View view) {
return IMPL.getMinimumHeight(view);
}
public static ViewPropertyAnimatorCompat animate(View view) {
return IMPL.animate(view);
}
public static void setTranslationX(View view, float value) {
IMPL.setTranslationX(view, value);
}
public static void setTranslationY(View view, float value) {
IMPL.setTranslationY(view, value);
}
public static void setAlpha(View view, @FloatRange(from = 0.0d, to = 1.0d) float value) {
IMPL.setAlpha(view, value);
}
public static void setX(View view, float value) {
IMPL.setX(view, value);
}
public static void setY(View view, float value) {
IMPL.setY(view, value);
}
public static void setRotation(View view, float value) {
IMPL.setRotation(view, value);
}
public static void setRotationX(View view, float value) {
IMPL.setRotationX(view, value);
}
public static void setRotationY(View view, float value) {
IMPL.setRotationY(view, value);
}
public static void setScaleX(View view, float value) {
IMPL.setScaleX(view, value);
}
public static void setScaleY(View view, float value) {
IMPL.setScaleY(view, value);
}
public static float getPivotX(View view) {
return IMPL.getPivotX(view);
}
public static void setPivotX(View view, float value) {
IMPL.setPivotX(view, value);
}
public static float getPivotY(View view) {
return IMPL.getPivotY(view);
}
public static void setPivotY(View view, float value) {
IMPL.setPivotY(view, value);
}
public static float getRotation(View view) {
return IMPL.getRotation(view);
}
public static float getRotationX(View view) {
return IMPL.getRotationX(view);
}
public static float getRotationY(View view) {
return IMPL.getRotationY(view);
}
public static float getScaleX(View view) {
return IMPL.getScaleX(view);
}
public static float getScaleY(View view) {
return IMPL.getScaleY(view);
}
public static float getX(View view) {
return IMPL.getX(view);
}
public static float getY(View view) {
return IMPL.getY(view);
}
public static void setElevation(View view, float elevation) {
IMPL.setElevation(view, elevation);
}
public static float getElevation(View view) {
return IMPL.getElevation(view);
}
public static void setTranslationZ(View view, float translationZ) {
IMPL.setTranslationZ(view, translationZ);
}
public static float getTranslationZ(View view) {
return IMPL.getTranslationZ(view);
}
public static void setTransitionName(View view, String transitionName) {
IMPL.setTransitionName(view, transitionName);
}
public static String getTransitionName(View view) {
return IMPL.getTransitionName(view);
}
public static int getWindowSystemUiVisibility(View view) {
return IMPL.getWindowSystemUiVisibility(view);
}
public static void requestApplyInsets(View view) {
IMPL.requestApplyInsets(view);
}
public static void setChildrenDrawingOrderEnabled(ViewGroup viewGroup, boolean enabled) {
IMPL.setChildrenDrawingOrderEnabled(viewGroup, enabled);
}
public static boolean getFitsSystemWindows(View v) {
return IMPL.getFitsSystemWindows(v);
}
public static void setFitsSystemWindows(View view, boolean fitSystemWindows) {
IMPL.setFitsSystemWindows(view, fitSystemWindows);
}
public static void jumpDrawablesToCurrentState(View v) {
IMPL.jumpDrawablesToCurrentState(v);
}
public static void setOnApplyWindowInsetsListener(View v, OnApplyWindowInsetsListener listener) {
IMPL.setOnApplyWindowInsetsListener(v, listener);
}
public static WindowInsetsCompat onApplyWindowInsets(View view, WindowInsetsCompat insets) {
return IMPL.onApplyWindowInsets(view, insets);
}
public static WindowInsetsCompat dispatchApplyWindowInsets(View view, WindowInsetsCompat insets) {
return IMPL.dispatchApplyWindowInsets(view, insets);
}
public static void setSaveFromParentEnabled(View v, boolean enabled) {
IMPL.setSaveFromParentEnabled(v, enabled);
}
public static void setActivated(View view, boolean activated) {
IMPL.setActivated(view, activated);
}
public static boolean hasOverlappingRendering(View view) {
return IMPL.hasOverlappingRendering(view);
}
public static boolean isPaddingRelative(View view) {
return IMPL.isPaddingRelative(view);
}
public static ColorStateList getBackgroundTintList(View view) {
return IMPL.getBackgroundTintList(view);
}
public static void setBackgroundTintList(View view, ColorStateList tintList) {
IMPL.setBackgroundTintList(view, tintList);
}
public static Mode getBackgroundTintMode(View view) {
return IMPL.getBackgroundTintMode(view);
}
public static void setBackgroundTintMode(View view, Mode mode) {
IMPL.setBackgroundTintMode(view, mode);
}
public static void setNestedScrollingEnabled(View view, boolean enabled) {
IMPL.setNestedScrollingEnabled(view, enabled);
}
public static boolean isNestedScrollingEnabled(View view) {
return IMPL.isNestedScrollingEnabled(view);
}
public static boolean startNestedScroll(View view, int axes) {
return IMPL.startNestedScroll(view, axes);
}
public static void stopNestedScroll(View view) {
IMPL.stopNestedScroll(view);
}
public static boolean hasNestedScrollingParent(View view) {
return IMPL.hasNestedScrollingParent(view);
}
public static boolean dispatchNestedScroll(View view, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) {
return IMPL.dispatchNestedScroll(view, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow);
}
public static boolean dispatchNestedPreScroll(View view, int dx, int dy, int[] consumed, int[] offsetInWindow) {
return IMPL.dispatchNestedPreScroll(view, dx, dy, consumed, offsetInWindow);
}
public static boolean dispatchNestedFling(View view, float velocityX, float velocityY, boolean consumed) {
return IMPL.dispatchNestedFling(view, velocityX, velocityY, consumed);
}
public static boolean dispatchNestedPreFling(View view, float velocityX, float velocityY) {
return IMPL.dispatchNestedPreFling(view, velocityX, velocityY);
}
public static boolean isLaidOut(View view) {
return IMPL.isLaidOut(view);
}
public static float getZ(View view) {
return IMPL.getZ(view);
}
public static void offsetTopAndBottom(View view, int offset) {
view.offsetTopAndBottom(offset);
if (offset != 0 && VERSION.SDK_INT < 11) {
view.invalidate();
}
}
public static void offsetLeftAndRight(View view, int offset) {
view.offsetLeftAndRight(offset);
if (offset != 0 && VERSION.SDK_INT < 11) {
view.invalidate();
}
}
public static void setClipBounds(View view, Rect clipBounds) {
IMPL.setClipBounds(view, clipBounds);
}
public static Rect getClipBounds(View view) {
return IMPL.getClipBounds(view);
}
public static boolean isAttachedToWindow(View view) {
return IMPL.isAttachedToWindow(view);
}
public static boolean hasOnClickListeners(View view) {
return IMPL.hasOnClickListeners(view);
}
public static void setScrollIndicators(@NonNull View view, int indicators) {
IMPL.setScrollIndicators(view, indicators);
}
public static void setScrollIndicators(@NonNull View view, int indicators, int mask) {
IMPL.setScrollIndicators(view, indicators, mask);
}
public static int getScrollIndicators(@NonNull View view) {
return IMPL.getScrollIndicators(view);
}
}