From 08ca40f97670ad56ea01a81a439e89a484f9fdb5 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Tue, 13 Sep 2016 21:07:31 -0700 Subject: Refactoring AppWidgetResizeFrame > Defining the layout in xml > Simplifying the touch handling calculations Change-Id: Iccfd82161d1e678d77ad6ff63f76e04ad905f9d8 --- src/com/android/launcher3/dragndrop/DragLayer.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/com/android/launcher3/dragndrop') diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java index ef9c9652d..1bbbd4615 100644 --- a/src/com/android/launcher3/dragndrop/DragLayer.java +++ b/src/com/android/launcher3/dragndrop/DragLayer.java @@ -38,6 +38,7 @@ import android.os.Build; import android.util.AttributeSet; import android.view.DragEvent; import android.view.KeyEvent; +import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; @@ -621,12 +622,12 @@ public class DragLayer extends InsettableFrameLayout { public void addResizeFrame(LauncherAppWidgetHostView widget, CellLayout cellLayout) { clearResizeFrame(); - mCurrentResizeFrame = new AppWidgetResizeFrame(getContext(), widget, cellLayout, this); + mCurrentResizeFrame = (AppWidgetResizeFrame) LayoutInflater.from(mLauncher) + .inflate(R.layout.app_widget_resize_frame, this, false); + mCurrentResizeFrame.setupForWidget(widget, cellLayout, this); + ((LayoutParams) mCurrentResizeFrame.getLayoutParams()).customPosition = true; - LayoutParams lp = new LayoutParams(-1, -1); - lp.customPosition = true; - - addView(mCurrentResizeFrame, lp); + addView(mCurrentResizeFrame); mCurrentResizeFrame.snapToWidget(false); } -- cgit v1.2.3