Skip to content

Commit

Permalink
Merge pull request #70 from AAkira/v1.5.1
Browse files Browse the repository at this point in the history
V1.5.1
  • Loading branch information
AAkira committed Apr 12, 2016
2 parents df54a1b + 21d9659 commit c43e897
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ buildscript {
}
dependencies {
compile 'com.github.aakira:expandable-layout:1.5.0@aar'
compile 'com.github.aakira:expandable-layout:1.5.1@aar'
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'com.novoda:bintray-release:0.3.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
}
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test:
- circle-android wait-for-boot
override:
# unlock the emulator screen
- sleep 30
- sleep 5
- adb shell input keyevent 82
- ./gradlew connectedAndroidTest -PdisablePreDex
post:
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ COMPILE_SDK_VERSION=23
BUILD_TOOLS_VERSION=22.0.1
MIN_SDK_VERSION=11
TARGET_SDK_VERSION=23
VERSION_CODE=9
VERSION_NAME=1.5.0
VERSION_CODE=10
VERSION_NAME=1.5.1
SUPPORT_TEST_VERSION=0.4.1
HAMCREST_VERSION=1.3
ESPRESSO_VERSION=2.2.1
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Sep 08 00:23:42 JST 2015
#Fri Apr 08 10:39:51 JST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ class ExpandableLinearLayoutActivityTest : ActivityInstrumentationTestCase2<Expa

// default close
onView(withId(R.id.expandableLayout)).check(matches(equalHeight(0)))
assertThat(expandableLayout.isExpanded, _is(false))

// open toggle
instrumentation.runOnMainSync { expandableLayout.toggle() }
var idlingResource = ElapsedIdLingResource(DURATION)
Espresso.registerIdlingResources(idlingResource)
onView(withId(R.id.expandableLayout)).check(matches(orMoreHeight(1)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// move to first layout
instrumentation.runOnMainSync { expandableLayout.moveChild(0) }
Expand All @@ -76,6 +78,7 @@ class ExpandableLinearLayoutActivityTest : ActivityInstrumentationTestCase2<Expa
margin = marginSmall
)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// set close height
instrumentation.runOnMainSync { expandableLayout.closePosition = expandableLayout.currentPosition; }
Expand All @@ -92,6 +95,7 @@ class ExpandableLinearLayoutActivityTest : ActivityInstrumentationTestCase2<Expa
margin = marginSmall
)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// check toggle (close to first)
instrumentation.runOnMainSync { expandableLayout.toggle() }
Expand All @@ -103,6 +107,7 @@ class ExpandableLinearLayoutActivityTest : ActivityInstrumentationTestCase2<Expa
margin = marginSmall
)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(false))

// check toggle open (full)
instrumentation.runOnMainSync { expandableLayout.toggle() }
Expand All @@ -116,5 +121,6 @@ class ExpandableLinearLayoutActivityTest : ActivityInstrumentationTestCase2<Expa
margin = marginSmall
)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class ExpandableRelativeLayoutActivityTest2 : ActivityInstrumentationTestCase2<E

// default close
onView(withId(R.id.expandableLayout)).check(matches(equalHeight(0)))
assertThat(expandableLayout.isExpanded, _is(false))

// width
onView(withId(R.id.child1)).check(matches(
equalWidth(resources.getDimensionPixelSize(R.dimen.relative_layout_2_child_1_width))))
Expand All @@ -76,6 +78,7 @@ class ExpandableRelativeLayoutActivityTest2 : ActivityInstrumentationTestCase2<E
margin = expandableLayoutPadding
)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// move to first layout
instrumentation.runOnMainSync { expandableLayout.moveChild(0) }
Expand All @@ -86,6 +89,7 @@ class ExpandableRelativeLayoutActivityTest2 : ActivityInstrumentationTestCase2<E
margin = expandableLayoutPadding
)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// move to second layout
instrumentation.runOnMainSync { expandableLayout.moveChild(1) }
Expand All @@ -96,5 +100,6 @@ class ExpandableRelativeLayoutActivityTest2 : ActivityInstrumentationTestCase2<E
margin = expandableLayoutPadding
)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class ExpandableRelativeLayoutActivityTest3 : ActivityInstrumentationTestCase2<E

