From e31cd4181d9a5a980864784861ffad24a7f407bc Mon Sep 17 00:00:00 2001 From: "A.Akira" Date: Tue, 9 Feb 2016 23:28:02 +0900 Subject: [PATCH 1/8] Import test libraries. --- gradle.properties | 2 ++ library/build.gradle | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/gradle.properties b/gradle.properties index 65eb985..7248783 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,6 +4,8 @@ MIN_SDK_VERSION=11 TARGET_SDK_VERSION=23 VERSION_CODE=6 VERSION_NAME=1.4.1 +SUPPORT_TEST_VERSION=0.4.1 +HAMCREST_VERSION=1.3 SUPPORT_APP_COMPAT_VERSION=23.0.1 diff --git a/library/build.gradle b/library/build.gradle index 8fb7e7f..c491152 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -9,6 +9,8 @@ android { targetSdkVersion TARGET_SDK_VERSION as int versionCode VERSION_CODE as int versionName VERSION_NAME + + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { @@ -20,6 +22,10 @@ android { dependencies { compile "com.android.support:appcompat-v7:$SUPPORT_APP_COMPAT_VERSION" + androidTestCompile "com.android.support:support-annotations:$SUPPORT_APP_COMPAT_VERSION" + androidTestCompile "com.android.support.test:runner:$SUPPORT_TEST_VERSION" + androidTestCompile "com.android.support.test:rules:$SUPPORT_TEST_VERSION" + androidTestCompile "org.hamcrest:hamcrest-library:$HAMCREST_VERSION" } android.libraryVariants.all { variant -> From bd3fbf49e214d4f139321bc75d650293a1fccaa5 Mon Sep 17 00:00:00 2001 From: "A.Akira" Date: Tue, 9 Feb 2016 23:28:57 +0900 Subject: [PATCH 2/8] Add savedState test. --- .../ExpandableSavedStateTest.java | 33 +++++++++++++++++++ .../ExpandableSavedState.java | 1 + 2 files changed, 34 insertions(+) create mode 100644 library/src/androidTest/java/com/github/aakira/expandablelayout/ExpandableSavedStateTest.java diff --git a/library/src/androidTest/java/com/github/aakira/expandablelayout/ExpandableSavedStateTest.java b/library/src/androidTest/java/com/github/aakira/expandablelayout/ExpandableSavedStateTest.java new file mode 100644 index 0000000..04d3a8e --- /dev/null +++ b/library/src/androidTest/java/com/github/aakira/expandablelayout/ExpandableSavedStateTest.java @@ -0,0 +1,33 @@ +package com.github.aakira.expandablelayout; + +import android.os.Parcel; +import android.os.Parcelable; +import android.support.test.runner.AndroidJUnit4; +import android.view.AbsSavedState; +import android.view.View; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +@RunWith(AndroidJUnit4.class) +public class ExpandableSavedStateTest { + + @Test + public void testWriteToParcel() { + final Parcelable parcelable = new View.BaseSavedState(AbsSavedState.EMPTY_STATE); + final ExpandableSavedState ss = new ExpandableSavedState(parcelable); + ss.setSize(1000); + ss.setWeight(0.5f); + + final Parcel parcel = Parcel.obtain(); + ss.writeToParcel(parcel, 0); + parcel.setDataPosition(0); + + final ExpandableSavedState target = ExpandableSavedState.CREATOR.createFromParcel(parcel); + assertThat(target.getSize(), is(1000)); + assertThat(target.getWeight(), is(0.5f)); + } +} \ No newline at end of file diff --git a/library/src/main/java/com/github/aakira/expandablelayout/ExpandableSavedState.java b/library/src/main/java/com/github/aakira/expandablelayout/ExpandableSavedState.java index 5765357..ee66f6d 100644 --- a/library/src/main/java/com/github/aakira/expandablelayout/ExpandableSavedState.java +++ b/library/src/main/java/com/github/aakira/expandablelayout/ExpandableSavedState.java @@ -38,6 +38,7 @@ public void setWeight(float weight) { public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeInt(this.size); + out.writeFloat(this.weight); } public static final Creator CREATOR = From 84343b2dae9051cfb6fcd0a395d90d6d786ecd02 Mon Sep 17 00:00:00 2001 From: "A.Akira" Date: Tue, 9 Feb 2016 23:30:59 +0900 Subject: [PATCH 3/8] Add circle yml. --- circle.yml | 23 +++++++++++++++++++++++ library/build.gradle | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 circle.yml diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..c7eda1c --- /dev/null +++ b/circle.yml @@ -0,0 +1,23 @@ +machine: + timezone: Asia/Tokyo + java: + version: openjdk7 + environment: + JAVA_OPTS: "-Xms256m -Xmx1024m -XX:MaxPermSize=512m" + ADB_INSTALL_TIMEOUT: 8 + +dependencies: + cache_directories: + - ~/.android + - /usr/local/android-sdk-linux + +test: + pre: + - emulator -avd circleci-android22 -no-skin -no-audio -no-window: + background: true + parallel: true + - circle-android wait-for-boot + override: + - ./gradlew connectedAndroidTest -PdisablePreDex + post: + - cp -R ./mobile/build/reports/androidTests/connected/flavors/PRODUCT/* $CIRCLE_ARTIFACTS \ No newline at end of file diff --git a/library/build.gradle b/library/build.gradle index c491152..a48ce0d 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -46,5 +46,5 @@ android.libraryVariants.all { variant -> } } -apply from: 'android-artifacts.gradle' -apply from: 'bintray-publish.gradle' \ No newline at end of file +apply from: './android-artifacts.gradle' +apply from: './bintray-publish.gradle' \ No newline at end of file From 87aa44579b5e9127c6ab497dee47b15376fde58c Mon Sep 17 00:00:00 2001 From: "A.Akira" Date: Wed, 10 Feb 2016 00:48:04 +0900 Subject: [PATCH 4/8] Use bintray upload library. --- build.gradle | 3 +- library/android-artifacts.gradle | 25 ------------- library/bintray-publish.gradle | 61 -------------------------------- library/build.gradle | 46 ++++++++++++------------ 4 files changed, 24 insertions(+), 111 deletions(-) delete mode 100644 library/android-artifacts.gradle delete mode 100644 library/bintray-publish.gradle diff --git a/build.gradle b/build.gradle index 324f315..daa3645 100644 --- a/build.gradle +++ b/build.gradle @@ -6,8 +6,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:1.3.1' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' + classpath 'com.novoda:bintray-release:0.3.4' } } diff --git a/library/android-artifacts.gradle b/library/android-artifacts.gradle deleted file mode 100644 index bc64f23..0000000 --- a/library/android-artifacts.gradle +++ /dev/null @@ -1,25 +0,0 @@ -task androidJavadocs(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" - classpath += files(ext.androidJar) -} - -task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { - classifier = 'javadoc' - from androidJavadocs.destinationDir -} - -task androidSourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.sourceFiles -} - -task androidJar(type: Jar) { - from 'build/intermediates/classes/release' -} - -artifacts { - archives androidSourcesJar - archives androidJavadocsJar - archives androidJar -} \ No newline at end of file diff --git a/library/bintray-publish.gradle b/library/bintray-publish.gradle deleted file mode 100644 index a2361d9..0000000 --- a/library/bintray-publish.gradle +++ /dev/null @@ -1,61 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'com.jfrog.bintray' -apply plugin: 'com.github.dcendents.android-maven' - -Properties properties = new Properties() -properties.load(project.rootProject.file('local.properties').newDataInputStream()) - -publishing { - publications { - mavenJava(MavenPublication) { - groupId GROUP - version VERSION_NAME - artifactId ARTIFACT_ID - artifact "build/outputs/aar/library-release.aar" - artifact androidJar - artifact androidJavadocsJar - artifact androidSourcesJar - pom.withXml { - Node root = asNode() - root.appendNode('name', ARTIFACT_ID) - root.appendNode('description', POM_DESCRIPTION) - root.appendNode('url', POM_URL) - - def issues = root.appendNode('issueManagement') - issues.appendNode('system', 'github') - issues.appendNode('url', ISSUE_URL) - - def scm = root.appendNode('scm') - scm.appendNode('url', POM_SCM_URL) - scm.appendNode('connection', POM_SCM_CONNECTION) - scm.appendNode('developerConnection', POM_SCM_DEV_CONNECTION) - - def license = root.appendNode('licenses').appendNode('license') - license.appendNode('name', POM_LICENSE_NAME) - license.appendNode('url', POM_LICENSE_URL) - license.appendNode('distribution', POM_LICENSE_DIST) - } - } - } -} - -bintray { - user = properties.getProperty("bintrayUser") - key = properties.getProperty("bintrayApiKey") - - publications = ['mavenJava'] - - dryRun = false - publish = false - pkg { - repo = 'maven' - name = ARTIFACT_ID - licenses = ['Apache-2.0'] - labels = ['android'] - - version { - name = VERSION_NAME - vcsTag = VERSION_NAME - } - } -} diff --git a/library/build.gradle b/library/build.gradle index a48ce0d..78e62ed 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'com.android.library' +apply plugin: 'com.novoda.bintray-release' android { compileSdkVersion COMPILE_SDK_VERSION as int @@ -12,12 +13,6 @@ android { testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } } dependencies { @@ -28,23 +23,28 @@ dependencies { androidTestCompile "org.hamcrest:hamcrest-library:$HAMCREST_VERSION" } -android.libraryVariants.all { variant -> - if (variant.buildType.isDebuggable()) { - return; // Skip debug builds. - } - task("javadoc${variant.name.capitalize()}", type: Javadoc) { - description "Generates Javadoc for $variant.name." - source = variant.javaCompile.source - ext.androidJar = System.getenv("ANDROID_HOME") + "/platforms/${android.compileSdkVersion}/android.jar" - classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar) - } +def getBintrayUserProperty() { + return hasProperty('bintrayUser') ? bintrayUser : "" +} - task("bundleJavadoc${variant.name.capitalize()}", type: Jar) { - description "Bundles Javadoc into zip for $variant.name." - classifier = "javadoc" - from tasks["javadoc${variant.name.capitalize()}"] - } +def getBintrayApiKeyProperty() { + return hasProperty('bintrayApiKey') ? bintrayApiKey : "" } -apply from: './android-artifacts.gradle' -apply from: './bintray-publish.gradle' \ No newline at end of file +publish { + userOrg = POM_DEVELOPER_ID + repoName = 'maven' + groupId = GROUP + artifactId = ARTIFACT_ID + publishVersion = VERSION_NAME + licences = ['Apache-2.0'] + desc = POM_DESCRIPTION + website = POM_URL + issueTracker = ISSUE_URL + repository = POM_SCM_URL + autoPublish = false + bintrayUser = bintrayUserProperty + bintrayKey = bintrayApiKeyProperty + dryRun = false + publications = ['maven'] +} \ No newline at end of file From 48220f48478c79c1c58e2e81f3a8e72910472eac Mon Sep 17 00:00:00 2001 From: "A.Akira" Date: Wed, 10 Feb 2016 01:01:46 +0900 Subject: [PATCH 5/8] Fix circle yml. --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index c7eda1c..1e8aa6a 100644 --- a/circle.yml +++ b/circle.yml @@ -20,4 +20,4 @@ test: override: - ./gradlew connectedAndroidTest -PdisablePreDex post: - - cp -R ./mobile/build/reports/androidTests/connected/flavors/PRODUCT/* $CIRCLE_ARTIFACTS \ No newline at end of file + - cp -R ./library/build/reports/tests/release/* $CIRCLE_ARTIFACTS \ No newline at end of file From 21882ca2f0dca7219d076cdcbb81cb861ff045d7 Mon Sep 17 00:00:00 2001 From: "A.Akira" Date: Wed, 10 Feb 2016 01:13:03 +0900 Subject: [PATCH 6/8] Add circle ci badge. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2bca764..f969b97 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ An android library that brings the expandable layout with various animation. You can include optional contents and use everywhere. +[![Circle CI](https://circleci.com/gh/AAkira/ExpandableLayout.svg?style=shield&circle-token=cb7464e0215aaecb740936d1d68010ee0ffd4806)](https://circleci.com/gh/AAkira/ExpandableLayout) [![Platform](http://img.shields.io/badge/platform-android-brightgreen.svg?style=flat)](http://developer.android.com/index.html) [![Language](http://img.shields.io/badge/language-java-orange.svg?style=flat)](http://www.oracle.com/technetwork/java/javase/downloads/index.html) [![License](http://img.shields.io/badge/license-apache2.0-lightgrey.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) From 1ffbda4c5a3c3c4d6d5ef35fbacac6a734d33641 Mon Sep 17 00:00:00 2001 From: "A.Akira" Date: Wed, 10 Feb 2016 01:26:49 +0900 Subject: [PATCH 7/8] Modify circle.yml --- circle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index 1e8aa6a..47f31cd 100644 --- a/circle.yml +++ b/circle.yml @@ -13,11 +13,11 @@ dependencies: test: pre: - - emulator -avd circleci-android22 -no-skin -no-audio -no-window: + - emulator -avd circleci-android21 -no-skin -no-audio -no-window: background: true parallel: true - circle-android wait-for-boot override: - ./gradlew connectedAndroidTest -PdisablePreDex post: - - cp -R ./library/build/reports/tests/release/* $CIRCLE_ARTIFACTS \ No newline at end of file + - cp -R ./library/build/reports/androidTests/connected/* $CIRCLE_ARTIFACTS From 86a3c35362343b4e98faf65138ae0a47d405b51d Mon Sep 17 00:00:00 2001 From: "A.Akira" Date: Thu, 11 Feb 2016 01:59:27 +0900 Subject: [PATCH 8/8] Update the version. --- README.md | 2 +- gradle.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f969b97..b650946 100644 --- a/README.md +++ b/README.md @@ -230,7 +230,7 @@ buildscript { } dependencies { - compile 'com.github.aakira:expandable-layout:1.4.1@aar' + compile 'com.github.aakira:expandable-layout:1.4.2@aar' } ``` diff --git a/gradle.properties b/gradle.properties index 7248783..bb64e9c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,8 +2,8 @@ COMPILE_SDK_VERSION=23 BUILD_TOOLS_VERSION=22.0.1 MIN_SDK_VERSION=11 TARGET_SDK_VERSION=23 -VERSION_CODE=6 -VERSION_NAME=1.4.1 +VERSION_CODE=7 +VERSION_NAME=1.4.2 SUPPORT_TEST_VERSION=0.4.1 HAMCREST_VERSION=1.3