Skip to content

Commit 8868474

Browse files
authored
Merge pull request #197 from stepstone-tech/develop
Merge from develop
2 parents 3face22 + db80e12 commit 8868474

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1791
-268
lines changed

.travis.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

CHANGELOG.md

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

7+
## [4.1.0]
8+
### Added
9+
- An option to show a subtitle in each tab
10+
- An option to display an error message below step title in tabbed stepper
11+
712
## [4.0.0]
813
### Added
914
- `setEndButtonVisible` and `setBackButtonVisible` methods in `StepViewModel.Builder` for toggling button visibility (issue #104)
@@ -18,4 +23,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1823
- **Breaking change:** Changed `setNextButtonLabel` methods in `StepViewModel.Builder` to `setEndButtonLabel` so that it works for both Next and Complete buttons (issue #107)
1924
- **Breaking change:** Split `content` stepper feedback type into `content_progress` and `content_fade`.
2025

26+
[4.1.0]: https://github.com/stepstone-tech/android-material-stepper/compare/v4.0.0...v4.1.0
2127
[4.0.0]: https://github.com/stepstone-tech/android-material-stepper/compare/v3.3.0...v4.0.0

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<img src ="./art/material-stepper-logo.png" width="256" height="256"/>
33
</p>
44

5-
# 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)
5+
# 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)
66

77
This library allows to use Material steppers inside Android applications.
88

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

6465
### Download (from JCenter)
6566
```groovy
66-
compile 'com.stepstone.stepper:material-stepper:4.0.0'
67+
compile 'com.stepstone.stepper:material-stepper:4.1.0'
6768
```
6869

70+
*Note:* This adds a transitive dependency to AppCompat `25.4.0`
71+
which is the minimum Android Support library version compatible with the Stepper library.
72+
6973
### Create layout in XML
7074

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

307+
### Subtitles in tabs
308+
You can set a subtitle for each step in stepper with tabs, e.g. to mark a step as optional.
309+
To do so you need to set the subtitle by calling `StepViewModel.Builder#setSubtitle(int)` or `StepViewModel.Builder#setSubtitle(CharSequence)`
310+
in your adapter's `getViewModel` method.
311+
303312
### Custom styling
304313
Basic styling can be done by choosing the active and inactive step colors.
305314
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))
@@ -352,6 +361,7 @@ To show an error in the tabbed stepper if step verification fails you need to se
352361
<p><img src ="./gifs/error-on-tabs.gif" width="640" /></p>
353362

354363
If you want to keep the error displayed when going back to the previous step you need to also set `ms_showErrorStateOnBackEnabled` to `true`.
364+
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.
355365

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

515526
## Changelog

