create changelog entry
[debian/openrocket] / android-libraries / ActionBarSherlock / src / com / actionbarsherlock / internal / nineoldandroids / view / NineViewGroup.java
1 package com.actionbarsherlock.internal.nineoldandroids.view;
2
3 import android.content.Context;
4 import android.util.AttributeSet;
5 import android.view.ViewGroup;
6
7 import com.actionbarsherlock.internal.nineoldandroids.view.animation.AnimatorProxy;
8
9 public abstract class NineViewGroup extends ViewGroup {
10     private final AnimatorProxy mProxy;
11
12     public NineViewGroup(Context context) {
13         super(context);
14         mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
15     }
16     public NineViewGroup(Context context, AttributeSet attrs) {
17         super(context, attrs);
18         mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
19     }
20     public NineViewGroup(Context context, AttributeSet attrs, int defStyle) {
21         super(context, attrs, defStyle);
22         mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
23     }
24
25     @Override
26     public void setVisibility(int visibility) {
27         if (mProxy != null) {
28             if (visibility == GONE) {
29                 clearAnimation();
30             } else if (visibility == VISIBLE) {
31                 setAnimation(mProxy);
32             }
33         }
34         super.setVisibility(visibility);
35     }
36
37     public float getAlpha() {
38         if (AnimatorProxy.NEEDS_PROXY) {
39             return mProxy.getAlpha();
40         } else {
41             return super.getAlpha();
42         }
43     }
44     public void setAlpha(float alpha) {
45         if (AnimatorProxy.NEEDS_PROXY) {
46             mProxy.setAlpha(alpha);
47         } else {
48             super.setAlpha(alpha);
49         }
50     }
51     public float getTranslationX() {
52         if (AnimatorProxy.NEEDS_PROXY) {
53             return mProxy.getTranslationX();
54         } else {
55             return super.getTranslationX();
56         }
57     }
58     public void setTranslationX(float translationX) {
59         if (AnimatorProxy.NEEDS_PROXY) {
60             mProxy.setTranslationX(translationX);
61         } else {
62             super.setTranslationX(translationX);
63         }
64     }
65     public float getTranslationY() {
66         if (AnimatorProxy.NEEDS_PROXY) {
67             return mProxy.getTranslationY();
68         } else {
69             return super.getTranslationY();
70         }
71     }
72     public void setTranslationY(float translationY) {
73         if (AnimatorProxy.NEEDS_PROXY) {
74             mProxy.setTranslationY(translationY);
75         } else {
76             super.setTranslationY(translationY);
77         }
78     }
79 }