Skip to content

Commit

Permalink
Merge pull request #110 from Carifio24/spell-window-slide-out-back
Browse files Browse the repository at this point in the history
Fix issue with slide-out animation on back press
  • Loading branch information
Carifio24 authored Nov 2, 2024
2 parents 10f0325 + ddb1d90 commit d893efa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/src/main/java/dnd/jon/spellbook/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,15 @@ public boolean dispatchTouchEvent(MotionEvent ev) {

@Override
public boolean dispatchKeyEvent(KeyEvent ev) {
if (!onTablet && spellWindowFragment != null && ev.getKeyCode() == KeyEvent.KEYCODE_BACK) {
// We only listen for action up events for closing the spell window
// If we listen to both up and down, we'll get two separate events
// and the close animation doesn't get to finish[
if (
!onTablet &&
spellWindowFragment != null &&
ev.getKeyCode() == KeyEvent.KEYCODE_BACK &&
ev.getAction() == KeyEvent.ACTION_UP
) {
closeSpellWindow();
return true;
} else {
Expand Down

0 comments on commit d893efa

Please sign in to comment.