Size restrict right notification icon size

Right now the right notification icon is always loaded at full resolution. This will downsample the icon to displayed size if the user passes a bitmap that's large.

Bug:218845090
Bug:210690571

Test: Manually on device
Change-Id: Ib66933a8fe92765e069f1571ded990b37f82b05f
This commit is contained in:
Jernej Virag
2022-02-14 16:17:40 +00:00
parent 104e6492b2
commit 83ff9db668
3 changed files with 10 additions and 2 deletions

View File

@@ -49,6 +49,8 @@
android:layout_marginStart="@dimen/notification_icon_circle_start"
android:background="@drawable/notification_icon_circle"
android:padding="@dimen/notification_icon_circle_padding"
android:maxDrawableWidth="@dimen/notification_icon_circle_size"
android:maxDrawableHeight="@dimen/notification_icon_circle_size"
/>
<!-- extends ViewGroup -->

View File

@@ -45,6 +45,8 @@
android:layout_marginStart="@dimen/notification_icon_circle_start"
android:background="@drawable/notification_icon_circle"
android:padding="@dimen/notification_icon_circle_padding"
android:maxDrawableWidth="@dimen/notification_icon_circle_size"
android:maxDrawableHeight="@dimen/notification_icon_circle_size"
/>
<FrameLayout
@@ -136,7 +138,7 @@
</LinearLayout>
<ImageView
<com.android.internal.widget.CachingIconView
android:id="@+id/right_icon"
android:layout_width="@dimen/notification_right_icon_size"
android:layout_height="@dimen/notification_right_icon_size"
@@ -148,6 +150,8 @@
android:clipToOutline="true"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:maxDrawableWidth="@dimen/notification_right_icon_size"
android:maxDrawableHeight="@dimen/notification_right_icon_size"
/>
<FrameLayout

View File

@@ -13,7 +13,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
<ImageView
<com.android.internal.widget.CachingIconView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/right_icon"
android:layout_width="@dimen/notification_right_icon_size"
@@ -25,4 +25,6 @@
android:clipToOutline="true"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:maxDrawableWidth="@dimen/notification_right_icon_size"
android:maxDrawableHeight="@dimen/notification_right_icon_size"
/>