// default close
onView(withId(R.id.expandableLayout)).check(matches(equalHeight(0)))
assertThat(expandableLayout.isExpanded, _is(false))

// open toggle
instrumentation.runOnMainSync { expandableLayout.toggle() }
Expand All @@ -70,6 +71,7 @@ class ExpandableRelativeLayoutActivityTest3 : ActivityInstrumentationTestCase2<E
child3
)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// move to first layout
instrumentation.runOnMainSync { expandableLayout.moveChild(0) }
Expand All @@ -79,6 +81,7 @@ class ExpandableRelativeLayoutActivityTest3 : ActivityInstrumentationTestCase2<E
child0
)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// move to second layout
instrumentation.runOnMainSync { expandableLayout.moveChild(1) }
Expand All @@ -89,6 +92,7 @@ class ExpandableRelativeLayoutActivityTest3 : ActivityInstrumentationTestCase2<E
child1
)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// move to third layout
instrumentation.runOnMainSync { expandableLayout.moveChild(2) }
Expand All @@ -99,6 +103,7 @@ class ExpandableRelativeLayoutActivityTest3 : ActivityInstrumentationTestCase2<E
child2
)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// move to forth layout
instrumentation.runOnMainSync { expandableLayout.moveChild(3) }
Expand All @@ -110,6 +115,7 @@ class ExpandableRelativeLayoutActivityTest3 : ActivityInstrumentationTestCase2<E
child3
)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// quick move to first layout using moveChild method
instrumentation.runOnMainSync { expandableLayout.moveChild(0, 0, null) }
Expand All @@ -119,20 +125,23 @@ class ExpandableRelativeLayoutActivityTest3 : ActivityInstrumentationTestCase2<E
child0
)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// quick move to 200 using move method
instrumentation.runOnMainSync { expandableLayout.move(200, 0, null) }
idlingResource = ElapsedIdLingResource(0)
Espresso.registerIdlingResources(idlingResource)
onView(withId(R.id.expandableLayout)).check(matches(equalHeight(200)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// quick collapse
instrumentation.runOnMainSync { expandableLayout.collapse(0, null) }
idlingResource = ElapsedIdLingResource(0)
Espresso.registerIdlingResources(idlingResource)
onView(withId(R.id.expandableLayout)).check(matches(equalHeight(0)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(false))

// quick expand
instrumentation.runOnMainSync { expandableLayout.expand(0, null) }
Expand All @@ -144,5 +153,6 @@ class ExpandableRelativeLayoutActivityTest3 : ActivityInstrumentationTestCase2<E
child3
)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import android.support.test.espresso.assertion.ViewAssertions.matches
import android.support.test.espresso.matcher.ViewMatchers.withId
import android.support.test.runner.AndroidJUnit4
import android.test.ActivityInstrumentationTestCase2
import com.github.aakira.expandablelayout.ExpandableRelativeLayout
import com.github.aakira.expandablelayout.ExpandableWeightLayout
import com.github.aakira.expandablelayout.uitest.utils.ElapsedIdLingResource
import com.github.aakira.expandablelayout.uitest.utils.equalHeight
Expand Down Expand Up @@ -55,40 +54,46 @@ class ExpandableWeightLayoutActivityTest : ActivityInstrumentationTestCase2<Expa

// default close
onView(withId(R.id.expandableLayout)).check(matches(equalHeight(0)))
assertThat(expandableLayout.isExpanded, _is(false))

// open toggle
instrumentation.runOnMainSync { expandableLayout.toggle() }
var idlingResource = ElapsedIdLingResource(DURATION)
Espresso.registerIdlingResources(idlingResource)
onView(withId(R.id.expandableLayout)).check(matches(equalWeight(3f)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// change weight
instrumentation.runOnMainSync { expandableLayout.move(6f) }
idlingResource = ElapsedIdLingResource(DURATION)
Espresso.registerIdlingResources(idlingResource)
onView(withId(R.id.expandableLayout)).check(matches(equalWeight(6f)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// quick change a weight using move method
instrumentation.runOnMainSync { expandableLayout.move(2f, 0, null) }
idlingResource = ElapsedIdLingResource(0)
Espresso.registerIdlingResources(idlingResource)
onView(withId(R.id.expandableLayout)).check(matches(equalWeight(2f)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))

// quick collapse
instrumentation.runOnMainSync { expandableLayout.collapse(0, null) }
idlingResource = ElapsedIdLingResource(0)
Espresso.registerIdlingResources(idlingResource)
onView(withId(R.id.expandableLayout)).check(matches(equalWeight(0f)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(false))

// set expanse (default expanse weight is 3)
instrumentation.runOnMainSync { expandableLayout.isExpanded = true }
idlingResource = ElapsedIdLingResource(1000)
Espresso.registerIdlingResources(idlingResource)
onView(withId(R.id.expandableLayout)).check(matches(equalWeight(3f)))
Espresso.unregisterIdlingResources(idlingResource)
assertThat(expandableLayout.isExpanded, _is(true))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ private void init(final Context context, final AttributeSet attrs, final int def
Integer.MIN_VALUE);
final int interpolatorType = a.getInteger(R.styleable.expandableLayout_ael_interpolator,
Utils.LINEAR_INTERPOLATOR);
interpolator = Utils.createInterpolator(interpolatorType);
a.recycle();
interpolator = Utils.createInterpolator(interpolatorType);
isExpanded = defaultExpanded;
}

@Override
Expand Down Expand Up @@ -484,17 +485,16 @@ public void onAnimationStart(Animator animator) {
@Override
public void onAnimationEnd(Animator animator) {
isAnimating = false;
final int currentSize = getCurrentPosition();
isExpanded = currentSize > closePosition;
isExpanded = to > closePosition;

if (listener == null) return;

listener.onAnimationEnd();
if (currentSize == layoutSize) {
if (to == layoutSize) {
listener.onOpened();
return;
}
if (currentSize == closePosition) {
if (to == closePosition) {
listener.onClosed();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ private void init(final Context context, final AttributeSet attrs, final int def
Integer.MIN_VALUE);
final int interpolatorType = a.getInteger(R.styleable.expandableLayout_ael_interpolator,
Utils.LINEAR_INTERPOLATOR);
interpolator = Utils.createInterpolator(interpolatorType);
a.recycle();
interpolator = Utils.createInterpolator(interpolatorType);
isExpanded = defaultExpanded;
}

@Override
Expand Down Expand Up @@ -492,17 +493,16 @@ public void onAnimationStart(Animator animator) {
@Override
public void onAnimationEnd(Animator animator) {
isAnimating = false;
final int currentSize = getCurrentPosition();
isExpanded = currentSize > closePosition;
isExpanded = to > closePosition;

if (listener == null) return;

listener.onAnimationEnd();
if (currentSize == layoutSize) {
if (to == layoutSize) {
listener.onOpened();
return;
}
if (currentSize == closePosition) {
if (to == closePosition) {
listener.onClosed();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ private void init(final Context context, final AttributeSet attrs, final int def
defaultExpanded = a.getBoolean(R.styleable.expandableLayout_ael_expanded, DEFAULT_EXPANDED);
final int interpolatorType = a.getInteger(R.styleable.expandableLayout_ael_interpolator,
Utils.LINEAR_INTERPOLATOR);
interpolator = Utils.createInterpolator(interpolatorType);
a.recycle();
interpolator = Utils.createInterpolator(interpolatorType);
isExpanded = defaultExpanded;
}

@Override
Expand Down Expand Up @@ -333,17 +334,16 @@ public void onAnimationStart(Animator animation) {
@Override
public void onAnimationEnd(Animator animation) {
isAnimating = false;
final float currentWeight = getCurrentWeight();
isExpanded = currentWeight > 0;
isExpanded = to > 0;

if (listener == null) return;

listener.onAnimationEnd();
if (currentWeight == layoutWeight) {
if (to == layoutWeight) {
listener.onOpened();
return;
}
if (currentWeight == 0) {
if (to == 0) {
listener.onClosed();
}
}
Expand Down

0 comments on commit c43e897

Please sign in to comment.