create changelog entry
[debian/openrocket] / android-libraries / ActionBarSherlock / src / com / actionbarsherlock / internal / nineoldandroids / widget / NineLinearLayout.java
1 package com.actionbarsherlock.internal.nineoldandroids.widget;
2
3 import android.content.Context;
4 import android.util.AttributeSet;
5 import android.widget.LinearLayout;
6
7 import com.actionbarsherlock.internal.nineoldandroids.view.animation.AnimatorProxy;
8
9 public class NineLinearLayout extends LinearLayout {
10     private final AnimatorProxy mProxy;
11
12     public NineLinearLayout(Context context) {
13         super(context);
14         mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
15     }
16     public NineLinearLayout(Context context, AttributeSet attrs) {
17         super(context, attrs);
18         mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
19     }
20     public NineLinearLayout(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 }