ViewCompatHC.java revision c096ad1894f1a4543e703ddc9d279fbd3b596c53
1ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell/*
2ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * Copyright (C) 2012 The Android Open Source Project
3ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell *
4ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * Licensed under the Apache License, Version 2.0 (the "License");
5ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * you may not use this file except in compliance with the License.
6ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * You may obtain a copy of the License at
7ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell *
8ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell *      http://www.apache.org/licenses/LICENSE-2.0
9ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell *
10ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * Unless required by applicable law or agreed to in writing, software
11ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * distributed under the License is distributed on an "AS IS" BASIS,
12ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * See the License for the specific language governing permissions and
14ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell * limitations under the License.
15ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell */
16ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell
17ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powellpackage android.support.v4.view;
18ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell
19ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powellimport android.animation.ValueAnimator;
208a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powellimport android.graphics.Paint;
218a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powellimport android.view.View;
22ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell
23ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powellclass ViewCompatHC {
24ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell    static long getFrameTime() {
25ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell        return ValueAnimator.getFrameDelay();
26ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell    }
278a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell
286eb3cdf42d5382aef6b6a6afd7c305dbc27885b9Alan Viverette    public static float getAlpha(View view) {
296eb3cdf42d5382aef6b6a6afd7c305dbc27885b9Alan Viverette        return view.getAlpha();
306eb3cdf42d5382aef6b6a6afd7c305dbc27885b9Alan Viverette    }
316eb3cdf42d5382aef6b6a6afd7c305dbc27885b9Alan Viverette
328a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell    public static void setLayerType(View view, int layerType, Paint paint) {
338a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell        view.setLayerType(layerType, paint);
348a0c51a3d438802df28612e02fdf0cc8fab06ddbAdam Powell    }
3597341bdc5bea1d7bf777de65228039142d249f38Adam Powell
3697341bdc5bea1d7bf777de65228039142d249f38Adam Powell    public static int getLayerType(View view) {
3797341bdc5bea1d7bf777de65228039142d249f38Adam Powell        return view.getLayerType();
3897341bdc5bea1d7bf777de65228039142d249f38Adam Powell    }
39b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell
40b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    public static int resolveSizeAndState(int size, int measureSpec, int childMeasuredState) {
41b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        return View.resolveSizeAndState(size, measureSpec, childMeasuredState);
42b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    }
43b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell
44b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    public static int getMeasuredWidthAndState(View view) {
45b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        return view.getMeasuredWidthAndState();
46b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    }
47b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell
48b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    public static int getMeasuredHeightAndState(View view) {
49b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        return view.getMeasuredHeightAndState();
50b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    }
51b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell
52b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    public static int getMeasuredState(View view) {
53b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell        return view.getMeasuredState();
54b12ba0547b2fad1c4dfc12dec36c5e7893974e67Adam Powell    }
55c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell
56c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell    public static float getTranslationX(View view) {
57c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell        return view.getTranslationX();
58c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell    }
59c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell
60c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell    public static float getTranslationY(View view) {
61c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell        return view.getTranslationY();
62c096ad1894f1a4543e703ddc9d279fbd3b596c53Adam Powell    }
63ec03704fbb4f0217d4c274d1c6cf56e6ea4dcfbdAdam Powell}
64