Recommended material components : Android Bangkok 2019

Recommended Material
Components for your app.
Monthira Chayabanjonglerd (Mint)
Android Developer @ Ookbee U. Co.,Ltd.
Blogger @ MikkiPastel, Writer @ Blacklenspub
Recommended Components
Snackbar
Text Field Chips Bottom Navigation
Button
Brief
Recommended material components : Android Bangkok 2019
Recommended material components : Android Bangkok 2019
Plaid
https://github.com/nickbutcher/plaid
No Toast, Please Snackbar
Recommended material components : Android Bangkok 2019
SnackBar
.
Toast SnackBar
Snackbar : Toast
.
Toast.makeText(
this,
"You're in Android Bangkok 2019",
Toast.LENGTH_SHORT
).show()
Length
- Toast.LENGTH_SHORT
- Toast.LENGTH_LONG
Snackbar
.
Snackbar.make(
rootview,
"You're in Android Bangkok 2019",
Snackbar.LENGTH_SHORT
).show()
Length
- Snackbar.LENGTH_INDEFINITE
- Snackbar.LENGTH_SHORT
- Snackbar.LENGTH_LONG
Snackbar
Snackbar.make(
rootview,
"You're in Android Bangkok 2019",
Snackbar.LENGTH_SHORT
).show()
Toast.makeText(
this,
"You're in Android Bangkok 2019",
Toast.LENGTH_SHORT
).show()
Snackbar with Action
. Snackbar.make(
rootview,
"Connection failed.",
Snackbar.LENGTH_SHORT
).setAction("try again") {
//TODO
}.show()
Snackbar
.
Recommended material components : Android Bangkok 2019
multiple Button type
Button Type
MaterialButton FloatingActionButton
Button Type
.
Extended FloatingActionButton
Recommended material components : Android Bangkok 2019
MaterialButton : Style
.
Text Button
Filled Button (default) Outline Button
Icon Button
.
MaterialButton : Icon Button
LinearLayout
orientation="horizontal
ImageView
layout_width="wrap_content"
layout_height="wrap_content"
TextView
layout_width="wrap_content"
layout_height="wrap_content"
setOnClickListener()
.
MaterialButton : Icon Button
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_action_add"
android:drawablePadding="8dp"
android:text="Add"/>
.
MaterialButton
<android.support.design.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.Button.Icon"
android:text="Add"
app:icon="@drawable/ic_action_add"/>
<android.support.design.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
android:text="Add"
app:icon="@drawable/ic_action_add"/>
.
MaterialButton
<android.support.design.button.MaterialButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.Button.Icon"
android:text="Add"
app:icon="@drawable/ic_action_add"/>
.
MaterialButton
<android.support.design.button.MaterialButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.Button.Icon"
android:text="Add"
app:icon="@drawable/ic_action_add"
app:iconGravity="textStart" />
.
MaterialButton
<android.support.design.button.MaterialButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.Button.Icon"
android:text="Add"
app:icon="@drawable/ic_action_add"
app:iconGravity="textStart"
app:iconPadding="0dp"/>
Recommended material components : Android Bangkok 2019
.
FloatingActionButton
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:src="@drawable/ic_action_add"/>
1) Default (56 x 56dp) 2) Mini (40 x 40dp)
3) Auto
Small windows
less than 470dp
.
FloatingActionButton
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:src="@drawable/ic_action_add"
app:fabSize="mini"/>
Why I love Text Field
Recommended material components : Android Bangkok 2019
Text Field : EditText
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="username"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
.
.
Text Field : TextInputLayout
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="username">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>
Text Field : Style
.
Filled Box (default) Outlined Box
Text Field : Style (Outlined Box)
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:hint="username">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>
.
Chips : Common Feature
● Label
● Helper Text
● Error Text
● Character Count
Text Field : Label
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:hint="username">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>
.
.
Text Field : Helper Text
<android.support.design.widget.TextInputLayout
android:id="@+id/layoutUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:hint="username"
app:helperText="your email address">
<android.support.design.widget.TextInputEditText
android:id="@+id/edittextUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>
.
Text Field : Helper Text
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
layoutUsername.helperText = "your email address"
}
Text Field : Error Text
.
Toast SnackBar
.
Text Field : Error Text (TextInputLayout)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
layoutPassword.error =
"Password must contain at least 8 characters."
}
.
Text Field : Error Text (TextInputEditText)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
edittextPassword.error =
"Password must contain at least 8 characters."
}
.
Text Field : Character Counter
<android.support.design.widget.TextInputLayout
android:id="@+id/layoutUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:hint="username"
app:counterEnabled="true"
app:counterMaxLength="20">
<android.support.design.widget.TextInputEditText
android:id="@+id/edittextUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>
.
Text Field : Counter with Error
edittextUsername.addTextChangedListener(object: TextWatcher {
override fun afterTextChanged(s: Editable?) {}
override fun beforeTextChanged(s: CharSequence?, start: Int, count:
Int, after: Int) {}
override fun onTextChanged(s: CharSequence?, start: Int, before:
Int, count: Int) {
if (count > layoutUsername.counterMaxLength) {
layoutUsername.error = "Characters more than 20"
} else {
layoutUsername.isErrorEnabled = false
}
}
})
Recommended material components : Android Bangkok 2019
How to collaboration Chips from
Material Design in your life
Recommended material components : Android Bangkok 2019
Chips : Style
● Action Chips
● Filter Chips
● Choice Chips
● Entry Chips
Chips : Style
.
Action Chips (Default)
Chips : Style
.
Action Chips (Default)
Chips : Style
.
Filter Chip
Chips : Style
.
Filter Chip
Chips: Style
.
Choice Chip
Chips: Style
.
Choice Chip
Chips: Style
.
Entry Chip
Chips: Style
.
Entry Chip
.
Chips: Style
<android.support.design.chip.Chip
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<android.support.design.chip.Chip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.Chip.Choice">
<android.support.design.chip.Chip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.Chip.Filter"/>
<android.support.design.chip.Chip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.Chip.Entry"/>
Chips : Handling Clicks
● setOnClickListener
● setOnCheckedChangeListener
● setOnCloseIconClickListener
.
Chips : Handling Clicks
chipAction.setOnClickListener {
Snackbar.make(
rootview,
"Action Chips",
Snackbar.LENGTH_SHORT
).show()
}
.
Chips : Handling Clicks
chipChoice.setOnCheckedChangeListener {
buttonView, isChecked ->
Snackbar.make(
rootview,
isChecked.toString(),
Snackbar.LENGTH_SHORT
).show()
}
.
Chips : Handling Clicks
chipEntry.setOnCloseIconClickListener {
it.visibility = View.GONE
}
Chips : Example
.
Chips : Example #1 Hashtag Menu
Add #Hashtag for this menu.
tonkatsu, japanese food, pork, meat, lunch,
bangkok, silom
.
Chips : Example #1 Hashtag Menu
LinearLayout
orientation="horizontal
Chip
layout_width="wrap_content"
layout_height="wrap_content"
Chip
layout_width="wrap_content"
layout_height="wrap_content"
...
.
Chips : Example #1 Hashtag Menu
HorizontalScrollView
layout_width="match_parent"
layout_height="wrap_content"
LinearLayout
orientation="vertical
Chip
layout_width="wrap_content"
layout_height="wrap_content"
Chip
layout_width="wrap_content"
layout_height="wrap_content"
...
.
Chips : Example #1 Hashtag Menu
ChipGroup
layout_width="match_parent"
layout_height="wrap_content"
Chip
layout_width="wrap_content"
layout_height="wrap_content"
Chip
layout_width="wrap_content"
layout_height="wrap_content"
...
.
Chips : Example #1 Hashtag Menu
<android.support.design.chip.ChipGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp">
<android.support.design.chip.Chip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:text="Tonkatsu"/>
</android.support.design.chip.ChipGroup>
.
Chips : Example #2 RecyclerView
Add #Hashtag for this menu in
RecyclerView
.
Chips : Chip in LinearLayoutManager
<android.support.design.chip.ChipGroup
android:id="@+id/chipGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerViewHashtag"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.chip.ChipGroup>
Chips : Chip in LinearLayoutManager
.
Chips : Chip in LinearLayoutManager
recyclerViewHashtag.apply {
layoutManager = LinearLayoutManager(
containerView.context,
LinearLayoutManager.HORIZONTAL,
False
)
this.adapter = HashtagChipAdapter(
Item.labels,
this@PostListItemViewHolder
)
}
.
Chips : RecyclerView with ChipGroup
<android.support.design.chip.ChipGroup
android:id="@+id/chipGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
.
Chips : RecyclerView with ChipGroup
chipGroup.removeAllViews()
if (item.labels!!.isNotEmpty()) {
item.labels.forEach {
val chip = Chip(containerView.context)
chip.apply {
layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT)
text = it
}
chipGroup.addView(chip)
}
}
.
Chips: Example #3 ChipGroup Selected
Your Burger!!!
.
Chips: Example #3 ChipGroup Selected
Choice Chips
Filter Chips
.
Chips: Example #3 ChipGroup Selected
ChipGroup
layout_width="match_parent"
layout_height="wrap_content
app:singleSelection="true"
Chip
layout_width="wrap_content"
layout_height="wrap_content"
Chip
layout_width="wrap_content"
layout_height="wrap_content"
...
.
Chips: Example #3 ChipGroup Selected
chipGroupMeat.setOnCheckedChangeListener { chipGroup, id ->
if (chipGroup.findViewById<Chip>(id) != null) {
val meat = chipGroup.findViewById<Chip>(id).text
Snackbar.make(rootview,
meat,
Snackbar.LENGTH_SHORT
).show()
}
}
.
Chips: Example #3 ChipGroup Selected
for (i in 0 until chipGroupTopping.childCount) {
val chip = chipGroupTopping.getChildAt(i) as Chip
chip.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
Snackbar.make(rootview,
chip.text,
Snackbar.LENGTH_SHORT
).show()
}
}
}
.
Chips: Example #3 ChipGroup Selected
for (i in 0 until chipGroupTopping.childCount) {
val chip = chipGroupTopping.getChildAt(i) as Chip
chip.setOnCheckedChangeListener {
buttonView, isChecked ->
if (isChecked) {
toppingList.add(chip.text)
} else {
toppingList.remove(chip.text)
}
Snackbar.make(rootview,
toppingList.toString(),
Snackbar.LENGTH_SHORT
).show()
}
}
.
Chips: Example #3 ChipGroup Selected
Recommended material components : Android Bangkok 2019
Menu section by Bottom Navigation
Recommended material components : Android Bangkok 2019
Recommended material components : Android Bangkok 2019
Bottom Navigation: Recommend Style
.
Updated Material Style
(default)
Colored Material Style
.
Bottom Navigation: State
.
Bottom Navigation: When to use
.
Bottom Navigation : How to use
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/menuFavorite"
android:title="favourites"
android:icon="@drawable/ic_favorite"/>
<item android:id="@+id/menuMusic"
android:title="music"
android:icon="@drawable/ic_action_music"/>
<item android:id="@+id/menuBook"
android:title="book"
android:icon="@drawable/ic_action_book"/>
<item android:id="@+id/menuNews"
android:title="news"
android:icon="@drawable/ic_action_music"/>
</menu>
.
Bottom Navigation : How to use
<android.support.design.widget.BottomNavigationView
style="@style/Widget.MaterialComponents.BottomNavigationView.Colored"
android:id="@+id/bottomNavigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:menu="@menu/menu_main"/>
.
Bottom Navigation : How to use
bottomNavigation.setOnNavigationItemSelectedListener {
val fragment = when (it.itemId) {
R.id.menuFavorite -> FavoriteFragment()
R.id.menuMusic -> MusicFragment()
R.id.menuBook -> BookFragment()
else -> NewsFragment()
}
if (savedInstanceState == null) {
supportFragmentManager.beginTransaction()
.replace(R.id.container, fragment)
.commit()
}
true
}
.
Bottom Navigation : How to use
bottomNavigation.setOnNavigationItemSelectedListener {
val fragment = when (it.itemId) {
R.id.menuFavorite -> FavoriteFragment()
R.id.menuMusic -> MusicFragment()
R.id.menuBook -> BookFragment()
else -> NewsFragment()
}
if (savedInstanceState == null) {
supportFragmentManager.beginTransaction()
.replace(R.id.container, fragment)
.commit()
}
true
}
bottomNavigation.selectedItemId = R.id.menuFavorite
https://proandroiddev.com/fragments-swapping-with-bottom-bar-ffbd265bd742
Resource
https://material.io/
https://material.io/collections/developer-tutorials/#android-kotlin
https://github.com/material-components/material-components-android
https://www.udacity.com/course/material-design-for-android-developers--ud862
See you next time :D
Monthira Chayabanjonglerd (Mint)
Android Developer @ Ookbee U. Co.,Ltd.
Portfolio :
https://mikkipastel.firebaseapp.com
1 of 99

Recommended

android level 3android level 3
android level 3DevMix
1.6K views23 slides
Mashups & APIsMashups & APIs
Mashups & APIsPamela Fox
2.3K views34 slides
LayoutLayout
Layoutdeepikasony
330 views14 slides

More Related Content

Similar to Recommended material components : Android Bangkok 2019(20)

Layouts in androidLayouts in android
Layouts in android
baabtra.com - No. 1 supplier of quality freshers1.6K views
06 UI Layout06 UI Layout
06 UI Layout
Sokngim Sa1.5K views
Android App Development 03 : Widget &amp; UIAndroid App Development 03 : Widget &amp; UI
Android App Development 03 : Widget &amp; UI
Anuchit Chalothorn929 views
Ap quiz appAp quiz app
Ap quiz app
angelicaurio1.6K views
Material design basicsMaterial design basics
Material design basics
Jorge Barroso4.6K views
Chapter 5 - LayoutsChapter 5 - Layouts
Chapter 5 - Layouts
Sittiphol Phanvilai263 views
Curso Básico AndroidCurso Básico Android
Curso Básico Android
Eduardo Lagares662 views
07_UIAndroid.pdf07_UIAndroid.pdf
07_UIAndroid.pdf
ImranS182 views
Android programming basicsAndroid programming basics
Android programming basics
Egerton University157 views
Android Tutorials : Basic widgetsAndroid Tutorials : Basic widgets
Android Tutorials : Basic widgets
Prajyot Mainkar5K views
AndroidAndroid
Android
San Bunna865 views

Recommended material components : Android Bangkok 2019

Editor's Notes

  1. Hello everyone. I am excited to see you at Android Bangkok in this year. My session is recommended Material Components for your application.
  2. In this session, I talk about 5 views in Material Components such as /SnackBar, Material Button and Floating Action Button, Text Field, Chips and Bottom Navigation.
  3. Before say about some components. I will brief you about Material Components in video.
  4. Material Design announce at Google IO’2014 ;and has 3 big aspects which are Design, Developer, and Tool. It’s available for Android, iOS, web and Flutter ;and it can be used in all supported versions of Android, or in API Level 21 (Android 5.0) and newer (or for older via the v7 appcompat library). Key materials in Material Design is paper surface which pieces of digital paper with digital ink.
  5. Plaid is showcase for Material Application ;and put news and inspiration about design ;which create by Nick Butcher (Developer Advocate at Google) and his team ;and you can read the source code in Github. You can download it on Play Store but only for beta tester.
  6. At first, I talk about SnackBar. When you use toast? For show success or failure message or something like that.
  7. example for Snackbar such as Show snackbar for successfully save post in Facebook and add action to view all saved items Or show snackbar after move email to trash and add action to undo it Or show snackbar for do uploading photo with backup it in Google Photo
  8. SnackBar is similar to Toast. Because both of them can disappear automatically, but SnackBar has more action than Toast with either after a timeout ;or after a user interaction elsewhere on the screen, and can also be swiped off the screen.
  9. I will show you the difference between SnackBar and Toast. I will start with a Toast first. /Toast has 2 durations are LENGTH_SHORT and LENGTH_LONG
  10. SnackBar has 3 durations are LENGTH_INDEFINITE, LENGTH_SHORT, and LENGTH_LONG
  11. What’s difference of Toast and Snackbar? difference with first parameter, this is Context with Toast and is View with Snackbar.
  12. For implement Snackbar with Action: default for click action in snacker is dismiss view ;then you should not put something in listener. And default color is colorAccent ;because text action should be difference color ;with text label follow Material Design guideline.
  13. Text label can contain up to two lines of text with short, clear updates on processes that have been performed. If you put message in text label more 2 line, snackbar manages to show message in 2 line with 3 dot at end of max line follow Material Design Spec.
  14. snackbars should appear above persistent bottom navigation and Floating Action Buttons.
  15. For next topic, button. In Material Design have 3 types of button such as
  16. 1) Material button ;which default button for developer who started to create Android Application ;and it allow users to take actions, and make choices, with a single tap. 2) float action button represents the primary action of a screen ;and usually found it ;at the bottom right of the screen
  17. And 3) extended floating action button, a new components which announced at Material Design website on February in this year. This is Floating Action Button component capable of containing text. This session is not talk about it. PS. cap-a-ble
  18. At first button components, Material button. You see some button in Facebook such as, share button with you share post, shop now to lead user buy ticket, and show like page for similar to interacted post PS. in-ter-act-ted
  19. It has 4 styles are filled button (with elevation is default and unelevated), outline button, text button, icon button (with filled elevation and unelevated) which can change button style in your layout. For default color, background color is colorPrimary and text color is colorOnPrimary. PS. un-ele-vat-ted
  20. If your layout have text button with icon, How to implement it? At first, you add LinearLayout for parent view of ImageView and TextView; and setOnClickListener() at parent view for perform click. Cons is render more view for 1 button.
  21. Then you use 1 button, you add icon by drawable start to put icon drawable ;and add padding of text and icon by drawablePadding.
  22. In material components, Material Button can add icon by app:icon ;and developer don’t adjust about padding. You can use button icon style and text button icon style ;for set icon in front of text in your button.
  23. I change set width to match parent. The result is near center of text and left for icon. How to set button content to center?
  24. Add app:iconGravity to textStart for set icon to center with text. About iconGravity have 2 values are textStart for this example ;and start is default with icon of button in the left.
  25. If you want button without text and set icon to center. How to do it?/ Add app:iconPadding to 0dp to set icon to center
  26. last button components in this session, floating action button example for there are Click it to compose new email in Gmail Click it to add new post in LINE timeline and Click it to add new twit in Twitter
  27. It’s easy to use it ;by add Floating Action Button in your layout; and add icon resource for meaningful ;such as click it to add item then use plus drawable.
  28. Floating Action Button come in three types: nornal, mini, and auto. 1) default is normal sized button which size is 56dp (56 multiply by 56dp) 2) Mini sized button which size is 40dp (40 multiply by 40 dp) 3) Auto will change button size based on windows size. /About size, mini sized button which small sized windows with less than 470dp and normal sized button which larger windows.
  29. Then you can set floating action button size for mini and auto with app:fabSize in your button
  30. For next topic, Text Field
  31. If you create UI for login page in your app, you create more view for 1 input such as TextView, EditText, and ImageView for optional. Is it better use Material Components? About EditText and Text Field example, I remain with login page on some application.
  32. for 1 input field, you add parent view and child views are TextView to show label and EditText to get input from user. It’s so complex to create 1 field to get input from user.
  33. In Material Design, It’s dynamic for show and hide label when user type input in EditText.
  34. You can change TextInputLayout has 2 styles are Filled Box is default style with fill & stroke And Outline Box have rounded corner
  35. You can set Outline Box style in your text field at your layout.
  36. In Material Design Document said about commonly used properties in your text field for example label, helper text, error text, and character count.
  37. You can set label of text field by hint and working is show in EditText when no text and move to top when user is typing
  38. If you need to show information about input field. I recommend you to use helperText to show this in your layout.
  39. And also can implement it in your code too.
  40. You can add error message in your fields. You can see what’re differences between these pictures.
  41. At left photo, set error text at TextInputLayout
  42. And at right photo, set error text at TextInputEditText.
  43. You can set counter enable and max length at TextInputLayout. How it works? TextInputLayout show border ;and character counter to red ;when user is typing text more than counterMaxLength.
  44. You can implement counter character with TextWatcher to show error message. How it works? Show error text when user is typing text more than max character counter ;and not show error text when user is typing less than them.
  45. I will publish my blog about Text Field at the Blacklens pub in medium at 5 PM. {drink water}
  46. For next topic, Chips. About Chips, everyone think about potato chip, chocolate chip, chip and dale, and something like that ;but Chips for Android Developer is small block view to represent an input, attribute, or action in your application.
  47. In your life, Chip is found at Google Assistance, Gmail, Play Store, and in some application.
  48. Chips have 4 styles are action chip, filter chip, choice chip, and entry chip
  49. Action chips are default style of chips ;and used with action related to primary content ;which displayed after them. If action chips use in Material Card, they are below divider line.
  50. It can trigger an action or show progress and confirmation.
  51. Filter chips use tags or descriptive words to filter content.
  52. They are a good alternative to toggle buttons or checkboxes with multiple chips ;can be selected or unselected.
  53. Choice Chip allows selection of a single chip from a set of options ;and a good alternative to toggle buttons, radio buttons, and single select menus.
  54. When you selecting a single choice chip automatically deselects all other chips in the set.
  55. Entry Chip represents a complex piece of information in a compact form. It usually contains an optional chip icon, optional close icon, and is optionally checkable.
  56. Behaviors are transform text based on user input, can be editable util user take action, display error state, can be reordered or moved into other fields ;and expend to show more information.
  57. For choice chips, filter chips, and entry chips can change style in your layout.
  58. In Material Design Document said about 3 callback function ;for used in Chips ;such as setOnClickListener, setOnCheckedChangeListener, and setOnCloseIconClickListener
  59. Call setOnClickListener to do something after click at chip ;for example show Snackbar after click it.
  60. call setOnCheckedChangeListener to register a callback when chip is toggled ;for example show Snackbar text for isCheck value after click it.
  61. Call setOnCloseIconClickListener to do something with click close icon in entry chip ;for example click at close icon to hide it.
  62. I have some example to use Chip for some situation in your application. Example 1, add hashtag with chips for your menu Example 2, add tag with chips in RecyclerView for dynamic data And example 3, handle for chipgroup selected
  63. For first example add hashtag for your menu. Tonkatsu is a Japanese food containing deep-fried pork with breadcrumbs, cabbage, Japanese rice, miso soup, and side dish. I took this dish when I have lunch with my colleagues at Katsushin which recommended by Wongnai Users’ Choice 2019. /Then hashtag about this photo are tonkatsu, japanese food, pork, meat, lunch, bangkok, and silom.
  64. I mockup hashtag list by chips in my Material Card with LinearLayout is parent view but have problem about cannot show all hashtag
  65. OK, It can solve them by add horizontalScrollView to parent view then can scroll to see all hashtag.
  66. If a designer in your team need to show all hashtag in Material Card without scroll view. How do you solve this? /This question solved by ChipGroup
  67. ChipGroup contains a chip set and manage layout similar to RadioGroup.
  68. If you get all hashtag from dynamic data such as API. You should use RecyclerView to render chips. For example 2 I show you about this.
  69. This application for the example is my blog application and redesign it to Material Design. User can get all blog and read it in my application. Each blog has tag related to content of blog ;such as I write for doing Firestore Codelab from Android Bangkok last year at home, tags are Android Application, firebase, and programming. For scroll view to see all tag, You add RecyclerView in ChipGroup at your item view for use in your adapter.
  70. and add new adapter class in HashtagChipAdapter file.
  71. then add adapter in your RecyclerView in main adapter class.
  72. For ChipGroup, You add ChipGroup in your item view for use in your adapter layout.
  73. and create Chip view at adapter class and add it to ChipGroup. You don’t forget for removeAllViews at ChipGroup because they have bug with show tag with scroll up-down which view reused old view to show tags item.
  74. Last example for chip. If you select something in your app, you think of RadioButton, Checkbox, or something like that. Chip can do similar to select one thing and multiple thing in the list.
  75. This example is make your burger, you can choose 1 meat with Choice Chips and many topping in your burger with Filter Chips.
  76. For choose your meat with Choice Chips, add 1 ChipGroup which set singleSelection is true.
  77. Call setOnCheckedChangeListener for get Chips id from ChipGroup to get text of meat and add check id is not null for get it.
  78. For Filter Chips to choose your topping, call setOnCheckChangeListener in each Chip which is a child of ChipGroups to get text for item selected.
  79. Final result in this example is get your meat and topping in your burger then you create global variable for meat and topping. For topping, you create arrayList global variable and add it when checked and remove when unchecked.
  80. Finally setOnClickListener in your button to get meat and topping to show in next fragment.
  81. I will publish my blog about Chip at the Blacklens pub in medium which publish at 5 P.M. too {drink water}
  82. For last topic, bottom navigation. I think everybody on this room use 3rd-party library from github such as ahbottomnavigation ;or custom your bottom navigation view.
  83. There are example applications to use bottom navigation such as Twitter, YouTube, and Anna Quick show which my responsibility project at Ookbee U. Why use it? Because separate some feature in application such as In twitter has 4 main features are home, search, notification and message In youtube has 5 are home, trending, subscriptions, inbox, and library In Anna have 4 are home which game show schedule and more, ranking, livetalk and profile
  84. LINE change from TabLayout with Image to Bottom Navigation follow Material Design guideline which have 3 to 5 top-level destinations to navigate to. And add sub-menu such as friends, official account, services, stickers, and theme with TabLayout in new Home navigation.
  85. Bottom Navigation have 3 styles such as Updated Material Style, Colored Material Style, and Legacy Style. In Material Design document is not recommend Legacy style because this is with old behavior. Default style is Updated Material Style which consists of updated colors, text sizing, and behavior. The default BottomNavigationView has white background and icons and text colored with colorPrimary. Colored Material Style inherits from the default style but sets the colors to different mappings. Use the colored style to get a bottom navigation bar with a colorPrimary background and shades of white for the icon and text colors.
  86. Bottom navigation destinations may be active, inactive, focused or pressed. States are used to show pressed, focused, and unselected states. For Left side, Bottom navigation destination is inactive state are represented with reduced opacities. For Right side, Bottom navigation destination is active state have full opacity and text showed.
  87. Bottom navigation should be used for Top-level destinations that need to be accessible from anywhere in the app, it have 3 to 5 destinations and support in Mobile or tablet only and shouldn’t be used for Single tasks, such as viewing a single email and User preferences or settings
  88. How to use? Af first, create a menu resource which up to 5 navigation target.
  89. Second add BottomNavigationView in your layout and I use Colored Material Style in my bottom navigation. Next, set app:menu to menu resource which created at first step.
  90. At last, add setOnNavigationItemSelectedListener for selection event. This example show you about click to navigation to show fragment. What’s result about this code? /The result is not show FavoriteFragment at favorites navigation, why?
  91. Because not selected navigation, then call selectedItemId to set menuFavorite to show after open app.
  92. Finally for handle state in Bottom Navigation, I recommend this blog from ProAndroidDev publishion in medium about handle saving fragment state in Bottom Navigation [but this article is member preview in medium then you handle about yourself for read it in more than your quota with free member preview]
  93. Bonus!! What’s resource for study about Material Design
  94. At first you open Material Design Official website
  95. For Android Kotlin Developer, this is codelab for tutorial to use Material Components
  96. If you want to understand implementation with Material Components, you can read Material Components for Android in github
  97. And you can study this free course in udacity. This course name is Material Design for Android Developers by Google.
  98. Thank you everyone for coming and listen me in this session.