diff options
| author | 2022-03-16 09:25:55 +0000 | |
|---|---|---|
| committer | 2022-03-21 13:39:24 +0000 | |
| commit | 5943bac5cfc1bb654714bfe0660b8b77df443644 (patch) | |
| tree | fb2c2b0895bfbd59691321e3585179e5219c6428 | |
| parent | 6f2b34baf854be996dde5b7aebe4ae2ec4f53d2f (diff) | |
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: Ie759b99519ad77ee2af75c02b60d5db947808ed7
3 files changed, 10 insertions, 2 deletions
diff --git a/core/res/res/layout/notification_template_header.xml b/core/res/res/layout/notification_template_header.xml index 81a79c50c3ef..a7f2aa7cba69 100644 --- a/core/res/res/layout/notification_template_header.xml +++ b/core/res/res/layout/notification_template_header.xml @@ -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 --> diff --git a/core/res/res/layout/notification_template_material_base.xml b/core/res/res/layout/notification_template_material_base.xml index c6983ae5e045..fd787f6ea470 100644 --- a/core/res/res/layout/notification_template_material_base.xml +++ b/core/res/res/layout/notification_template_material_base.xml @@ -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 diff --git a/core/res/res/layout/notification_template_right_icon.xml b/core/res/res/layout/notification_template_right_icon.xml index f163ed5f955a..8b3b795f7473 100644 --- a/core/res/res/layout/notification_template_right_icon.xml +++ b/core/res/res/layout/notification_template_right_icon.xml @@ -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" /> |