Skip to content

Commit

Permalink
added subtle animation on button key press
Browse files Browse the repository at this point in the history
  • Loading branch information
codokie committed Apr 1, 2024
1 parent 64bcd29 commit 314c6e5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import static helium314.keyboard.latin.utils.ToolbarUtilsKt.*;

import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.annotation.SuppressLint;
import android.app.KeyguardManager;
import android.content.ClipData;
Expand Down Expand Up @@ -662,6 +664,11 @@ public void onClick(final View view) {
updateKeys(); // update icon
view.setActivated(!view.isActivated());
}
else if (tag == ToolbarKey.CLEAR_CLIPBOARD) {
Animator animator = AnimatorInflater.loadAnimator(getContext(), R.animator.button_alpha_transition);
animator.setTarget(view);
animator.start();
}
return;
}
}
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/res/animator/button_alpha_transition.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- button_alpha_transition.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:propertyName="alpha"
android:valueFrom="1.0"
android:valueTo="0.5"
android:duration="750" />
<objectAnimator
android:propertyName="alpha"
android:valueFrom="0.5"
android:valueTo="1.0"
android:startOffset="750"
android:duration="750" />
</set>

0 comments on commit 314c6e5

Please sign in to comment.