ViewCompatHC.java revision bc7c32772fbc966091181ce7fa933ca4083679ac
1/* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.support.v4.view; 18 19import android.animation.ValueAnimator; 20import android.graphics.Paint; 21import android.view.View; 22 23class ViewCompatHC { 24 static long getFrameTime() { 25 return ValueAnimator.getFrameDelay(); 26 } 27 28 public static float getAlpha(View view) { 29 return view.getAlpha(); 30 } 31 32 public static void setLayerType(View view, int layerType, Paint paint) { 33 view.setLayerType(layerType, paint); 34 } 35 36 public static int getLayerType(View view) { 37 return view.getLayerType(); 38 } 39 40 public static int resolveSizeAndState(int size, int measureSpec, int childMeasuredState) { 41 return View.resolveSizeAndState(size, measureSpec, childMeasuredState); 42 } 43 44 public static int getMeasuredWidthAndState(View view) { 45 return view.getMeasuredWidthAndState(); 46 } 47 48 public static int getMeasuredHeightAndState(View view) { 49 return view.getMeasuredHeightAndState(); 50 } 51 52 public static int getMeasuredState(View view) { 53 return view.getMeasuredState(); 54 } 55 56 public static float getTranslationX(View view) { 57 return view.getTranslationX(); 58 } 59 60 public static float getTranslationY(View view) { 61 return view.getTranslationY(); 62 } 63 64 public static float getX(View view) { 65 return view.getX(); 66 } 67 68 public static float getY(View view) { 69 return view.getY(); 70 } 71 72 public static float getRotation(View view) { 73 return view.getRotation(); 74 } 75 76 public static float getRotationX(View view) { 77 return view.getRotationX(); 78 } 79 80 public static float getRotationY(View view) { 81 return view.getRotationY(); 82 } 83 84 public static float getScaleX(View view) { 85 return view.getScaleX(); 86 } 87 88 public static float getScaleY(View view) { 89 return view.getScaleY(); 90 } 91 92 public static void setTranslationX(View view, float value) { 93 view.setTranslationX(value); 94 } 95 96 public static void setTranslationY(View view, float value) { 97 view.setTranslationY(value); 98 } 99 100 public static void setAlpha(View view, float value) { 101 view.setAlpha(value); 102 } 103 104 public static void setX(View view, float value) { 105 view.setX(value); 106 } 107 108 public static void setY(View view, float value) { 109 view.setY(value); 110 } 111 112 public static void setRotation(View view, float value) { 113 view.setRotation(value); 114 } 115 116 public static void setRotationX(View view, float value) { 117 view.setRotationX(value); 118 } 119 120 public static void setRotationY(View view, float value) { 121 view.setRotationY(value); 122 } 123 124 public static void setScaleX(View view, float value) { 125 view.setScaleX(value); 126 } 127 128 public static void setScaleY(View view, float value) { 129 view.setScaleY(value); 130 } 131 132 public static void setPivotX(View view, float value) { 133 view.setPivotX(value); 134 } 135 136 public static void setPivotY(View view, float value) { 137 view.setPivotY(value); 138 } 139 140 public static float getPivotX(View view) { 141 return view.getPivotX(); 142 } 143 144 public static float getPivotY(View view) { 145 return view.getPivotY(); 146 } 147 148 public static void jumpDrawablesToCurrentState(View view) { 149 view.jumpDrawablesToCurrentState(); 150 } 151} 152