1f381013a75d012edb8b5524e6a36893b465d277
[pub/Android/ownCloud.git] / 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, AttributeSet attrs) {
13 super(context, attrs);
14 mProxy = AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : null;
15 }
16
17 @Override
18 public void setVisibility(int visibility) {
19 if (mProxy != null) {
20 if (visibility == GONE) {
21 clearAnimation();
22 } else if (visibility == VISIBLE) {
23 setAnimation(mProxy);
24 }
25 }
26 super.setVisibility(visibility);
27 }
28
29 public float getAlpha() {
30 if (AnimatorProxy.NEEDS_PROXY) {
31 return mProxy.getAlpha();
32 } else {
33 return super.getAlpha();
34 }
35 }
36 public void setAlpha(float alpha) {
37 if (AnimatorProxy.NEEDS_PROXY) {
38 mProxy.setAlpha(alpha);
39 } else {
40 super.setAlpha(alpha);
41 }
42 }
43 public float getTranslationX() {
44 if (AnimatorProxy.NEEDS_PROXY) {
45 return mProxy.getTranslationX();
46 } else {
47 return super.getTranslationX();
48 }
49 }
50 public void setTranslationX(float translationX) {
51 if (AnimatorProxy.NEEDS_PROXY) {
52 mProxy.setTranslationX(translationX);
53 } else {
54 super.setTranslationX(translationX);
55 }
56 }
57 }