diff --git a/README.md b/README.md index 2bca764..b650946 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) @@ -229,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/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/circle.yml b/circle.yml new file mode 100644 index 0000000..47f31cd --- /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-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/androidTests/connected/* $CIRCLE_ARTIFACTS diff --git a/gradle.properties b/gradle.properties index 65eb985..bb64e9c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,8 +2,10 @@ 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 SUPPORT_APP_COMPAT_VERSION=23.0.1 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 8fb7e7f..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 @@ -9,36 +10,41 @@ android { targetSdkVersion TARGET_SDK_VERSION as int versionCode VERSION_CODE as int versionName VERSION_NAME - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } + + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } } 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 -> - 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 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 =