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

Commit 6f737783 authored by Yorke Lee's avatar Yorke Lee Committed by Android (Google) Code Review
Browse files

Merge changes I696bddf2,I4f62d509 into mnc-dev

* changes:
  Fix issue with misaligned glowpad handle
  Cache the non-rounded large bitmap instead of the rounded version
parents 27352bd8 58d7f084
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,

        // Check if data has changed; if nothing is different, don't issue another notification.
        final int iconResId = getIconToDisplay(call);
        final Bitmap largeIcon = getLargeIconToDisplay(contactInfo, call);
        Bitmap largeIcon = getLargeIconToDisplay(contactInfo, call);
        final int contentResId = getContentString(call);
        final String contentTitle = getContentTitle(contactInfo, call);

@@ -205,6 +205,10 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
            return;
        }

        if (largeIcon != null) {
            largeIcon = getRoundedIcon(largeIcon);
        }

        /*
         * Nothing more to check...build and send it.
         */
@@ -352,15 +356,18 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
        if (contactInfo.photo != null && (contactInfo.photo instanceof BitmapDrawable)) {
            largeIcon = ((BitmapDrawable) contactInfo.photo).getBitmap();
        }
        return largeIcon;
    }

        if (largeIcon != null) {
    private Bitmap getRoundedIcon(Bitmap bitmap) {
        if (bitmap == null) {
            return null;
        }
        final int height = (int) mContext.getResources().getDimension(
                android.R.dimen.notification_large_icon_height);
        final int width = (int) mContext.getResources().getDimension(
                android.R.dimen.notification_large_icon_width);
            largeIcon = BitmapUtil.getRoundedBitmap(largeIcon, width, height);
        }
        return largeIcon;
        return BitmapUtil.getRoundedBitmap(bitmap, width, height);
    }

    /**
+6 −2
Original line number Diff line number Diff line
@@ -637,11 +637,15 @@ public class GlowPadView extends View {
    }

    /**
     * Sets teh handle drawable to the drawable specified by the resource ID.
     * Sets the handle drawable to the drawable specified by the resource ID.
     * @param resourceId
     */
    public void setHandleDrawable(int resourceId) {
        mHandleDrawable = new TargetDrawable(getResources(), resourceId, 2);
        if (mHandleDrawable != null) {
            mHandleDrawable.setDrawable(getResources(), resourceId);
        } else {
            mHandleDrawable = new TargetDrawable(getResources(), resourceId, 1);
        }
        mHandleDrawable.setState(TargetDrawable.STATE_INACTIVE);
    }