mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
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
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user