Skip to content

Commit 80faadb

Browse files
authored
dependencies update & adding a common style through activity theme (#10)
* - updated the build tools, compile & target versions - updated Android Support Library - added an option to use a common style for all stepper through a theme * - updated library version to 1.0.1
1 parent eb90076 commit 80faadb

File tree

12 files changed

+92
-9
lines changed

12 files changed

+92
-9
lines changed

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Quoting the [documentation](https://www.google.com/design/spec/components/steppe
1111
1212
## Download (from JCenter)
1313
```groovy
14-
compile 'com.stepstone.stepper:material-stepper:1.0.0'
14+
compile 'com.stepstone.stepper:material-stepper:1.0.1'
1515
```
1616

1717
## Supported steppers
@@ -24,8 +24,8 @@ compile 'com.stepstone.stepper:material-stepper:1.0.0'
2424
<img src ="./gifs/tabs-styled.gif" width="640" height="360"/>
2525

2626
## Supported features
27-
- color customisation of individual widgets inside of the stepper via View attributes
28-
- custom texts of individual widgets inside of the stepper via View attributes
27+
- color customisation of individual widgets inside of the stepper via View attributes or a style from a theme
28+
- custom texts of individual widgets inside of the stepper via View attributes or a style from a theme
2929
- embedding the stepper anywhere in the view hierarchy and changing the stepper type for various device configurations, e.g. phone/tablet, portrait/landscape
3030
- step validation
3131

@@ -245,6 +245,26 @@ In such case you need to override the `getNextButtonText(int)` method in the `Ab
245245
}
246246
```
247247

248+
### Using the same stepper styling across the application
249+
If you have many steppers in your application in different activities/fragments you might want to set a common style in a theme.
250+
To do so, you need to set the `ms_stepperStyle` attribute in the theme, e.g.
251+
```xml
252+
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
253+
...
254+
255+
<item name="ms_stepperStyle">@style/DotStepperStyle</item>
256+
</style>
257+
```
258+
and declare that style in the XML you keep your styles at, e.g.
259+
```xml
260+
<style name="DotStepperStyle">
261+
<item name="ms_stepperType">dots</item>
262+
<item name="ms_activeStepColor">#FFFFFF</item>
263+
<item name="ms_inactiveStepColor">#006867</item>
264+
<item name="ms_bottomNavigationBackground">?attr/colorAccent</item>
265+
</style>
266+
```
267+
248268
### Advanced usage
249269
For other examples, e.g. persisting state on rotation, displaying errors, changing whether the user can go to the next step, etc. check out the sample app.
250270

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ configure(allprojects) {
2020
/* Android config and dependency versions */
2121
ext {
2222
androidMinSdkVersion = 14
23-
androidTargetSdkVersion = 23
24-
androidCompileSdkVersion = 23
25-
androidBuildToolsVersion = "23.0.3"
26-
androidSupportLibraryVersion = "23.4.0"
23+
androidTargetSdkVersion = 24
24+
androidCompileSdkVersion = 24
25+
androidBuildToolsVersion = "24.0.1"
26+
androidSupportLibraryVersion = "24.1.0"
2727

2828
/* Sample only */
2929
butterknifeVersion = "7.0.1"

gradle.properties

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

2020
POM_GROUP_ID=com.stepstone.stepper
2121
POM_ARTIFACT_ID=material-stepper
22-
POM_VERSION=1.0.0
22+
POM_VERSION=1.0.1

material-stepper/src/main/java/com/stepstone/stepper/StepperLayout.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public StepperLayout(Context context) {
199199
}
200200

201201
public StepperLayout(Context context, AttributeSet attrs) {
202-
this(context, attrs, 0);
202+
this(context, attrs, R.attr.ms_stepperStyle);
203203
}
204204

205205
public StepperLayout(Context context, AttributeSet attrs, int defStyleAttr) {

material-stepper/src/main/res/values/attrs.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,9 @@ limitations under the License.
7373
<declare-styleable name="RightNavigationButton">
7474
<attr name="state_verification_failed" format="boolean" />
7575
</declare-styleable>
76+
77+
<declare-styleable name="Theme">
78+
<attr name="ms_stepperStyle" format="reference" />
79+
</declare-styleable>
7680

7781
</resources>

sample/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
<activity android:name=".DefaultDotsActivity" />
2121
<activity android:name=".StyledDotsActivity" />
22+
<activity android:name=".ThemedDotsActivity" android:theme="@style/AppTheme.DotStepper" />
2223

2324
<activity android:name=".DefaultProgressBarActivity" />
2425
<activity android:name=".StyledProgressBarActivity" />

sample/src/main/java/com/stepstone/stepper/sample/MainActivity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ public void onStyledDots(View view) {
4343
startActivity(new Intent(this, StyledDotsActivity.class));
4444
}
4545

46+
@OnClick(R.id.themedDots)
47+
public void onThemedDots(View view) {
48+
startActivity(new Intent(this, ThemedDotsActivity.class));
49+
}
50+
4651
@OnClick(R.id.defaultProgressBar)
4752
public void onDefaultProgressBar(View view) {
4853
startActivity(new Intent(this, DefaultProgressBarActivity.class));
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
Copyright 2016 StepStone Services
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package com.stepstone.stepper.sample;
18+
19+
public class ThemedDotsActivity extends AbstractStepperActivity {
20+
21+
@Override
22+
protected int getLayoutResId() {
23+
return R.layout.activity_themed_dots;
24+
}
25+
26+
}

sample/src/main/res/layout/activity_main.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
android:layout_height="wrap_content"
2929
android:text="@string/styled_dots" />
3030

31+
<Button
32+
android:id="@+id/themedDots"
33+
android:layout_width="wrap_content"
34+
android:layout_height="wrap_content"
35+
android:text="@string/themed_dots" />
36+
3137
<Button
3238
android:id="@+id/defaultProgressBar"
3339
android:layout_width="wrap_content"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<com.stepstone.stepper.StepperLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:id="@+id/stepperLayout"
4+
android:orientation="vertical"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent" />

0 commit comments

Comments
 (0)