Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5056721 authored by Oli Lan's avatar Oli Lan
Browse files

Increase default user icon size.

This increases the size of the default user icon to 190dp.

A new method convertToBitmapAtUserIconSize is added to UserIcons to
allow bitmaps of this size to be easily obtained. The existing
method convertToBitmap uses the intrinsic size of the drawable, which
is only 48dp as standard.

Bug: 218838295
Test: visual inspection of user icon for owner and new users
Test: atest UserIconsTest
Change-Id: I5cbf110731f4c944bb1d3af63b5a0fcb5ab50f16
parent 823af0a0
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -46,11 +46,21 @@ public class UserIcons {
     * Converts a given drawable to a bitmap.
     */
    public static Bitmap convertToBitmap(Drawable icon) {
        return convertToBitmapAtSize(icon, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
    }

    /**
     * Converts a given drawable to a bitmap, with width and height equal to the default icon size.
     */
    public static Bitmap convertToBitmapAtUserIconSize(Resources res, Drawable icon) {
        int size = res.getDimensionPixelSize(R.dimen.user_icon_size);
        return convertToBitmapAtSize(icon, size, size);
    }

    private static Bitmap convertToBitmapAtSize(Drawable icon, int width, int height) {
        if (icon == null) {
            return null;
        }
        final int width = icon.getIntrinsicWidth();
        final int height = icon.getIntrinsicHeight();
        Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        icon.setBounds(0, 0, width, height);
+3 −0
Original line number Diff line number Diff line
@@ -991,4 +991,7 @@
    <dimen name="secondary_rounded_corner_radius_adjustment">0px</dimen>
    <dimen name="secondary_rounded_corner_radius_top_adjustment">0px</dimen>
    <dimen name="secondary_rounded_corner_radius_bottom_adjustment">0px</dimen>

    <!-- Default size for user icons (a.k.a. avatar images) -->
    <dimen name="user_icon_size">190dp</dimen>
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -541,6 +541,7 @@
  <java-symbol type="dimen" name="immersive_mode_cling_width" />
  <java-symbol type="dimen" name="accessibility_magnification_indicator_width" />
  <java-symbol type="dimen" name="circular_display_mask_thickness" />
  <java-symbol type="dimen" name="user_icon_size" />

  <java-symbol type="string" name="add_account_button_label" />
  <java-symbol type="string" name="addToDictionary" />
+0 −2
Original line number Diff line number Diff line
@@ -22,8 +22,6 @@
    <!-- The translation for disappearing security views after having solved them. -->
    <dimen name="disappear_y_translation">-32dp</dimen>

    <dimen name="circle_avatar_size">190dp</dimen>

    <!-- Height of a user icon view -->
    <dimen name="user_icon_view_height">24dp</dimen>
    <!-- User spinner -->
+1 −1
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ public class Utils {
     * Returns a circular icon for a user.
     */
    public static Drawable getUserIcon(Context context, UserManager um, UserInfo user) {
        final int iconSize = UserIconDrawable.getSizeForList(context);
        final int iconSize = UserIconDrawable.getDefaultSize(context);
        if (user.isManagedProfile()) {
            Drawable drawable = UserIconDrawable.getManagedUserDrawable(context);
            drawable.setBounds(0, 0, iconSize, iconSize);
Loading