Skip to content

Commit 2706769

Browse files
authored
README improvements (#102)
* Reordered README sections so that the most common sections are exposed more.
1 parent 391e9bb commit 2706769

1 file changed

Lines changed: 86 additions & 63 deletions

File tree

README.md

Lines changed: 86 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,36 @@ Quoting the [documentation](https://www.google.com/design/spec/components/steppe
1010

1111
>Steppers display progress through a sequence by breaking it up into multiple logical and numbered steps.
1212
13-
## Download (from JCenter)
14-
```groovy
15-
compile 'com.stepstone.stepper:material-stepper:3.2.0'
16-
```
13+
All of the code & features mentioned in [Getting started](#getting-started) and [Advanced usage](#advanced-usage) are showcased in the sample app.
14+
Moreover, you can find there other examples, e.g. how to persist state on rotation, display errors, change whether the user can go to the next step, etc. So please have a look!
15+
16+
## Jump to section
17+
- [Supported steppers](#supported-steppers)
18+
- [Supported features](#supported-features)
19+
- [Getting started](#getting-started)
20+
- [Advanced usage](#advanced-usage)
21+
- [Making extra operations before going to the next step](#making-extra-operations-before-going-to-the-next-step)
22+
- [Changing button labels & compound drawables per step](#changing-button-labels--compound-drawables-per-step)
23+
- [Custom styling](#custom-styling)
24+
- [Using same stepper styling across the application](#using-same-stepper-styling-across-the-application)
25+
- [Showing a Back button on first step](#showing-a-back-button-on-first-step)
26+
- [Using Views instead of Fragments as Steps](#using-views-instead-of-fragments-as-steps)
27+
- [Showing an error on tabs if step verification failed](#showing-an-error-on-tabs-if-step-verification-failed)
28+
- [Stepper feedback](#stepper-feedback)
29+
- [Changing button text color when going to the next step should be disabled](#changing-button-text-color-when-going-to-the-next-step-should-be-disabled)
30+
- [StepperLayout attributes](#stepperlayout-attributes)
31+
- [View attributes](#view-attributes)
32+
- [StepperLayout style attributes](#stepperlayout-style-attributes)
33+
- [License](#license)
1734

1835
## Supported steppers
19-
- Mobile stepper with dots <br/>
36+
37+
### Mobile stepper with dots <br/>
2038
<img src ="./gifs/dotted-progress-bar.gif" width="360" height="640"/>&nbsp;&nbsp;<img src ="./gifs/dotted-progress-bar-styled.gif" width="360" height="640"/>
21-
- Mobile stepper with progress bar <br/>
39+
40+
### Mobile stepper with progress bar <br/>
2241
<img src ="./gifs/linear-progress-bar.gif" width="360" height="640"/>&nbsp;&nbsp;<img src ="./gifs/linear-progress-bar-styled.gif" width="360" height="640"/>
23-
- Horizontal stepper <br/>
42+
### Horizontal stepper <br/>
2443
<img src ="./gifs/tabs.gif" width="640" height="360"/>
2544
<img src ="./gifs/tabs-styled.gif" width="640" height="360"/>
2645

@@ -35,6 +54,11 @@ compile 'com.stepstone.stepper:material-stepper:3.2.0'
3554

3655
## Getting started
3756

57+
### Download (from JCenter)
58+
```groovy
59+
compile 'com.stepstone.stepper:material-stepper:3.2.0'
60+
```
61+
3862
### Create layout in XML
3963

4064
```xml
@@ -172,46 +196,9 @@ public class StepperActivity extends AppCompatActivity implements StepperLayout.
172196
}
173197
```
174198

175-
### Change Next/Complete button's text color when going to the next step should be disabled (optional)
176-
It is possible to change the Next/Complete button's text color (together with right chevron's color)
177-
when all the criteria to go to the next step are not met. This color should indicate that
178-
the user cannot go to next step yet and look as if disabled. Clicking on the button will still perform the regular
179-
step verification. There is a custom state added since setting `android:state_enabled` to `false` in a color selector would disable the clicks
180-
and we want to have them so that we can show an info message for the user.
181-
In order to set that color:
182-
183-
1. Create a new color selector in `res/color`
184-
185-
```xml
186-
<?xml version="1.0" encoding="utf-8"?>
187-
<selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
188-
<item app:state_verification_failed="true" android:color="#30BDBDBD"/>
189-
<item android:color="@color/ms_white"/>
190-
</selector>
191-
```
192-
193-
2. Change button's (text) color in layout file
194-
195-
```xml
196-
<?xml version="1.0" encoding="utf-8"?>
197-
<com.stepstone.stepper.StepperLayout xmlns:android="http://schemas.android.com/apk/res/android"
198-
xmlns:app="http://schemas.android.com/apk/res-auto"
199-
android:id="@+id/stepperLayout"
200-
android:layout_width="match_parent"
201-
android:layout_height="match_parent"
202-
app:ms_stepperType="dots"
203-
app:ms_nextButtonColor="@color/ms_custom_button_text_color"
204-
app:ms_completeButtonColor="@color/ms_custom_button_text_color" />
205-
```
206-
207-
3. Toggle the state in code
208-
209-
```java
210-
mStepperLayout.setNextButtonVerificationFailed(!enabled);
211-
mStepperLayout.setCompleteButtonVerificationFailed(!enabled);
212-
```
199+
## Advanced usage
213200

214-
### Make extra operations before going to the next step (optional)
201+
### Making extra operations before going to the next step
215202
After clicking on the Next button if the user wants to e.g.:
216203
* save something in the database
217204
* make a network call on a separate Thread
@@ -264,7 +251,7 @@ public class DelayedTransitionStepFragmentSample extends Fragment implements Blo
264251
}
265252
```
266253

267-
### Changing Back/Next button labels & compound drawables per step
254+
### Changing button labels & compound drawables per step
268255
Sometimes you might want to have different labels on the Next and/or Back navigation buttons on different steps e.g. use the default labels on the first few steps,
269256
but display 'Summary' just before the last page.
270257
You might also want to use your custom icons instead of the default navigation button compound drawables or not show the compound drawables for some of the buttons.
@@ -301,7 +288,14 @@ In such case you need to override the `getViewModel(int)` method from the `StepA
301288
}
302289
```
303290

304-
### Using the same stepper styling across the application
291+
### Custom styling
292+
Basic styling can be done by choosing the active and inactive step colors.
293+
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))
294+
For advanced styling you can use `ms_stepperLayoutTheme` StepperLayout's attribute and provide your custom style to be used.
295+
See 'Custom StepperLayout theme' in the sample app for an example.
296+
<p><img src ="./gifs/custom-theme.gif" width="360" height="640"/></p>
297+
298+
### Using same stepper styling across the application
305299
If you have many steppers in your application in different activities/fragments you might want to set a common style in a theme.
306300
To do so, you need to set the `ms_stepperStyle` attribute in the theme, e.g.
307301
```xml
@@ -336,7 +330,7 @@ This behaviour can be changed by setting ```ms_showBackButtonOnFirstStep``` to `
336330
```
337331
To get a callback when this button was pressed you need set a ```StepperListener``` and write your own custom return logic in the ```onReturn()``` method to e.g. close the Activity.
338332

339-
### Using with Views instead of Fragments
333+
### Using Views instead of Fragments as Steps
340334
It is possible to use this library without the need to rely on Fragments.
341335
To do so you need to use ```AbstractStepAdapter``` instead of ```AbstractFragmentStepAdapter```.
342336
For an example of how to use it with views please see the sample app.
@@ -401,17 +395,51 @@ public class StepperFeedbackStepFragment extends Fragment implements BlockingSte
401395

402396
```
403397

404-
### Custom styling
405-
Basic styling can be done by choosing the active and inactive step colors.
406-
There are some additional properties which can be changed directly from StepperLayout's attributes e.g. the background of bottom navigation buttons (see <a href="#stepperlayout-attributes">StepperLayout attributes</a>)
407-
For advanced styling you can use `ms_stepperLayoutTheme` StepperLayout's attribute and provide your custom style to be used.
408-
See 'Custom StepperLayout theme' in the sample app for an example.
409-
<p><img src ="./gifs/custom-theme.gif" width="360" height="640"/></p>
398+
### Changing button text color when going to the next step should be disabled
399+
It is possible to change the Next/Complete button's text color (together with right chevron's color)
400+
when all the criteria to go to the next step are not met. This color should indicate that
401+
the user cannot go to next step yet and look as if disabled. Clicking on the button will still perform the regular
402+
step verification. There is a custom state added since setting `android:state_enabled` to `false` in a color selector would disable the clicks
403+
and we want to have them so that we can show an info message for the user.
404+
In order to set that color:
405+
406+
1. Create a new color selector in `res/color`
407+
408+
```xml
409+
<?xml version="1.0" encoding="utf-8"?>
410+
<selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
411+
<item app:state_verification_failed="true" android:color="#30BDBDBD"/>
412+
<item android:color="@color/ms_white"/>
413+
</selector>
414+
```
415+
416+
2. Change button's (text) color in layout file
417+
418+
```xml
419+
<?xml version="1.0" encoding="utf-8"?>
420+
<com.stepstone.stepper.StepperLayout xmlns:android="http://schemas.android.com/apk/res/android"
421+
xmlns:app="http://schemas.android.com/apk/res-auto"
422+
android:id="@+id/stepperLayout"
423+
android:layout_width="match_parent"
424+
android:layout_height="match_parent"
425+
app:ms_stepperType="dots"
426+
app:ms_nextButtonColor="@color/ms_custom_button_text_color"
427+
app:ms_completeButtonColor="@color/ms_custom_button_text_color" />
428+
```
410429

411-
### Advanced usage
412-
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.
430+
3. Toggle the state in code
431+
432+
```java
433+
mStepperLayout.setNextButtonVerificationFailed(!enabled);
434+
mStepperLayout.setCompleteButtonVerificationFailed(!enabled);
435+
```
413436

414437
## StepperLayout attributes
438+
439+
### View attributes
440+
A list of base StepperLayout attributes used for behaviour configuration & base UI configuration.
441+
For advanced styling please see [StepperLayout style attributes](#stepperlayout-style-attributes).
442+
415443
| Attribute name | Format | Description |
416444
| --------------------------------|---------------------------------------------------------------------|-------------|
417445
| *ms_stepperType* | one of `dots`, `progress_bar` or `tabs` | **REQUIRED:** Type of the stepper |
@@ -436,7 +464,7 @@ For other examples, e.g. persisting state on rotation, displaying errors, changi
436464
| *ms_stepperFeedbackType* | flag(s): `none` or `tabs`, `content` & `disabled_bottom_navigation` | Type(s) of stepper feedback. Can be a combination of `tabs`, `content` & `disabled_bottom_navigation`. Default is `none`.|
437465
| *ms_stepperLayoutTheme* | reference | Theme to use for even more custom styling of the stepper layout. It is recommended that it should extend @style/MSDefaultStepperLayoutTheme, which is the default theme used. |
438466
439-
### StepperLayout style attributes
467+
### StepperLayout style attributes
440468
A list of `ms_stepperLayoutTheme` attributes responsible for styling of StepperLayout's child views.
441469

442470
| Attribute name | Description |
@@ -457,11 +485,6 @@ A list of `ms_stepperLayoutTheme` attributes responsible for styling of StepperL
457485
| *ms_stepTabIconBackgroundStyle* | Used by ms_stepIconBackground in layout/ms_step_tab |
458486
| *ms_stepTabTitleStyle* | Used by ms_stepTitle in layout/ms_step_tab |
459487
| *ms_stepTabDividerStyle* | Used by ms_stepDivider in layout/ms_step_tab |
460-
461-
## Missing features
462-
- support for non-linear steppers
463-
- support for non-editable steppers
464-
- support for Alternative labels in the horizontal stepper
465488

466489
## License
467490
Copyright 2016 StepStone Services

0 commit comments

Comments
 (0)