build.gradle

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
buildscript {
2-
ext.gradleAndroidVersion = '2.3.3'
2+
ext.gradleAndroidVersion = '3.0.0-beta2'
33
ext.kotlinVersion = '1.1.3-2'
44
ext.bintrayVersion = '1.4'
55
ext.mavenGradlePluginVersion = '1.4.1'
66

77
repositories {
88
jcenter()
9+
google()
910
}
1011
dependencies {
1112
classpath "com.android.tools.build:gradle:$gradleAndroidVersion"
@@ -19,9 +20,7 @@ allprojects {
1920
repositories {
2021
jcenter()
2122
mavenCentral()
22-
maven {
23-
url "https://maven.google.com"
24-
}
23+
google()
2524
}
2625
}
2726

@@ -40,6 +39,9 @@ configure(allprojects) {
4039
robolectricVersion = '3.3.1'
4140
assertjVersion = '1.1.1'
4241

42+
supportTestVersion = '1.0.0'
43+
espressoVersion = '3.0.0'
44+
4345
/* Sample only */
4446
butterknifeVersion = '8.5.1'
4547
calligraphyVersion = '2.2.0'

circle.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
machine:
2+
environment:
3+
PATH: "~/$CIRCLE_PROJECT_REPONAME/gradle-4.1/bin:$PATH"
4+
TERM: "dumb"
5+
ADB_INSTALL_TIMEOUT: "10"
6+
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
7+
_JAVA_OPTIONS: "-Xms512m -Xmx1024m -XX:ParallelGCThreads=2 -XX:ConcGCThreads=2 -XX:ParallelGCThreads=2 -Djava.util.concurrent.ForkJoinPool.common.parallelism=2"
8+
9+
dependencies:
10+
pre:
11+
- wget "https://services.gradle.org/distributions/gradle-4.1-bin.zip"; unzip gradle-4.1-bin.zip
12+
- 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;
13+
- if [ ! -e /usr/local/android-sdk-linux/platforms/android-25 ]; then echo y | android update sdk --all --no-ui --filter "android-25"; fi;
14+
- 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;
15+
- echo y | android update sdk --no-ui --all --filter tool,extra-google-google_play_services
16+
- printf 'bintray.user=dummy_user\nbintray.apikey=dummy_api_key\nsdk.dir=/usr/local/android-sdk-linux' > local.properties
17+
18+
cache_directories:
19+
- /usr/local/android-sdk-linux/build-tools/25.0.2
20+
- /usr/local/android-sdk-linux/platforms/android-25
21+
- /usr/local/android-sdk-linux/extras/android/m2repository
22+
23+
test:
24+
override:
25+
# run static analysis and unit tests with coverage
26+
- ./gradlew checkWithCoverage --stacktrace --no-daemon
27+
28+
# Create SD card (needed for screenshots)
29+
- mksdcard -l sdcard 200M sdcard.img
30+
31+
# start the emulator
32+
- emulator -avd circleci-android22 -sdcard sdcard.img -no-audio -no-window:
33+
background: true
34+
parallel: true
35+
# wait for it to have booted
36+
- circle-android wait-for-boot
37+
- sleep 30
38+
# unlock the emulator screen
39+
- adb shell input keyevent 82
40+
41+
# run instrumentation tests with coverage & lint for the sample app
42+
- ./gradlew :sample:lintDebug mergedJacocoTestReport --stacktrace --no-daemon -Ptest.integration.options.adbInstallOptions=-r
43+
- ./gradlew install --no-daemon
44+
45+
# upload code coverage reports to Codecov.io
46+
- bash <(curl -s https://codecov.io/bash)
47+
48+
post:
49+
# copy the test results to the test results directory
50+
- mkdir -p $CIRCLE_TEST_REPORTS/unit
51+
- mkdir -p $CIRCLE_TEST_REPORTS/instrumentation
52+
- find . -type f -regex ".*/build/test-results/testDebugUnitTest/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/unit/ \;
53+
- find . -type f -regex ".*/build/outputs/androidTest-results/connected/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/instrumentation/ \;
54+
55+
# copy the reports to artifacts directory
56+
- mkdir -p $CIRCLE_ARTIFACTS/reports-library
57+
- mkdir -p $CIRCLE_ARTIFACTS/reports-sample
58+
- cp -r material-stepper/build/reports $CIRCLE_ARTIFACTS/reports-library
59+
- cp -r sample/build/reports $CIRCLE_ARTIFACTS/reports-sample

config/project_properties.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def final String PROPERTY_ADB_INSTALL_OPTIONS = 'test.integration.options.adbInstallOptions'
2+
3+
/**
4+
* Returns adbInstallOptions to use. This is needed because different adb install options are supported depending on OS version.
5+
* @return
6+
*/
7+
ext.getAdbInstallOptions = {
8+
def adbInstallOptions = (project.hasProperty(PROPERTY_ADB_INSTALL_OPTIONS) ? project.getProperties().get(PROPERTY_ADB_INSTALL_OPTIONS).split(',') : ['-g', '-r']) as String[]
9+
println("Running with adbInstallOptions: $adbInstallOptions")
10+
return adbInstallOptions
11+
}

config/quality/quality.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies {
1818
checkstyle 'com.puppycrawl.tools:checkstyle:6.11.1'
1919
}
2020

21-
def qualityConfigDir = "$project.rootDir/config/quality";
21+
def qualityConfigDir = "$project.rootDir/config/quality"
2222
def reportsDir = "$project.buildDir/reports"
2323

2424
task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code style checks') {
@@ -29,7 +29,7 @@ task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code
2929
reports {
3030
xml.enabled = true
3131
xml {
32-
destination "$reportsDir/checkstyle/checkstyle.xml"
32+
destination file("$reportsDir/checkstyle/checkstyle.xml")
3333
}
3434
}
3535

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

5454
reports {
55-
xml.enabled = true
56-
html.enabled = false
55+
xml.enabled = false
56+
html.enabled = true
5757
xml {
58-
destination "$reportsDir/findbugs/findbugs.xml"
58+
destination file("$reportsDir/findbugs/findbugs.xml")
5959
}
6060
}
6161

@@ -76,10 +76,10 @@ task pmd(type: Pmd, group: 'Verification', description: 'Inspect sourcecode for
7676
xml.enabled = true
7777
html.enabled = true
7878
xml {
79-
destination "$reportsDir/pmd/pmd.xml"
79+
destination file("$reportsDir/pmd/pmd.xml")
8080
}
8181
html {
82-
destination "$reportsDir/pmd/pmd.html"
82+
destination file("$reportsDir/pmd/pmd.html")
8383
}
8484
}
8585
}

gradle.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@
1919

2020
POM_GROUP_ID=com.stepstone.stepper
2121
POM_ARTIFACT_ID=material-stepper
22-
POM_VERSION=4.0.0
22+
POM_VERSION=4.1.0
23+
24+
#Needed so that Robolectric is working: https://github.com/robolectric/robolectric/issues/3169
25+
android.enableAapt2=false

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

material-stepper/build.gradle

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,16 @@ android {
3636
minSdkVersion project.androidMinSdkVersion
3737
targetSdkVersion project.androidTargetSdkVersion
3838
vectorDrawables.useSupportLibrary = true
39-
4039
}
40+
4141
buildTypes {
4242
release {
4343
minifyEnabled false
4444
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
4545
}
46+
debug {
47+
testCoverageEnabled true
48+
}
4649
}
4750

4851
testOptions {
@@ -52,26 +55,29 @@ android {
5255
includeNoLocationClasses = true
5356
}
5457
}
58+
//fixes https://github.com/robolectric/robolectric/issues/3169#issuecomment-312046322
59+
unitTests.includeAndroidResources = true
5560
}
5661

5762
lintOptions {
5863
warningsAsErrors true
64+
disable 'RequiredSize', 'ClickableViewAccessibility'
5965
}
6066
}
6167

6268
dependencies {
63-
compile "com.android.support:appcompat-v7:$androidSupportLibraryVersion"
69+
api "com.android.support:appcompat-v7:$androidSupportLibraryVersion"
6470

65-
testCompile "junit:junit:$junitVersion"
66-
testCompile "org.mockito:mockito-core:$mockitoVersion"
67-
testCompile "com.squareup.assertj:assertj-android:$assertjVersion"
68-
testCompile("org.robolectric:robolectric:$robolectricVersion") {
71+
testImplementation "junit:junit:$junitVersion"
72+
testImplementation "org.mockito:mockito-core:$mockitoVersion"
73+
testImplementation "com.squareup.assertj:assertj-android:$assertjVersion"
74+
testImplementation("org.robolectric:robolectric:$robolectricVersion") {
6975
exclude group: 'commons-logging', module: 'commons-logging'
7076
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
7177
}
72-
testCompile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion"
73-
testCompile "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
74-
testCompile "com.nhaarman:mockito-kotlin:$mockitoKotlinVersion"
78+
testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion"
79+
testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
80+
testImplementation "com.nhaarman:mockito-kotlin:$mockitoKotlinVersion"
7581
}
7682

7783
gradle.taskGraph.beforeTask { Task task ->
@@ -85,11 +91,13 @@ gradle.taskGraph.beforeTask { Task task ->
8591
}
8692

8793
// Log out test results to console
88-
tasks.matching { it instanceof Test }.all {
94+
tasks.matching { it instanceof Test}.all {
8995
testLogging.events = ["failed", "passed", "skipped"]
9096
}
9197

92-
check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'jacocoTestReport'
98+
task ('checkWithCoverage') {
99+
dependsOn 'checkstyle', 'findbugs', 'pmd', 'jacocoTestReport', 'lintDebug'
100+
}
93101

94102
apply from: '../installv1.gradle'
95103
apply from: '../bintrayv1.gradle'

0 commit comments

Comments
 (0)