Load all vector drawables with AppCompat for consistency (#4411)

Currently some vector drawables are loaded using the AppCompat library
and others are loaded using the framework.

This pull request uniformizes this to use AppCompat to load them all.

Other changes:
- Set all compound drawables using relative positioning, since all XML
layouts are also using relative positioning.
- Remove unnecessary layer list drawable used to center
`R.drawable.ic_play_indicator` icon and use
`ImageView.setForegroundGravity()` instead.
- Merge layers in toolbar icons `ic_arrow_back_with_background` and
`ic_more_with_background` into a single vector drawable. Note that the
AppCompat implementation of vector drawables is unable to load vector
drawables inside layer-list drawables, so this change also makes these
images compatible with older Android versions.

**Note**: technically, AppCompat will always delegate to the framework
to load vector drawables on API 24+ which is the current minSDK version
of the app. But at least this gives the option to lower the minSDK
version in the future.
This commit is contained in:
Christophe Beyls 2024-05-13 19:11:49 +02:00 committed by GitHub
commit 973ebd236c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 72 additions and 99 deletions

View file

@ -243,7 +243,7 @@ class StatusViewHelper(private val itemView: View) {
// Set the icon next to the label.
val drawableId = getLabelIcon(attachments[0].type)
mediaLabel.setCompoundDrawablesWithIntrinsicBounds(drawableId, 0, 0, 0)
mediaLabel.setCompoundDrawablesRelativeWithIntrinsicBounds(drawableId, 0, 0, 0)
mediaLabel.setOnClickListener { listener.onViewMedia(null, 0) }
}