Skip to content

Commit

Permalink
Merge pull request #90 from nextcloud/bugfix/noid/toolbarTrailingIcon…
Browse files Browse the repository at this point in the history
…Tinting

Fix toolbar trailing icon tinting
  • Loading branch information
AndyScherzinger authored Mar 17, 2023
2 parents 8fd9345 + dd05184 commit efa217f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class AndroidViewThemeUtils @Inject constructor(schemes: MaterialSchemes, privat

fun colorToolbarMenuIcon(context: Context, item: MenuItem) {
withScheme(context) { scheme ->
colorMenuItemIcon(scheme.onSurface, item)
colorMenuItemIcon(scheme.onSurfaceVariant, item)
}
}

Expand All @@ -144,10 +144,7 @@ class AndroidViewThemeUtils @Inject constructor(schemes: MaterialSchemes, privat
}

private fun colorMenuItemIcon(@ColorInt color: Int, item: MenuItem) {
val normalDrawable = item.icon
val wrapDrawable = DrawableCompat.wrap(normalDrawable)
DrawableCompat.setTint(wrapDrawable, color)
item.icon = wrapDrawable
item.icon.setTint(color)
}

private fun colorMenuItemText(@ColorInt color: Int, item: MenuItem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class MaterialViewThemeUtils @Inject constructor(schemes: MaterialSchemes, priva
ViewThemeUtilsBase(schemes) {
fun colorToolbarOverflowIcon(toolbar: MaterialToolbar) {
withScheme(toolbar) { scheme ->
toolbar.overflowIcon?.setColorFilter(scheme.onSurface, PorterDuff.Mode.SRC_ATOP)
toolbar.overflowIcon?.setColorFilter(scheme.onSurfaceVariant, PorterDuff.Mode.SRC_ATOP)
}
}

Expand Down

0 comments on commit efa217f

Please sign in to comment.