953e3e844440f1501c0dec873a6cb4443bbd6c74
[pub/Android/ownCloud.git] / actionbarsherlock / src / com / actionbarsherlock / internal / nineoldandroids / widget / NineFrameLayout.java
1 package com.actionbarsherlock.internal.nineoldandroids.widget;
2
3 import android.content.Context;
4 import android.util.AttributeSet;
5 import android.widget.FrameLayout;
6
7 import com.actionbarsherlock.internal.nineoldandroids.view.animation.AnimatorProxy;
8
9 public class NineFrameLayout extends FrameLayout {
10 private final AnimatorProxy mProxy;
11
12 public NineFrameLayout(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 getTranslationY() {
44 if (AnimatorProxy.NEEDS_PROXY) {
45 return mProxy.getTranslationY();
46 } else {
47 return super.getTranslationY();
48 }
49 }
50 public void setTranslationY(float translationY) {
51 if (AnimatorProxy.NEEDS_PROXY) {
52 mProxy.setTranslationY(translationY);
53 } else {
54 super.setTranslationY(translationY);
55 }
56 }
57 }