[TIMOB-28300] Android: Add material "chip" style to Ti.UI.Switch
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2021-03-05T15:57:06.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 10.0.0 |
Components | Android |
Labels | android, material-design, material-theme, style, switch |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2020-12-19T04:28:18.000+0000 |
Updated | 2021-03-05T15:57:06.000+0000 |
Description
*Summary:*
Google supports a material "Chip" widget which is checkable. Our
Ti.UI.Switch
view should offer this as a style.
https://material.io/components/chips
*To-Do:*
Update our [style](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Switch-property-style) property to support the following Android-only constant.
* Ti.UI.SWITCH_STYLE_CHIP
This can be implemented via the Java [Chip](https://developer.android.com/reference/com/google/android/material/chip/Chip) class.
*Test Code:*
Each switch style can be tested with the attached [^SwitchStyleTest.js], which will display what's shown below.
!Switch-Android-Light.png|thumbnail! !Switch-Android-Dark.png|thumbnail!
*Note:*
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.
Attachments
File | Date | Size |
---|---|---|
Switch-Android-Dark.png | 2021-02-23T02:50:55.000+0000 | 417430 |
Switch-Android-Light.png | 2021-02-23T02:50:55.000+0000 | 419866 |
SwitchStyleTest.js | 2021-02-23T02:50:22.000+0000 | 1171 |
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.