From 1c0ce278ae6aec843b22e1c32d32c64243b0a53b Mon Sep 17 00:00:00 2001 From: dev Date: Mon, 7 Aug 2017 12:06:26 +0900 Subject: [PATCH] Issue #116 : - Error handling about expand() when already expanded. - Error handling about collapse() when already collapsed. --- .../aakira/expandablelayout/ExpandableLinearLayout.java | 8 ++++---- .../aakira/expandablelayout/ExpandableRelativeLayout.java | 8 ++++---- .../aakira/expandablelayout/ExpandableWeightLayout.java | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/library/src/main/java/com/github/aakira/expandablelayout/ExpandableLinearLayout.java b/library/src/main/java/com/github/aakira/expandablelayout/ExpandableLinearLayout.java index 9320045..810f856 100644 --- a/library/src/main/java/com/github/aakira/expandablelayout/ExpandableLinearLayout.java +++ b/library/src/main/java/com/github/aakira/expandablelayout/ExpandableLinearLayout.java @@ -216,7 +216,7 @@ public void toggle(final long duration, final @Nullable TimeInterpolator interpo */ @Override public void expand() { - if (isAnimating) return; + if (isAnimating || isExpanded()) return; createExpandAnimator(getCurrentPosition(), layoutSize, duration, interpolator).start(); } @@ -226,7 +226,7 @@ public void expand() { */ @Override public void expand(final long duration, final @Nullable TimeInterpolator interpolator) { - if (isAnimating) return; + if (isAnimating || isExpanded()) return; if (duration <= 0) { move(layoutSize, duration, interpolator); @@ -240,7 +240,7 @@ public void expand(final long duration, final @Nullable TimeInterpolator interpo */ @Override public void collapse() { - if (isAnimating) return; + if (isAnimating || !isExpanded()) return; createExpandAnimator(getCurrentPosition(), closePosition, duration, interpolator).start(); } @@ -250,7 +250,7 @@ public void collapse() { */ @Override public void collapse(final long duration, final @Nullable TimeInterpolator interpolator) { - if (isAnimating) return; + if (isAnimating || !isExpanded()) return; if (duration <= 0) { move(closePosition, duration, interpolator); diff --git a/library/src/main/java/com/github/aakira/expandablelayout/ExpandableRelativeLayout.java b/library/src/main/java/com/github/aakira/expandablelayout/ExpandableRelativeLayout.java index 0678905..28bcd07 100644 --- a/library/src/main/java/com/github/aakira/expandablelayout/ExpandableRelativeLayout.java +++ b/library/src/main/java/com/github/aakira/expandablelayout/ExpandableRelativeLayout.java @@ -225,7 +225,7 @@ public void toggle(final long duration, final @Nullable TimeInterpolator interpo */ @Override public void expand() { - if (isAnimating) return; + if (isAnimating || isExpanded()) return; createExpandAnimator(getCurrentPosition(), layoutSize, duration, interpolator).start(); } @@ -235,7 +235,7 @@ public void expand() { */ @Override public void expand(final long duration, final @Nullable TimeInterpolator interpolator) { - if (isAnimating) return; + if (isAnimating || isExpanded()) return; if (duration <= 0) { move(layoutSize, duration, interpolator); @@ -249,7 +249,7 @@ public void expand(final long duration, final @Nullable TimeInterpolator interpo */ @Override public void collapse() { - if (isAnimating) return; + if (isAnimating || !isExpanded()) return; createExpandAnimator(getCurrentPosition(), closePosition, duration, interpolator).start(); } @@ -259,7 +259,7 @@ public void collapse() { */ @Override public void collapse(final long duration, final @Nullable TimeInterpolator interpolator) { - if (isAnimating) return; + if (isAnimating || !isExpanded()) return; if (duration <= 0) { move(closePosition, duration, interpolator); diff --git a/library/src/main/java/com/github/aakira/expandablelayout/ExpandableWeightLayout.java b/library/src/main/java/com/github/aakira/expandablelayout/ExpandableWeightLayout.java index 49526c9..5c03696 100644 --- a/library/src/main/java/com/github/aakira/expandablelayout/ExpandableWeightLayout.java +++ b/library/src/main/java/com/github/aakira/expandablelayout/ExpandableWeightLayout.java @@ -147,7 +147,7 @@ public void toggle(final long duration, @Nullable final TimeInterpolator interpo */ @Override public void expand() { - if (isAnimating) return; + if (isAnimating || isExpanded()) return; createExpandAnimator(0, layoutWeight, duration, interpolator).start(); } @@ -157,7 +157,7 @@ public void expand() { */ @Override public void expand(final long duration, @Nullable final TimeInterpolator interpolator) { - if (isAnimating) return; + if (isAnimating || isExpanded()) return; if (duration <= 0) { isExpanded = true; @@ -174,7 +174,7 @@ public void expand(final long duration, @Nullable final TimeInterpolator interpo */ @Override public void collapse() { - if (isAnimating) return; + if (isAnimating || !isExpanded()) return; createExpandAnimator(getCurrentWeight(), 0, duration, interpolator).start(); } @@ -184,7 +184,7 @@ public void collapse() { */ @Override public void collapse(final long duration, @Nullable final TimeInterpolator interpolator) { - if (isAnimating) return; + if (isAnimating || !isExpanded()) return; if (duration <= 0) { isExpanded = false;