Austin Huang
4 years ago
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
2 changed files with 81 additions and 0 deletions
-
61app/src/main/java/awais/instagrabber/animations/FabAnimation.java
-
20app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java
@ -0,0 +1,61 @@ |
|||
package awais.instagrabber.animations; |
|||
|
|||
import android.animation.Animator; |
|||
import android.animation.AnimatorListenerAdapter; |
|||
import android.view.View; |
|||
|
|||
// https://medium.com/better-programming/animated-fab-button-with-more-options-2dcf7118fff6 |
|||
|
|||
public class FabAnimation { |
|||
public static boolean rotateFab(final View v, boolean rotate) { |
|||
v.animate().setDuration(200) |
|||
.setListener(new AnimatorListenerAdapter() { |
|||
@Override |
|||
public void onAnimationEnd(Animator animation) { |
|||
super.onAnimationEnd(animation); |
|||
} |
|||
}) |
|||
.rotation(rotate ? 135f : 0f); |
|||
return rotate; |
|||
} |
|||
|
|||
public static void showIn(final View v) { |
|||
v.setVisibility(View.VISIBLE); |
|||
v.setAlpha(0f); |
|||
v.setTranslationY(v.getHeight()); |
|||
v.animate() |
|||
.setDuration(200) |
|||
.translationY(0) |
|||
.setListener(new AnimatorListenerAdapter() { |
|||
@Override |
|||
public void onAnimationEnd(Animator animation) { |
|||
super.onAnimationEnd(animation); |
|||
} |
|||
}) |
|||
.alpha(1f) |
|||
.start(); |
|||
} |
|||
|
|||
public static void showOut(final View v) { |
|||
v.setVisibility(View.VISIBLE); |
|||
v.setAlpha(1f); |
|||
v.setTranslationY(0); |
|||
v.animate() |
|||
.setDuration(200) |
|||
.translationY(v.getHeight()) |
|||
.setListener(new AnimatorListenerAdapter() { |
|||
@Override |
|||
public void onAnimationEnd(Animator animation) { |
|||
v.setVisibility(View.GONE); |
|||
super.onAnimationEnd(animation); |
|||
} |
|||
}).alpha(0f) |
|||
.start(); |
|||
} |
|||
|
|||
public static void init(final View v) { |
|||
v.setVisibility(View.GONE); |
|||
v.setTranslationY(v.getHeight()); |
|||
v.setAlpha(0f); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue