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

Commit 3cd82250 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Simplifying icon normalization for adaptive icons

Bug: 366237794
Flag: EXEMPT refactor
Test: PResubmit and screenshot tests
Change-Id: I39fa4a744686544e2b6769bca6f481179a3007aa
parent 57e30ba1
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.wm.shell.bubbles;

import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR;

import android.annotation.DrawableRes;
import android.annotation.Nullable;
import android.content.Context;
@@ -35,7 +37,6 @@ import android.widget.ImageView;
import androidx.constraintlayout.widget.ConstraintLayout;

import com.android.launcher3.icons.DotRenderer;
import com.android.launcher3.icons.IconNormalizer;
import com.android.wm.shell.R;
import com.android.wm.shell.shared.animation.Interpolators;

@@ -132,7 +133,7 @@ public class BadgedImageView extends ConstraintLayout {

    private void getOutline(Outline outline) {
        final int bubbleSize = mPositioner.getBubbleSize();
        final int normalizedSize = IconNormalizer.getNormalizedCircleSize(bubbleSize);
        final int normalizedSize = Math.round(ICON_VISIBLE_AREA_FACTOR * bubbleSize);
        final int inset = (bubbleSize - normalizedSize) / 2;
        outline.setOval(inset, inset, inset + normalizedSize, inset + normalizedSize);
    }
+2 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.wm.shell.bubbles;

import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR;
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BUBBLES;

import android.content.Context;
@@ -31,7 +32,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;

import com.android.internal.protolog.ProtoLog;
import com.android.launcher3.icons.IconNormalizer;
import com.android.wm.shell.Flags;
import com.android.wm.shell.R;
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
@@ -557,8 +557,7 @@ public class BubblePositioner implements BubbleDropTargetBoundsProvider {
    public float getPointerPosition(float bubblePosition) {
        // TODO: I don't understand why it works but it does - why normalized in portrait
        //  & not in landscape? Am I missing ~2dp in the portrait expandedViewY calculation?
        final float normalizedSize = IconNormalizer.getNormalizedCircleSize(
                getBubbleSize());
        final float normalizedSize = Math.round(ICON_VISIBLE_AREA_FACTOR * getBubbleSize());
        return showBubblesVertically()
                ? bubblePosition + (getBubbleSize() / 2f)
                : bubblePosition + (normalizedSize / 2f) - mPointerWidth;