File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,11 @@ public enum MenuButton {
8989 */
9090 private boolean mAllowOverlayClose = true ;
9191
92+ /**
93+ * Flag indicating that menu is being animated
94+ */
95+ private boolean mAnimating ;
96+
9297
9398 /**
9499 * Menu button position variables in % of screen width or height
@@ -236,6 +241,8 @@ public void setAllowOverlayClose(boolean allow) {
236241 mAllowOverlayClose = allow ;
237242 }
238243
244+ public void setAnimating (boolean isAnimating ) { mAnimating = isAnimating ;}
245+
239246 public boolean isExpanded () {
240247 return mExpanded ;
241248 }
@@ -267,10 +274,13 @@ public float getTranslationX() {
267274 * Toggle the expandable menu button, expanding or collapsing it
268275 */
269276 public void toggle () {
270- if (mExpanded ) {
271- animateCollapse ();
272- } else {
273- animateExpand ();
277+ if (!mAnimating ) {
278+ mAnimating = true ;
279+ if (mExpanded ) {
280+ animateCollapse ();
281+ } else {
282+ animateExpand ();
283+ }
274284 }
275285 }
276286
@@ -578,6 +588,7 @@ public void run() {
578588 @ Override
579589 public void run () {
580590 invalidateViewsForPreHC ();
591+ mAnimating = false ;
581592 mExpanded = !mExpanded ;
582593 }
583594 }, 50 );
Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ public void show() {
106106 * Dismiss the dialog, removing screen dim and hiding the expanded menu
107107 */
108108 public void dismiss () {
109+ mButtonMenu .setAnimating (false );
109110 mDialog .dismiss ();
110111 }
111112
You can’t perform that action at this time.
0 commit comments