diff options
author | lado <herrlado@gmail.com> | 2017-11-02 10:41:17 +0100 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2017-11-02 10:41:17 +0100 |
commit | e044aed11d8982398fa556eacde9af1003af1c5a (patch) | |
tree | 3a09298670b27b551c072782f410b43bf966b2c0 /vdrmanager/app/src/main/java/de/androvdr/widget/AnimatedTextView.java | |
parent | 049975cbda6327aae542bac5dd1acd6fe97d18a4 (diff) | |
download | vdr-manager-e044aed11d8982398fa556eacde9af1003af1c5a.tar.gz vdr-manager-e044aed11d8982398fa556eacde9af1003af1c5a.tar.bz2 |
refactor vdrmanager -> de.bjusystems.vdrmanager
Diffstat (limited to 'vdrmanager/app/src/main/java/de/androvdr/widget/AnimatedTextView.java')
-rw-r--r-- | vdrmanager/app/src/main/java/de/androvdr/widget/AnimatedTextView.java | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/vdrmanager/app/src/main/java/de/androvdr/widget/AnimatedTextView.java b/vdrmanager/app/src/main/java/de/androvdr/widget/AnimatedTextView.java deleted file mode 100644 index b6c120b..0000000 --- a/vdrmanager/app/src/main/java/de/androvdr/widget/AnimatedTextView.java +++ /dev/null @@ -1,101 +0,0 @@ -package de.androvdr.widget; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.View; -import android.view.animation.AlphaAnimation; -import android.view.animation.Animation; -import android.view.animation.AnimationUtils; -import android.widget.TextView; - -/** - * Created by lado on 04.05.15. - */ -public class AnimatedTextView extends TextView { - private static final int IS_ANIMATING_TAG_ID = "isAnimating".hashCode(); - - private Animation fadeInAnimation; - private Animation fadeOutAnimation; - - public AnimatedTextView(Context context) { - super(context); - - initAnimations(context); - } - - public AnimatedTextView(Context context, AttributeSet attrs) { - super(context, attrs); - - initAnimations(context); - } - - public AnimatedTextView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - - initAnimations(context); - } - - public void initAnimations(Context context) { - fadeInAnimation = AnimationUtils.loadAnimation(this.getContext(), android.R.anim.fade_in); - - fadeOutAnimation = new AlphaAnimation(1.0f, 0.0f); - fadeOutAnimation.setDuration(100); - fadeInAnimation.setAnimationListener(new Animation.AnimationListener() { - @Override - public void onAnimationStart(Animation animation) { - setAnimatingFlag(true); - } - - @Override - public void onAnimationEnd(Animation animation) { - setAnimatingFlag(false); - } - - @Override - public void onAnimationRepeat(Animation animation) { - - } - }); - - fadeOutAnimation.setAnimationListener(new Animation.AnimationListener() { - @Override - public void onAnimationStart(Animation animation) { - setAnimatingFlag(false); - } - - @Override - public void onAnimationEnd(Animation animation) { - } - - @Override - public void onAnimationRepeat(Animation animation) { - - } - - }); - - setAnimatingFlag(false); - } - - public void fadeOut() { - if (getVisibility() == View.VISIBLE) { - startAnimation(fadeOutAnimation); - setVisibility(View.INVISIBLE); - } - } - - public void fadeIn() { - //if (getVisibility() == View.INVISIBLE && !isAnimating()) { -// startAnimation(fadeInAnimation); - setVisibility(View.VISIBLE); - // } - } - - private boolean isAnimating() { - return (Boolean) getTag(IS_ANIMATING_TAG_ID) == true; - } - - private void setAnimatingFlag(boolean isAnimating) { - setTag(IS_ANIMATING_TAG_ID, new Boolean(isAnimating)); - } -} |