diff options
Diffstat (limited to 'News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/AlphaAnimator.java')
-rw-r--r-- | News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/AlphaAnimator.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/AlphaAnimator.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/AlphaAnimator.java new file mode 100644 index 00000000..319fa564 --- /dev/null +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/AlphaAnimator.java @@ -0,0 +1,53 @@ +package de.luhmer.owncloudnewsreader.helper; + +import android.view.View; +import android.view.animation.AlphaAnimation; +import android.view.animation.Animation; + +/** + * Created by David on 02.07.2014. + */ +public class AlphaAnimator { + + public static void AnimateVisibilityChange(final View view, final int visibilityTo) { + + + Animation animation; + if(visibilityTo == View.GONE) { + animation = new AlphaAnimation(1f, 0f); + } else { + view.setAlpha(0.1f); + view.setVisibility(View.VISIBLE); + animation = new AlphaAnimation(0f, 1f); + } + + + animation.setFillAfter(true); + animation.setDuration(1000); + animation.setStartOffset(1000); + //animation.setStartOffset(5000); + + /* + animation.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + + } + + @Override + public void onAnimationEnd(Animation animation) { + view.setVisibility(visibilityTo); + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + */ + + animation.start(); + + + } +} |