summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/dragndrop
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-09-13 21:07:31 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-10-07 15:16:29 -0700
commit08ca40f97670ad56ea01a81a439e89a484f9fdb5 (patch)
tree6269ea3d7684c3140d4f1ef3650aca18469f14e3 /src/com/android/launcher3/dragndrop
parent5fe414f9a425d9d7c2d5010fa476bc9faf440aed (diff)
downloadandroid_packages_apps_Trebuchet-08ca40f97670ad56ea01a81a439e89a484f9fdb5.tar.gz
android_packages_apps_Trebuchet-08ca40f97670ad56ea01a81a439e89a484f9fdb5.tar.bz2
android_packages_apps_Trebuchet-08ca40f97670ad56ea01a81a439e89a484f9fdb5.zip
Refactoring AppWidgetResizeFrame
> Defining the layout in xml > Simplifying the touch handling calculations Change-Id: Iccfd82161d1e678d77ad6ff63f76e04ad905f9d8
Diffstat (limited to 'src/com/android/launcher3/dragndrop')
-rw-r--r--src/com/android/launcher3/dragndrop/DragLayer.java11
1 files changed, 6 insertions, 5 deletions
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);
}