Updated heart animation
This commit is contained in:
parent
22e757170f
commit
3e9868cd34
2 changed files with 9 additions and 6 deletions
|
|
@ -11,6 +11,7 @@ import android.support.v4.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.animation.AccelerateInterpolator;
|
||||||
import android.view.animation.DecelerateInterpolator;
|
import android.view.animation.DecelerateInterpolator;
|
||||||
import android.view.animation.OvershootInterpolator;
|
import android.view.animation.OvershootInterpolator;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
@ -168,7 +169,7 @@ public class PlayerAlbumCoverFragment extends Fragment implements MusicServiceEv
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showHeart() {
|
public void showHeartAnimation() {
|
||||||
favoriteIcon.clearAnimation();
|
favoriteIcon.clearAnimation();
|
||||||
|
|
||||||
favoriteIcon.setAlpha(0f);
|
favoriteIcon.setAlpha(0f);
|
||||||
|
|
@ -179,8 +180,8 @@ public class PlayerAlbumCoverFragment extends Fragment implements MusicServiceEv
|
||||||
favoriteIcon.setPivotY(favoriteIcon.getHeight() / 2);
|
favoriteIcon.setPivotY(favoriteIcon.getHeight() / 2);
|
||||||
|
|
||||||
favoriteIcon.animate()
|
favoriteIcon.animate()
|
||||||
.setDuration(600)
|
.setDuration(500)
|
||||||
.setInterpolator(new OvershootInterpolator())
|
.setInterpolator(new DecelerateInterpolator())
|
||||||
.scaleX(1f)
|
.scaleX(1f)
|
||||||
.scaleY(1f)
|
.scaleY(1f)
|
||||||
.alpha(1f)
|
.alpha(1f)
|
||||||
|
|
@ -194,8 +195,10 @@ public class PlayerAlbumCoverFragment extends Fragment implements MusicServiceEv
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
favoriteIcon.animate()
|
favoriteIcon.animate()
|
||||||
.setDuration(300)
|
.setDuration(500)
|
||||||
.setInterpolator(new DecelerateInterpolator())
|
.setInterpolator(new AccelerateInterpolator())
|
||||||
|
.scaleX(0f)
|
||||||
|
.scaleY(0f)
|
||||||
.alpha(0f)
|
.alpha(0f)
|
||||||
.start();
|
.start();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -317,7 +317,7 @@ public class PlayerFragment extends Fragment implements MusicServiceEventListene
|
||||||
case R.id.action_toggle_favorite:
|
case R.id.action_toggle_favorite:
|
||||||
MusicUtil.toggleFavorite(activity, song);
|
MusicUtil.toggleFavorite(activity, song);
|
||||||
if (MusicUtil.isFavorite(activity, song)) {
|
if (MusicUtil.isFavorite(activity, song)) {
|
||||||
playerAlbumCoverFragment.showHeart();
|
playerAlbumCoverFragment.showHeartAnimation();
|
||||||
}
|
}
|
||||||
updatePlayerMenu();
|
updatePlayerMenu();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue