Skip to content

Commit

Permalink
Merge pull request #197 from stepstone-tech/develop
Browse files Browse the repository at this point in the history
Merge from develop
  • Loading branch information
zawadz88 authored Aug 28, 2017
2 parents 3face22 + db80e12 commit 8868474
Show file tree
Hide file tree
Showing 50 changed files with 1,791 additions and 268 deletions.
51 changes: 0 additions & 51 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [4.1.0]
### Added
- An option to show a subtitle in each tab
- An option to display an error message below step title in tabbed stepper

## [4.0.0]
### Added
- `setEndButtonVisible` and `setBackButtonVisible` methods in `StepViewModel.Builder` for toggling button visibility (issue #104)
Expand All @@ -18,4 +23,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- **Breaking change:** Changed `setNextButtonLabel` methods in `StepViewModel.Builder` to `setEndButtonLabel` so that it works for both Next and Complete buttons (issue #107)
- **Breaking change:** Split `content` stepper feedback type into `content_progress` and `content_fade`.

[4.1.0]: https://github.com/stepstone-tech/android-material-stepper/compare/v4.0.0...v4.1.0
[4.0.0]: https://github.com/stepstone-tech/android-material-stepper/compare/v3.3.0...v4.0.0
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src ="./art/material-stepper-logo.png" width="256" height="256"/>
</p>

# Android Material Stepper [![Build Status](https://travis-ci.org/stepstone-tech/android-material-stepper.svg?branch=master)](https://travis-ci.org/stepstone-tech/android-material-stepper) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Android%20Material%20Stepper-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5138) [![Android Weekly](https://img.shields.io/badge/Android%20Weekly-%23243-brightgreen.svg)](http://androidweekly.net/issues/issue-243)
# Android Material Stepper [![CircleCI](https://circleci.com/gh/stepstone-tech/android-material-stepper.svg?style=svg)](https://circleci.com/gh/stepstone-tech/android-material-stepper) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Android%20Material%20Stepper-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5138) [![Android Weekly](https://img.shields.io/badge/Android%20Weekly-%23243-brightgreen.svg)](http://androidweekly.net/issues/issue-243)

This library allows to use Material steppers inside Android applications.

Expand All @@ -20,6 +20,7 @@ Moreover, you can find there other examples, e.g. how to persist state on rotati
- [Advanced usage](#advanced-usage)
- [Making extra operations before going to the next step](#making-extra-operations-before-going-to-the-next-step)
- [Changing button labels & compound drawables per step](#changing-button-labels--compound-drawables-per-step)
- [Subtitles in tabs](#subtitles-in-tabs)
- [Custom styling](#custom-styling)
- [Using same stepper styling across the application](#using-same-stepper-styling-across-the-application)
- [Showing a Back button on first step](#showing-a-back-button-on-first-step)
Expand Down Expand Up @@ -63,9 +64,12 @@ Moreover, you can find there other examples, e.g. how to persist state on rotati

### Download (from JCenter)
```groovy
compile 'com.stepstone.stepper:material-stepper:4.0.0'
compile 'com.stepstone.stepper:material-stepper:4.1.0'
```

*Note:* This adds a transitive dependency to AppCompat `25.4.0`
which is the minimum Android Support library version compatible with the Stepper library.

### Create layout in XML

```xml
Expand Down Expand Up @@ -300,6 +304,11 @@ It is also possible to hide Back/Next/Complete buttons on each step if needed.
To do so you need to call `setBackButtonVisible(false)` and/or `setEndButtonVisible(false)` on
`StepViewModel.Builder` in your adapter.

### Subtitles in tabs
You can set a subtitle for each step in stepper with tabs, e.g. to mark a step as optional.
To do so you need to set the subtitle by calling `StepViewModel.Builder#setSubtitle(int)` or `StepViewModel.Builder#setSubtitle(CharSequence)`
in your adapter's `getViewModel` method.

### Custom styling
Basic styling can be done by choosing the active and inactive step colors.
There are some additional properties which can be changed directly from StepperLayout's attributes e.g. the background of bottom navigation buttons (see [StepperLayout attributes](#stepperlayout-attributes))
Expand Down Expand Up @@ -352,6 +361,7 @@ To show an error in the tabbed stepper if step verification fails you need to se
<p><img src ="./gifs/error-on-tabs.gif" width="640" /></p>

If you want to keep the error displayed when going back to the previous step you need to also set `ms_showErrorStateOnBackEnabled` to `true`.
If you want display an error message below the step title you need to set `ms_showErrorMessageEnabled` to `true`. The message set in `VerificationError` will be then displayed.

### Stepper feedback
It is possible to show stepper feedback for ongoing operations (see [Stepper feedback](https://material.io/guidelines/components/steppers.html#steppers-types-of-steppers)).
Expand Down Expand Up @@ -510,6 +520,7 @@ A list of `ms_stepperLayoutTheme` attributes responsible for styling of StepperL
| *ms_stepTabDoneIndicatorStyle* | Used by ms_stepDoneIndicator in layout/ms_step_tab |
| *ms_stepTabIconBackgroundStyle* | Used by ms_stepIconBackground in layout/ms_step_tab |
| *ms_stepTabTitleStyle* | Used by ms_stepTitle in layout/ms_step_tab |
| *ms_stepTabSubtitleStyle* | Used by ms_stepSubtitle in layout/ms_step_tab |
| *ms_stepTabDividerStyle* | Used by ms_stepDivider in layout/ms_step_tab |

## Changelog
Expand Down
10 changes: 6 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
buildscript {
ext.gradleAndroidVersion = '2.3.3'
ext.gradleAndroidVersion = '3.0.0-beta2'
ext.kotlinVersion = '1.1.3-2'
ext.bintrayVersion = '1.4'
ext.mavenGradlePluginVersion = '1.4.1'

repositories {
jcenter()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:$gradleAndroidVersion"
Expand All @@ -19,9 +20,7 @@ allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url "https://maven.google.com"
}
google()
}
}

Expand All @@ -40,6 +39,9 @@ configure(allprojects) {
robolectricVersion = '3.3.1'
assertjVersion = '1.1.1'

supportTestVersion = '1.0.0'
espressoVersion = '3.0.0'

/* Sample only */
butterknifeVersion = '8.5.1'
calligraphyVersion = '2.2.0'
Expand Down
59 changes: 59 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
machine:
environment:
PATH: "~/$CIRCLE_PROJECT_REPONAME/gradle-4.1/bin:$PATH"
TERM: "dumb"
ADB_INSTALL_TIMEOUT: "10"
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
_JAVA_OPTIONS: "-Xms512m -Xmx1024m -XX:ParallelGCThreads=2 -XX:ConcGCThreads=2 -XX:ParallelGCThreads=2 -Djava.util.concurrent.ForkJoinPool.common.parallelism=2"

dependencies:
pre:
- wget "https://services.gradle.org/distributions/gradle-4.1-bin.zip"; unzip gradle-4.1-bin.zip
- if [ ! -e /usr/local/android-sdk-linux/build-tools/25.0.2 ]; then echo y | android update sdk --all --no-ui --filter "build-tools-25.0.2"; fi;
- if [ ! -e /usr/local/android-sdk-linux/platforms/android-25 ]; then echo y | android update sdk --all --no-ui --filter "android-25"; fi;
- if ! $(grep -q "Revision=47.0.0" /usr/local/android-sdk-linux/extras/android/m2repository/source.properties); then echo y | android update sdk --all --no-ui --filter "extra-android-m2repository"; fi;
- echo y | android update sdk --no-ui --all --filter tool,extra-google-google_play_services
- printf 'bintray.user=dummy_user\nbintray.apikey=dummy_api_key\nsdk.dir=/usr/local/android-sdk-linux' > local.properties

cache_directories:
- /usr/local/android-sdk-linux/build-tools/25.0.2
- /usr/local/android-sdk-linux/platforms/android-25
- /usr/local/android-sdk-linux/extras/android/m2repository

test:
override:
# run static analysis and unit tests with coverage
- ./gradlew checkWithCoverage --stacktrace --no-daemon

# Create SD card (needed for screenshots)
- mksdcard -l sdcard 200M sdcard.img

# start the emulator
- emulator -avd circleci-android22 -sdcard sdcard.img -no-audio -no-window:
background: true
parallel: true
# wait for it to have booted
- circle-android wait-for-boot
- sleep 30
# unlock the emulator screen
- adb shell input keyevent 82

# run instrumentation tests with coverage & lint for the sample app
- ./gradlew :sample:lintDebug mergedJacocoTestReport --stacktrace --no-daemon -Ptest.integration.options.adbInstallOptions=-r
- ./gradlew install --no-daemon

# upload code coverage reports to Codecov.io
- bash <(curl -s https://codecov.io/bash)

post:
# copy the test results to the test results directory
- mkdir -p $CIRCLE_TEST_REPORTS/unit
- mkdir -p $CIRCLE_TEST_REPORTS/instrumentation
- find . -type f -regex ".*/build/test-results/testDebugUnitTest/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/unit/ \;
- find . -type f -regex ".*/build/outputs/androidTest-results/connected/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/instrumentation/ \;

# copy the reports to artifacts directory
- mkdir -p $CIRCLE_ARTIFACTS/reports-library
- mkdir -p $CIRCLE_ARTIFACTS/reports-sample
- cp -r material-stepper/build/reports $CIRCLE_ARTIFACTS/reports-library
- cp -r sample/build/reports $CIRCLE_ARTIFACTS/reports-sample
11 changes: 11 additions & 0 deletions config/project_properties.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def final String PROPERTY_ADB_INSTALL_OPTIONS = 'test.integration.options.adbInstallOptions'

/**
* Returns adbInstallOptions to use. This is needed because different adb install options are supported depending on OS version.
* @return
*/
ext.getAdbInstallOptions = {
def adbInstallOptions = (project.hasProperty(PROPERTY_ADB_INSTALL_OPTIONS) ? project.getProperties().get(PROPERTY_ADB_INSTALL_OPTIONS).split(',') : ['-g', '-r']) as String[]
println("Running with adbInstallOptions: $adbInstallOptions")
return adbInstallOptions
}
14 changes: 7 additions & 7 deletions config/quality/quality.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies {
checkstyle 'com.puppycrawl.tools:checkstyle:6.11.1'
}

def qualityConfigDir = "$project.rootDir/config/quality";
def qualityConfigDir = "$project.rootDir/config/quality"
def reportsDir = "$project.buildDir/reports"

task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code style checks') {
Expand All @@ -29,7 +29,7 @@ task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code
reports {
xml.enabled = true
xml {
destination "$reportsDir/checkstyle/checkstyle.xml"
destination file("$reportsDir/checkstyle/checkstyle.xml")
}
}

Expand All @@ -52,10 +52,10 @@ task findbugs(type: FindBugs,
exclude '**/gen/**'

reports {
xml.enabled = true
html.enabled = false
xml.enabled = false
html.enabled = true
xml {
destination "$reportsDir/findbugs/findbugs.xml"
destination file("$reportsDir/findbugs/findbugs.xml")
}
}

Expand All @@ -76,10 +76,10 @@ task pmd(type: Pmd, group: 'Verification', description: 'Inspect sourcecode for
xml.enabled = true
html.enabled = true
xml {
destination "$reportsDir/pmd/pmd.xml"
destination file("$reportsDir/pmd/pmd.xml")
}
html {
destination "$reportsDir/pmd/pmd.html"
destination file("$reportsDir/pmd/pmd.html")
}
}
}
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@

POM_GROUP_ID=com.stepstone.stepper
POM_ARTIFACT_ID=material-stepper
POM_VERSION=4.0.0
POM_VERSION=4.1.0

#Needed so that Robolectric is working: https://github.com/robolectric/robolectric/issues/3169
android.enableAapt2=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
30 changes: 19 additions & 11 deletions material-stepper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ android {
minSdkVersion project.androidMinSdkVersion
targetSdkVersion project.androidTargetSdkVersion
vectorDrawables.useSupportLibrary = true

}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled true
}
}

testOptions {
Expand All @@ -52,26 +55,29 @@ android {
includeNoLocationClasses = true
}
}
//fixes https://github.com/robolectric/robolectric/issues/3169#issuecomment-312046322
unitTests.includeAndroidResources = true
}

lintOptions {
warningsAsErrors true
disable 'RequiredSize', 'ClickableViewAccessibility'
}
}

dependencies {
compile "com.android.support:appcompat-v7:$androidSupportLibraryVersion"
api "com.android.support:appcompat-v7:$androidSupportLibraryVersion"

testCompile "junit:junit:$junitVersion"
testCompile "org.mockito:mockito-core:$mockitoVersion"
testCompile "com.squareup.assertj:assertj-android:$assertjVersion"
testCompile("org.robolectric:robolectric:$robolectricVersion") {
testImplementation "junit:junit:$junitVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "com.squareup.assertj:assertj-android:$assertjVersion"
testImplementation("org.robolectric:robolectric:$robolectricVersion") {
exclude group: 'commons-logging', module: 'commons-logging'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
testCompile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion"
testCompile "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
testCompile "com.nhaarman:mockito-kotlin:$mockitoKotlinVersion"
testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion"
testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
testImplementation "com.nhaarman:mockito-kotlin:$mockitoKotlinVersion"
}

gradle.taskGraph.beforeTask { Task task ->
Expand All @@ -85,11 +91,13 @@ gradle.taskGraph.beforeTask { Task task ->
}

// Log out test results to console
tasks.matching { it instanceof Test }.all {
tasks.matching { it instanceof Test}.all {
testLogging.events = ["failed", "passed", "skipped"]
}

check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'jacocoTestReport'
task ('checkWithCoverage') {
dependsOn 'checkstyle', 'findbugs', 'pmd', 'jacocoTestReport', 'lintDebug'
}

apply from: '../installv1.gradle'
apply from: '../bintrayv1.gradle'
Expand Down
13 changes: 8 additions & 5 deletions material-stepper/code_coverage.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ task('jacocoTestReport', type: JacocoReport, dependsOn: 'testDebugUnitTest') {

classDirectories = fileTree(
dir: './build/intermediates/classes/debug',
excludes: ['**/R*.class',
'**/*$InjectAdapter.class',
'**/*$ModuleAdapter.class',
'**/*$ViewInjector*.class'
]
excludes: ['**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*IScript*.*',
'android/**/*.*',
'**/**_ViewBinding.*',
'**/**_ViewBinding$*']
)

def coverageSourceDirs = [
Expand Down
Loading

0 comments on commit 8868474

Please sign in to comment.