mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-31 10:01:26 +02:00
Merge pull request #11256 from t895/animate-focus-change
Android: Animate covers on focus change
This commit is contained in:
commit
7ce2be9386
@ -7,6 +7,8 @@ import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
@ -86,6 +88,13 @@ public final class GameAdapter extends RecyclerView.Adapter<GameAdapter.GameView
|
||||
}
|
||||
|
||||
holder.gameFile = gameFile;
|
||||
|
||||
Animation animateIn = AnimationUtils.loadAnimation(context, R.anim.anim_card_game_in);
|
||||
animateIn.setFillAfter(true);
|
||||
Animation animateOut = AnimationUtils.loadAnimation(context, R.anim.anim_card_game_out);
|
||||
animateOut.setFillAfter(true);
|
||||
holder.binding.getRoot().setOnFocusChangeListener((v, hasFocus) ->
|
||||
holder.binding.cardGameArt.startAnimation(hasFocus ? animateIn : animateOut));
|
||||
}
|
||||
|
||||
public static class GameViewHolder extends RecyclerView.ViewHolder
|
||||
|
14
Source/Android/app/src/main/res/anim/anim_card_game_in.xml
Normal file
14
Source/Android/app/src/main/res/anim/anim_card_game_in.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<scale
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:fromXScale="1.0"
|
||||
android:fromYScale="1.0"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:toXScale="1.05"
|
||||
android:toYScale="1.05" />
|
||||
|
||||
</set>
|
14
Source/Android/app/src/main/res/anim/anim_card_game_out.xml
Normal file
14
Source/Android/app/src/main/res/anim/anim_card_game_out.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<scale
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:fromXScale="1.05"
|
||||
android:fromYScale="1.05"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:toXScale="1.0"
|
||||
android:toYScale="1.0" />
|
||||
|
||||
</set>
|
Loading…
Reference in New Issue
Block a user