Skip to content
Snippets Groups Projects
Commit d4fc13d2 authored by Jean Chalard's avatar Jean Chalard
Browse files

[PB9] Make buttons that animate-out unclickable

Clicking on a button that is animating-out is only done by
mistake. Better make them unclickable.
Also, interrupt an out-in animation if it has been preempted.

Bug: 7600384
Change-Id: Ic4700cda46a894ea580bc67ee7bef885ecf1d3bc
parent e8ed5d88
No related branches found
No related tags found
No related merge requests found
...@@ -126,6 +126,7 @@ public class ButtonSwitcher extends FrameLayout { ...@@ -126,6 +126,7 @@ public class ButtonSwitcher extends FrameLayout {
new AnimatorListenerAdapter() { new AnimatorListenerAdapter() {
@Override @Override
public void onAnimationEnd(final Animator animation) { public void onAnimationEnd(final Animator animation) {
if (newStatus != mStatus) return;
animateButton(newButton, ANIMATION_IN); animateButton(newButton, ANIMATION_IN);
} }
}); });
...@@ -144,8 +145,10 @@ public class ButtonSwitcher extends FrameLayout { ...@@ -144,8 +145,10 @@ public class ButtonSwitcher extends FrameLayout {
final float outerX = getWidth(); final float outerX = getWidth();
final float innerX = button.getX() - button.getTranslationX(); final float innerX = button.getX() - button.getTranslationX();
if (ANIMATION_IN == direction) { if (ANIMATION_IN == direction) {
button.setClickable(true);
return button.animate().translationX(0); return button.animate().translationX(0);
} else { } else {
button.setClickable(false);
return button.animate().translationX(outerX - innerX); return button.animate().translationX(outerX - innerX);
} }
} }
......
...@@ -219,8 +219,9 @@ public final class WordListPreference extends Preference { ...@@ -219,8 +219,9 @@ public final class WordListPreference extends Preference {
final ListView listView = (ListView)parent; final ListView listView = (ListView)parent;
final int indexToOpen; final int indexToOpen;
// Close all first, we'll open back any item that needs to be open. // Close all first, we'll open back any item that needs to be open.
final boolean wasOpen = mInterfaceState.isOpen(mWordlistId);
mInterfaceState.closeAll(); mInterfaceState.closeAll();
if (mInterfaceState.isOpen(mWordlistId)) { if (wasOpen) {
// This button being shown. Take note that we don't want to open any button in the // This button being shown. Take note that we don't want to open any button in the
// loop below. // loop below.
indexToOpen = -1; indexToOpen = -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment