[TIMOB-28086] Android: Update "Toolbar" to support material theme
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2021-03-05T15:57:21.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 10.0.0 |
| Components | Android |
| Labels | 2020-Q4, android, breaking-change, material-theme, theme, toolbar |
| Reporter | Joshua Quick |
| Assignee | Joshua Quick |
| Created | 2020-08-17T23:21:48.000+0000 |
| Updated | 2021-03-05T15:57:21.000+0000 |
Description
*Summary:*
Our [Ti.UI.Toolbar](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Toolbar) is currently using the Java [androidx.appcompat.widget.Toolbar](https://developer.android.com/reference/androidx/appcompat/widget/Toolbar) class. It should be updated to use the newer [MaterialToolbar](https://developer.android.com/reference/com/google/android/material/appbar/MaterialToolbar) class. The newer class supports the material theme.
In the future, it can also be used by an [AppBarLayout](https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout) as described by ticket [TIMOB-26825] which allows the top to be hidden within a
ScrollView while scrolling.
*To-Do:*
We must replace our usage below...
* [TiToolbar.java](https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiToolbar.java)
* [titanium_ui_drawer_layout.xml](https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/res/layout/titanium_ui_drawer_layout.xml)
* [titanium_ui_toolbar.xml](https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/res/layout/titanium_ui_toolbar.xml)
*Breaking-Change:*
The app must use a "Theme.MaterialComponents" based theme or else an exception will occur. So, app's using a custom theme based from "Theme.AppCompat" or similar will crash. This is normal and the exception will state that the theme will need to change.
PR (master): https://github.com/appcelerator/titanium_mobile/pull/12353
FR Passed, waiting on Jenkins build and backport
merged to master and 10_0_X for 10.0.0 release target.