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

Commit e96e4e09 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Simplifying icon normalization for adaptive icons" into main

parents 30ca69ca 3cd82250
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -15,6 +15,8 @@
 */
 */
package com.android.wm.shell.bubbles;
package com.android.wm.shell.bubbles;


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

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


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


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


    private void getOutline(Outline outline) {
    private void getOutline(Outline outline) {
        final int bubbleSize = mPositioner.getBubbleSize();
        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;
        final int inset = (bubbleSize - normalizedSize) / 2;
        outline.setOval(inset, inset, inset + normalizedSize, inset + normalizedSize);
        outline.setOval(inset, inset, inset + normalizedSize, inset + normalizedSize);
    }
    }
+2 −3
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.wm.shell.bubbles;
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 static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BUBBLES;


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


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