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

Commit 452df2d5 authored by Pierre Barbier de Reuille's avatar Pierre Barbier de Reuille
Browse files

Update the resize frame to use the forced radius.

When forcing the rounded corners, the radius may be smaller than the
default one. When this happens, we should change how the frame is drawn
to only use that reduced radius, or this looks weird.

Bug: 183097166
Test: Manual tests with top 1P App Widgets
Change-Id: I6ce232515ce14059e1168e16735719ea2370132c
parent 298526e8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@

        <!-- Frame -->
        <ImageView
            android:id="@+id/widget_resize_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
+12 −0
Original line number Diff line number Diff line
@@ -14,12 +14,15 @@ import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.SizeF;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.Nullable;

@@ -166,6 +169,15 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
        DragLayer dl = launcher.getDragLayer();
        AppWidgetResizeFrame frame = (AppWidgetResizeFrame) launcher.getLayoutInflater()
                .inflate(R.layout.app_widget_resize_frame, dl, false);
        if (widget.hasEnforcedCornerRadius()) {
            float enforcedCornerRadius = widget.getEnforcedCornerRadius();
            ImageView imageView = frame.findViewById(R.id.widget_resize_frame);
            Drawable d = imageView.getDrawable();
            if (d instanceof GradientDrawable) {
                GradientDrawable gd = (GradientDrawable) d.mutate();
                gd.setCornerRadius(enforcedCornerRadius);
            }
        }
        frame.setupForWidget(widget, cellLayout, dl);
        ((DragLayer.LayoutParams) frame.getLayoutParams()).customPosition = true;

+1 −0
Original line number Diff line number Diff line
@@ -522,4 +522,5 @@ public class LauncherAppWidgetHostView extends NavigableAppWidgetHostView
    public boolean hasEnforcedCornerRadius() {
        return getClipToOutline();
    }

}