-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
How to use GitHub
- Please use the 👍 reaction to show that you are interested into the same feature.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Currently, our application uses a mix of UI elements for icon buttons:
Some places use ImageView to represent clickable icons. This is inconsistent and not semantically correct, since ImageView is not a button.
Some places use MaterialButton with the default M3 icon button style (@style/Widget.Material3.Button.IconButton).
Other places use a custom style (Widget.AppTheme.Button.IconButton) that extends from Widget.Material3.Button.TextButton with custom paddings and icon configurations.
Default M3 IconButton colors (from @style/Widget.Material3.Button.IconButton) are defined via a color selector:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Disabled state -->
<item android:color="?attr/colorOnSurface" android:alpha="@dimen/material_emphasis_disabled" android:state_enabled="false"/>
<!-- Checkable, unchecked state -->
<item android:color="?attr/colorOnContainerUnchecked" android:state_checkable="true" android:state_checked="false"/>
<!-- Default, enabled state -->
<item android:color="?attr/colorOnContainer"/>
</selector>
The custom Widget.AppTheme.Button.IconButton currently extends TextButton and overrides:
<style name="Widget.AppTheme.Button.IconButton" parent="Widget.Material3.Button.TextButton">
<item name="android:minWidth">0dp</item>
<item name="android:insetLeft">0dp</item>
<item name="android:insetTop">0dp</item>
<item name="android:insetRight">0dp</item>
<item name="android:insetBottom">0dp</item>
<item name="iconGravity">textStart</item>
<item name="iconPadding">0dp</item>
</style>
The default icon color (colorOnContainer) may not align with our expectation. For example:
Things to decide
-
Continue using our custom Widget.AppTheme.Button.IconButton (with modified paddings) or switch to the default M3 IconButton style? Note: M3 IconButton also extends from TextButton.
-
Currently, default (
Material3.Button.IconButton) icons use colorOnContainer. Do we want to change the default icon color? -
Should all icon buttons implemented with ImageView be replaced with MaterialButton using the appropriate icon button style?
-
When a user performs an action (e.g., sharing a file), we want the icon to stand out. Since default icon color is
colorOnContainerand it's branding color in that case how should we differentiate the default icon color from the action-taken state in a file list?