Skip to content

Commit 7c60d7c

Browse files
authored
Merge pull request #3 from acefalobi/programmatic-menu-update
Allow programmatically updating the menu.
2 parents be80b42 + d4c3557 commit 7c60d7c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ See the [Sample app](https://github.com/acefalobi/android-stepper/tree/master/ap
2626
* [Advanced Usage](#advanced-usage)
2727
* [Setup with Action Bar](#setup-with-action-bar)
2828
* [Override back button to go up](#override-back-button-to-go-up)
29+
* [Update Menu Programmatically](#update-menu-programmatically)
2930
* [XML Attributes](#xml-attributes)
3031
* [Contributing](#contributing)
3132
* [License](#license)
@@ -246,6 +247,14 @@ override fun onBackPressed() {
246247
}
247248
```
248249

250+
### Update Menu Programmatically
251+
252+
First make sure the menu item already has corresponding destination in the nav graph.
253+
254+
```kotlin
255+
stepper.menu.add(groupId, R.id.step_4_dest, order, "New Step")
256+
```
257+
249258
## XML Attributes
250259

251260
| Attribute name | Format | Description |

stepper/src/main/java/com/aceinteract/android/stepper/StepperNavigationView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class StepperNavigationView(context: Context, attrs: AttributeSet) : FrameLayout
5252
/**
5353
* The menu that displays the steps.
5454
*/
55-
private lateinit var menu: StepperMenu
55+
lateinit var menu: StepperMenu
5656

5757
/**
5858
* The color to use for widgets.

0 commit comments

Comments
 (0)