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

Commit 75fe6596 authored by Kshitij's avatar Kshitij
Browse files

fix: Properly handle tablet notification icons [1/2]

parent 5821c16a
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -127,6 +127,11 @@ public class DotRenderer {
    }

    public void draw(Canvas canvas, DrawParams params, int numNotifications) {
        draw(canvas, params, numNotifications, false, false);
    }

    public void draw(Canvas canvas, DrawParams params, int numNotifications,
                     boolean isTablet, boolean isTaskbar) {
        if (params == null) {
            Log.e(TAG, "Invalid null argument(s) passed in call to draw.");
            return;
@@ -146,8 +151,8 @@ public class DotRenderer {
        float offsetY = Math.max(0, canvasBounds.top - (dotCenterY + mBitmapOffset));

        // We draw the dot relative to its center.
        float dx = dotCenterX + offsetX;
        float dy = dotCenterY + offsetY - 15f;
        float dx = dotCenterX + offsetX - (isTablet && !isTaskbar ? 15f : 0f);
        float dy = dotCenterY + offsetY - (isTablet ? 20f : 15f);

        if (numNotifications > 9 && numNotifications < 1000) {
            canvas.translate(dx - 17f, dy);
@@ -155,12 +160,13 @@ public class DotRenderer {
            canvas.translate(dx - 12f, dy);
        }

        canvas.scale(params.scale, params.scale);
        float scale = params.scale * (isTablet && !isTaskbar ? 0.75f : 1f);
        canvas.scale(scale, scale);

        mCirclePaint.setColor(params.dotColor);
        mCircleShadowPaint.setColor(params.shadowDotColor);

        if (numNotifications >= 10 && numNotifications < 1000) {
        if (!isTaskbar && numNotifications >= 10 && numNotifications < 1000) {
            canvas.drawRoundRect(new RectF(-mCircleRadius + 10, -mCircleRadius, mCircleRadius + 20, mCircleRadius), 50, 50, mCircleShadowPaint);
            canvas.drawRoundRect(new RectF(-mCircleRadius + 10, -mCircleRadius, mCircleRadius + 20, mCircleRadius), 50, 50, mCirclePaint);
        } else if (numNotifications > 0) {
@@ -168,7 +174,7 @@ public class DotRenderer {
            canvas.drawCircle(5, 10, mCircleRadius, mCirclePaint);
        }

        if (mDisplayCount && numNotifications > 0) {
        if (mDisplayCount && numNotifications > 0 && !isTaskbar) {
            // Draw the numNotifications text
            mTextPaint.setColor(getCounterTextColor(Color.WHITE));
            mTextPaint.setTypeface(Typeface.DEFAULT_BOLD);