From 5d0c8e83692027873afd819be7c6eacd44164598 Mon Sep 17 00:00:00 2001 From: Lorenzo Stanco Date: Mon, 28 Apr 2014 10:12:21 +0200 Subject: [PATCH] Fix for mess after Double Click on a Item --- .../ExpandAnimationDemo.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ExpandAnimationExample/src/com/udinic/expand_animation_example/ExpandAnimationDemo.java b/ExpandAnimationExample/src/com/udinic/expand_animation_example/ExpandAnimationDemo.java index 1e96e24..6eb0ddc 100644 --- a/ExpandAnimationExample/src/com/udinic/expand_animation_example/ExpandAnimationDemo.java +++ b/ExpandAnimationExample/src/com/udinic/expand_animation_example/ExpandAnimationDemo.java @@ -35,11 +35,16 @@ public void onItemClick(AdapterView parent, final View view, int position, lo View toolbar = view.findViewById(R.id.toolbar); - // Creating the expand animation for the item - ExpandAnimation expandAni = new ExpandAnimation(toolbar, 500); - - // Start the animation on the toolbar - toolbar.startAnimation(expandAni); + // Start expand/collapse animation, only if animation is not already running + if (!(toolbar.getAnimation() instanceof ExpandAnimation)) { + + // Creating the expand animation for the item + ExpandAnimation expandAni = new ExpandAnimation(toolbar, 500); + + // Start the animation on the toolbar + toolbar.startAnimation(expandAni); + + } } }); }