summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/DragLayer.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2014-04-07 14:11:48 -0700
committerAdam Cohen <adamcohen@google.com>2014-04-07 14:12:54 -0700
commit2d783ce2f4b2e507bead0d723f0edcdf902dbd46 (patch)
tree2feff1ac0630f7b986cc2ace9691a395a383d01d /src/com/android/launcher3/DragLayer.java
parentd3a4e420f80939a9ea5d415b639bbde94ea4260c (diff)
downloadandroid_packages_apps_Trebuchet-2d783ce2f4b2e507bead0d723f0edcdf902dbd46.tar.gz
android_packages_apps_Trebuchet-2d783ce2f4b2e507bead0d723f0edcdf902dbd46.tar.bz2
android_packages_apps_Trebuchet-2d783ce2f4b2e507bead0d723f0edcdf902dbd46.zip
Fix pre sdk-18 compatibility (crash in dispatchDraw)
issue 13801679 Change-Id: I25b997179fd8eb7cdec6fc48d81533fb1c3094ce
Diffstat (limited to 'src/com/android/launcher3/DragLayer.java')
-rw-r--r--src/com/android/launcher3/DragLayer.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java
index bbf8c8c10..cd51c96e1 100644
--- a/src/com/android/launcher3/DragLayer.java
+++ b/src/com/android/launcher3/DragLayer.java
@@ -75,6 +75,7 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
private View mOverlayView;
private int mTopViewIndex;
+ private int mChildCountOnLastUpdate = -1;
/**
* Used to create a new DragLayer from XML.
@@ -736,13 +737,7 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
mDropAnim.cancel();
}
if (mDropView != null) {
- final DragView dropView = mDropView;
- post(new Runnable() {
- @Override
- public void run() {
- mDragController.onDeferredEndDrag(dropView);
- }
- });
+ mDragController.onDeferredEndDrag(mDropView);
}
mDropView = null;
invalidate();
@@ -802,10 +797,19 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
mTopViewIndex = i;
}
}
+ mChildCountOnLastUpdate = childCount;
}
@Override
protected int getChildDrawingOrder(int childCount, int i) {
+ if (mChildCountOnLastUpdate != childCount) {
+ // between platform versions 17 and 18, behavior for onChildViewRemoved / Added changed.
+ // Pre-18, the child was not added / removed by the time of those callbacks. We need to
+ // force update our representation of things here to avoid crashing on pre-18 devices
+ // in certain instances.
+ updateChildIndices();
+ }
+
// i represents the current draw iteration
if (mTopViewIndex == -1) {
// in general we do nothing