Components
Navigation Bar
A responsive navigation header positioned on top side of your page that includes support for branding, links, navigation, collapse and more.
Selected Theme
Select brand or tribe name to preview style
Status component contains a list of checks and completeness that has been tested and owned by each component
Navigation Bar or NavBar is an embedded name to define a navigation system that is collected in one section on the Android display. The shape, which is generally long in shape with a title, makes designers call it a bar (beam).
Variants
Legion has 6 variants for NavBar :
- Navbar Title
- Navbar Title and Description
- Navbar Title Large
- Navbar Title and Description Large
- Navbar Search Bar
- Navbar Search Bar with Title
Usage
To implement NavBar , you can define in xml or you can set the attribute programmatically.
1. Navbar Title
Static in xml
<com.telkom.legion.component.navbar.LgnTitleNavBar...app:title="@string/label_navbar_sample_title"app:menu="@menu/navbar_menu"/>
Dynamic using Kotlin*
...binding.navbarTitle.apply {title = "Title"menu = R.menu.navbar_menu}...
Set event listener
...binding.navbarTitle.apply {setOnMenuItemClickListener(listener)setOnNavigationClickListener(listener)}...
2. Navbar Title and Description
Static in xml
<com.telkom.legion.component.navbar.LgnTitleDescNavBar...app:title="@string/label_navbar_sample_title"app:description="@string/label_navbar_sample_description"app:menu="@menu/navbar_menu"/>
Dynamic using Kotlin*
...binding.navbarTitleDesc.apply {title = "Title"description = "Description"menu = R.menu.navbar_menu}...
Set event listener
...binding.navbarTitleDesc.apply {setOnMenuItemClickListener(listener)setOnNavigationClickListener(listener)}...
3. Navbar Title Large
Static in xml
<com.telkom.legion.component.navbar.LgnTitleLargeNavBar...app:title="@string/label_navbar_sample_title"app:menu="@menu/navbar_menu"/>
Dynamic using Kotlin*
...binding.navbarTitleLarge.apply {title = "Title"menu = R.menu.navbar_menu}...
Set event listener
...binding.navbarTitleLarge.apply {setOnMenuItemClickListener(listener)setOnNavigationClickListener(listener)}...
4. Navbar Title and Description Large
Static in xml
<com.telkom.legion.component.navbar.LgnTitleDescLargeNavBar...app:title="@string/label_navbar_sample_title"app:description="@string/label_navbar_sample_description"app:menu="@menu/navbar_menu"/>
Dynamic using Kotlin*
...binding.navbarTitleDescLarge.apply {title = "Title"description = "Description"menu = R.menu.navbar_menu}...
Set event listener
...binding.navbarTitleDescLarge.apply {setOnMenuItemClickListener(listener)setOnNavigationClickListener(listener)}...
5. Navbar Search Bar
Static in xml
<com.telkom.legion.component.navbar.LgnSearchNavBar...app:placeholder="@string/label_navbar_sample_placeholder"app:menu="@menu/navbar_menu"app:startIconDrawable="@drawable/ic_clock"app:endIconDrawable="@drawable/ic_eye_on"/>
Dynamic using Kotlin*
...binding.navbarSearchBar.apply {placeholder = "Placeholder"startIconDrawable = ContextCompat.getDrawable(context, R.drawable.startIcon)endIconDrawable = ContextCompat.getDrawable(context, R.drawable.endIcon)imeOptions = EditorInfo.IME_ACTION_SEARCHmenu = R.menu.navbar_menu}
Set event listener
...binding.navbarSearchBar.apply {setOnMenuItemClickListener(listener)setOnNavigationClickListener(listener)setOnStartIconTextFieldListener(listener)setOnEndIconTextFieldListener(listener)}
6. Navbar Search Bar with Title
Static in xml
<com.telkom.legion.component.navbar.LgnTitleSearchNavBar...app:title="@string/label_navbar_sample_title"app:placeholder="@string/label_navbar_sample_placeholder"app:menu="@menu/navbar_menu"app:startIconDrawable="@drawable/ic_clock"app:endIconDrawable="@drawable/ic_eye_on"/>
Dynamic using Kotlin*
...binding.navbarSearchBarTitle.apply {title = "Title"placeholder = "Placeholder"startIconDrawable = ContextCompat.getDrawable(context, R.drawable.startIcon)endIconDrawable = ContextCompat.getDrawable(context, R.drawable.endIcon)imeOptions = EditorInfo.IME_ACTION_SEARCHmenu = R.menu.navbar_menu}
Set event listener
...binding.navbarSearchBarTitle.apply {setOnMenuItemClickListener(listener)setOnNavigationClickListener(listener)setOnStartIconTextFieldListener(listener)setOnEndIconTextFieldListener(listener)}...
Attribute
Attribute Name | Xml Attrs | Related method(s) | Description |
---|---|---|---|
Title | app:title | title | To set and get title |
Description | app:description | description | To set and get description |
Menu Toolbar | app:menu | menu | To set menu action in toolbar. need to define menu xml |
Placeholder | app:placeholder | placeholder | To set placeholder in edit text |
Start Icon Drawable | app:startIconDrawable | startIconDrawable | To set prefix icon in edit text |
End Icon Drawable | app:endIconDrawable | endIconDrawable | To set suffix icon in edit text |
Ime Options | android:imeOptions | imeOptions | To set ime options in edit text |
Edit Text Value | N/A | etValue | To set edittext value in edit text |
Event Back Navigation | N/A | setOnNavigationClickListener | To set event back click listener |
Event Menu Navigation | N/A | setOnEndIconTextFieldListener | To set event menu item click listener |
Event Start Icon Edit Text | N/A | setOnEndIconTextFieldListener | To set event start icon on edit text click listener |
Event End Icon Edit Text | N/A | setOnEndIconTextFieldListener | To set event end icon on edit text click listener |
Event Text Changed Edit Text | N/A | setOnEditTextChangeListener | To set edit text changed on text listener |