summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/DragLayer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/DragLayer.java')
-rw-r--r--src/com/android/launcher3/DragLayer.java68
1 files changed, 3 insertions, 65 deletions
diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java
index 1ded03038..156df7d21 100644
--- a/src/com/android/launcher3/DragLayer.java
+++ b/src/com/android/launcher3/DragLayer.java
@@ -44,7 +44,7 @@ import java.util.ArrayList;
/**
* A ViewGroup that coordinates dragging across its descendants
*/
-public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChangeListener {
+public class DragLayer extends InsettableFrameLayout {
private DragController mDragController;
private int[] mTmpXY = new int[2];
@@ -72,8 +72,6 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
private TouchCompleteListener mTouchCompleteListener;
- private final Rect mInsets = new Rect();
-
private View mOverlayView;
private int mTopViewIndex;
private int mChildCountOnLastUpdate = -1;
@@ -104,7 +102,6 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
// Disable multitouch across the workspace/all apps/customize tray
setMotionEventSplittingEnabled(false);
setChildrenDrawingOrderEnabled(true);
- setOnHierarchyChangeListener(this);
final Resources res = getResources();
mLeftHoverDrawable = res.getDrawable(R.drawable.page_hover_left);
@@ -126,56 +123,9 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
@Override
protected boolean fitSystemWindows(Rect insets) {
- final int n = getChildCount();
- for (int i = 0; i < n; i++) {
- final View child = getChildAt(i);
- if (child.getId() == R.id.overview_panel) {
- LinearLayout layout = (LinearLayout)
- child.findViewById(R.id.settings_container);
- FrameLayout.LayoutParams lp =
- (FrameLayout.LayoutParams) layout.getLayoutParams();
- lp.bottomMargin += insets.bottom - mInsets.bottom;
- layout.setLayoutParams(lp);
- continue;
- } else if (child.getId() == R.id.app_drawer_container) {
- setAppDrawerInsets(child, insets);
-
- continue;
- }
- setInsets(child, insets, mInsets);
- if (child.getId() == R.id.search_drop_target_bar) {
- continue;
- }
- }
- mInsets.set(insets);
- return true; // I'll take it from here
- }
-
- private void setAppDrawerInsets(View child, Rect insets) {
- // List view
- View view = child.findViewById(R.id.app_drawer_recyclerview);
- FrameLayout.LayoutParams lp =
- (FrameLayout.LayoutParams) view.getLayoutParams();
- int paddingBottom = view.getPaddingBottom() + insets.bottom - mInsets.bottom;
- int paddingTop = view.getPaddingTop() + insets.top - mInsets.top;
- view.setLayoutParams(lp);
- view.setPadding(view.getPaddingLeft(), paddingTop, view.getPaddingRight(), paddingBottom);
-
- // Scrubber
- view = child.findViewById(R.id.app_drawer_scrubber_container);
- LinearLayout.LayoutParams llp = (LinearLayout.LayoutParams) view.getLayoutParams();
- llp.bottomMargin += insets.bottom - mInsets.bottom;
- view.setLayoutParams(llp);
- }
- Rect getInsets() {
- return mInsets;
- }
- @Override
- public void addView(View child, int index, android.view.ViewGroup.LayoutParams params) {
- super.addView(child, index, params);
- setInsets(child, mInsets, new Rect());
+ return super.fitSystemWindows(insets);
}
public void showOverlayView(View overlayView) {
@@ -192,19 +142,6 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
removeView(mOverlayView);
}
- private void setInsets(View child, Rect newInsets, Rect oldInsets) {
- final FrameLayout.LayoutParams flp = (FrameLayout.LayoutParams) child.getLayoutParams();
- if (child instanceof Insettable) {
- ((Insettable) child).setInsets(newInsets);
- } else {
- flp.topMargin += (newInsets.top - oldInsets.top);
- flp.leftMargin += (newInsets.left - oldInsets.left);
- flp.rightMargin += (newInsets.right - oldInsets.right);
- flp.bottomMargin += (newInsets.bottom - oldInsets.bottom);
- }
- child.setLayoutParams(flp);
- }
-
private boolean isEventOverFolderTextRegion(Folder folder, MotionEvent ev) {
getDescendantRectRelativeToSelf(folder.getEditTextRegion(), mHitRect);
if (mHitRect.contains((int) ev.getX(), (int) ev.getY())) {
@@ -849,6 +786,7 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
@Override
public void onChildViewAdded(View parent, View child) {
+ super.onChildViewAdded(parent, child);
if (mOverlayView != null) {
// ensure that the overlay view stays on top. we can't use drawing order for this
// because in API level 16 touch dispatch doesn't respect drawing order.