diff --git a/core/res/res/layout-land/keyguard_host_view.xml b/core/res/res/layout-land/keyguard_host_view.xml index 2f6760611412a..6b36235695262 100644 --- a/core/res/res/layout-land/keyguard_host_view.xml +++ b/core/res/res/layout-land/keyguard_host_view.xml @@ -37,7 +37,8 @@ android:id="@+id/keyguard_widget_pager_delete_target" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="top|center_horizontal" /> + android:layout_gravity="top|center_horizontal" + androidprv:layout_childType="pageDeleteDropTarget" /> + android:layout_height="wrap_content" + androidprv:layout_childType="pageDeleteDropTarget"> + android:layout_gravity="top|center_horizontal" + androidprv:layout_childType="pageDeleteDropTarget" /> + + diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java index f20b8d40056db..17946b22f4422 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java @@ -507,14 +507,17 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit return false; } + /** + * Returns the bounded set of pages that are re-orderable. The range is fully inclusive. + */ @Override void boundByReorderablePages(boolean isReordering, int[] range) { if (isReordering) { // Remove non-widget pages from the range - while (range[1] > range[0] && !isWidgetPage(range[1])) { + while (range[1] >= range[0] && !isWidgetPage(range[1])) { range[1]--; } - while (range[0] < range[1] && !isWidgetPage(range[0])) { + while (range[0] <= range[1] && !isWidgetPage(range[0])) { range[0]++; } } diff --git a/policy/src/com/android/internal/policy/impl/keyguard/MultiPaneChallengeLayout.java b/policy/src/com/android/internal/policy/impl/keyguard/MultiPaneChallengeLayout.java index 7b4bd6ec637bf..0e3d93f6b8dc0 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/MultiPaneChallengeLayout.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/MultiPaneChallengeLayout.java @@ -48,6 +48,7 @@ public class MultiPaneChallengeLayout extends ViewGroup implements ChallengeLayo private OnBouncerStateChangedListener mBouncerListener; private final Rect mTempRect = new Rect(); + private final Rect mZeroPadding = new Rect(); private final DisplayMetrics mDisplayMetrics; @@ -187,6 +188,8 @@ public class MultiPaneChallengeLayout extends ViewGroup implements ChallengeLayo // on the window. We want to avoid resizing widgets when possible as it can // be ugly/expensive. This lets us simply clip them instead. return virtualHeight - heightUsed; + } else if (lp.childType == LayoutParams.CHILD_TYPE_PAGE_DELETE_DROP_TARGET) { + return height; } return Math.min(virtualHeight - heightUsed, height); } @@ -330,6 +333,7 @@ public class MultiPaneChallengeLayout extends ViewGroup implements ChallengeLayo final int count = getChildCount(); for (int i = 0; i < count; i++) { final View child = getChildAt(i); + LayoutParams lp = (LayoutParams) child.getLayoutParams(); // We did the user switcher above if we have one. if (child == mUserSwitcherView || child.getVisibility() == GONE) continue; @@ -337,6 +341,9 @@ public class MultiPaneChallengeLayout extends ViewGroup implements ChallengeLayo if (child == mScrimView) { child.layout(0, 0, width, height); continue; + } else if (lp.childType == LayoutParams.CHILD_TYPE_PAGE_DELETE_DROP_TARGET) { + layoutWithGravity(width, height, child, mZeroPadding, false); + continue; } layoutWithGravity(width, height, child, padding, false); @@ -467,6 +474,7 @@ public class MultiPaneChallengeLayout extends ViewGroup implements ChallengeLayo public static final int CHILD_TYPE_CHALLENGE = 2; public static final int CHILD_TYPE_USER_SWITCHER = 3; public static final int CHILD_TYPE_SCRIM = 4; + public static final int CHILD_TYPE_PAGE_DELETE_DROP_TARGET = 7; public int gravity = Gravity.NO_GRAVITY; diff --git a/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java b/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java index 2f25835d79bfe..9cfd78ae516ae 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/PagedView.java @@ -233,6 +233,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc private Matrix mTmpInvMatrix = new Matrix(); private float[] mTmpPoint = new float[2]; private Rect mTmpRect = new Rect(); + private Rect mAltTmpRect = new Rect(); // Fling to delete private int FLING_TO_DELETE_FADE_OUT_DURATION = 350; @@ -2455,7 +2456,13 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc /* Drag to delete */ private boolean isHoveringOverDeleteDropTarget(int x, int y) { if (mDeleteDropTarget != null) { + mAltTmpRect.set(0, 0, 0, 0); + View parent = (View) mDeleteDropTarget.getParent(); + if (parent != null) { + parent.getGlobalVisibleRect(mAltTmpRect); + } mDeleteDropTarget.getGlobalVisibleRect(mTmpRect); + mTmpRect.offset(-mAltTmpRect.left, -mAltTmpRect.top); return mTmpRect.contains(x, y); } return false;