Fixing drag outline location on phone-sized UI (bug 4174465)

Change-Id: If1cf60f60fe2cf17704ff330fdbc076ae6e944f5
This commit is contained in:
Adam Cohen committed 2011-03-25 19:25:11 -07:00
1 parent c2e26a028d
commit 99e8b40b37
1 file changed
+8 -6
+8 -6
View File
@@ -956,13 +956,15 @@ public class CellLayout extends ViewGroup {
int top = topLeft[1];
if (v != null) {
if (v.getParent() instanceof CellLayout) {
LayoutParams lp = (LayoutParams) v.getLayoutParams();
left += lp.leftMargin;
top += lp.topMargin;
}
// When drawing the drag outline, it did not account for margin offsets
// added by the view's parent.
MarginLayoutParams lp = (MarginLayoutParams) v.getLayoutParams();
left += lp.leftMargin;
top += lp.topMargin;
// Offsets due to the size difference between the View and the dragOutline
// Offsets due to the size difference between the View and the dragOutline.
// There is a size difference to account for the outer blur, which may lie
// outside the bounds of the view.
left += (v.getWidth() - dragOutline.getWidth()) / 2;
top += (v.getHeight() - dragOutline.getHeight()) / 2;
}