summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2014-10-28 23:16:02 (GMT)
committerDanesh M <daneshm90@gmail.com>2015-09-28 01:59:32 (GMT)
commit5b2b779ecf53f54da396672ac50ddfbf2e1f97b4 (patch)
tree2587cb3e12d5c2928a8efb511b83093238fa7d2f
parent8d43f06829523a920904c958e6545648b0b0c200 (diff)
downloadandroid_packages_apps_Trebuchet-5b2b779ecf53f54da396672ac50ddfbf2e1f97b4.zip
android_packages_apps_Trebuchet-5b2b779ecf53f54da396672ac50ddfbf2e1f97b4.tar.gz
android_packages_apps_Trebuchet-5b2b779ecf53f54da396672ac50ddfbf2e1f97b4.tar.bz2
Make sure DragLayer layout params are of the correct type
bug 18141419 Change-Id: I50695a62cf9e1f25c054ac2c7197cd056d54cfae
-rw-r--r--src/com/android/launcher3/DragLayer.java36
-rw-r--r--src/com/android/launcher3/InsettableFrameLayout.java2
2 files changed, 33 insertions, 5 deletions
diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java
index 156df7d..a93a9e3 100644
--- a/src/com/android/launcher3/DragLayer.java
+++ b/src/com/android/launcher3/DragLayer.java
@@ -39,6 +39,8 @@ import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
+import com.android.launcher3.InsettableFrameLayout.LayoutParams;
+
import java.util.ArrayList;
/**
@@ -418,17 +420,43 @@ public class DragLayer extends InsettableFrameLayout {
return mDragController.dispatchUnhandledMove(focused, direction);
}
- public static class LayoutParams extends FrameLayout.LayoutParams {
+ @Override
+ public LayoutParams generateLayoutParams(AttributeSet attrs) {
+ return new LayoutParams(getContext(), attrs);
+ }
+
+ @Override
+ protected LayoutParams generateDefaultLayoutParams() {
+ return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+ }
+
+ // Override to allow type-checking of LayoutParams.
+ @Override
+ protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
+ return p instanceof LayoutParams;
+ }
+
+ @Override
+ protected LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
+ return new LayoutParams(p);
+ }
+
+ public static class LayoutParams extends InsettableFrameLayout.LayoutParams {
public int x, y;
public boolean customPosition = false;
- /**
- * {@inheritDoc}
- */
+ public LayoutParams(Context c, AttributeSet attrs) {
+ super(c, attrs);
+ }
+
public LayoutParams(int width, int height) {
super(width, height);
}
+ public LayoutParams(ViewGroup.LayoutParams lp) {
+ super(lp);
+ }
+
public void setWidth(int width) {
this.width = width;
}
diff --git a/src/com/android/launcher3/InsettableFrameLayout.java b/src/com/android/launcher3/InsettableFrameLayout.java
index 1c3d5a1..7343bf6 100644
--- a/src/com/android/launcher3/InsettableFrameLayout.java
+++ b/src/com/android/launcher3/InsettableFrameLayout.java
@@ -63,7 +63,7 @@ public class InsettableFrameLayout extends FrameLayout implements
return new LayoutParams(p);
}
- class LayoutParams extends FrameLayout.LayoutParams {
+ public static class LayoutParams extends FrameLayout.LayoutParams {
boolean ignoreInsets = false;
public LayoutParams(Context c, AttributeSet attrs) {