summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/DragLayer.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2014-03-13 17:03:22 -0700
committerAdam Cohen <adamcohen@google.com>2014-03-20 11:48:22 -0700
commit432609a246819f3cf887a80c2ae56b61fc5ca25a (patch)
tree793ccc3e52d163fa09740082936422bc7b26e19b /src/com/android/launcher3/DragLayer.java
parente769d1681e1177b9e37c0be9e12d1ede55d4e3a9 (diff)
downloadandroid_packages_apps_Trebuchet-432609a246819f3cf887a80c2ae56b61fc5ca25a.tar.gz
android_packages_apps_Trebuchet-432609a246819f3cf887a80c2ae56b61fc5ca25a.tar.bz2
android_packages_apps_Trebuchet-432609a246819f3cf887a80c2ae56b61fc5ca25a.zip
Adding in-activity intro screen (issue 12905636)
Change-Id: Ifb016ca6e5052fd91535b98a39f78569200955a8
Diffstat (limited to 'src/com/android/launcher3/DragLayer.java')
-rw-r--r--src/com/android/launcher3/DragLayer.java42
1 files changed, 32 insertions, 10 deletions
diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java
index 862ceca28..7ccbe6b55 100644
--- a/src/com/android/launcher3/DragLayer.java
+++ b/src/com/android/launcher3/DragLayer.java
@@ -73,7 +73,8 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
private final Rect mInsets = new Rect();
- private int mDragViewIndex;
+ private View mOverlayView;
+ private int mTopViewIndex;
/**
* Used to create a new DragLayer from XML.
@@ -120,6 +121,16 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
setInsets(child, mInsets, new Rect());
}
+ public void showOverlayView(View introScreen) {
+ LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
+ mOverlayView = introScreen;
+ addView(introScreen, lp);
+ }
+
+ public void dismissOverlayView() {
+ removeView(mOverlayView);
+ }
+
private void setInsets(View child, Rect newInsets, Rect oldInsets) {
final FrameLayout.LayoutParams flp = (FrameLayout.LayoutParams) child.getLayoutParams();
if (child instanceof Insettable) {
@@ -770,27 +781,38 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
updateChildIndices();
}
+ @Override
+ public void bringChildToFront(View child) {
+ super.bringChildToFront(child);
+ updateChildIndices();
+ }
+
private void updateChildIndices() {
- mDragViewIndex = -1;
+ mTopViewIndex = -1;
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
- if (getChildAt(i) instanceof DragView) {
- mDragViewIndex = i;
+ if (getChildAt(i) instanceof DragView ||
+ getChildAt(i) == mOverlayView) {
+ mTopViewIndex = i;
}
}
}
@Override
protected int getChildDrawingOrder(int childCount, int i) {
- if (mDragViewIndex == -1) {
+ // i represents the current draw iteration
+ if (mTopViewIndex == -1) {
+ // in general we do nothing
return i;
- } else if (i == mDragViewIndex) {
- return getChildCount()-1;
- } else if (i < mDragViewIndex) {
+ } else if (i == childCount - 1) {
+ // if we have a top index, we return it when drawing last item (highest z-order)
+ return mTopViewIndex;
+ } else if (i < mTopViewIndex) {
return i;
} else {
- // i > mDragViewIndex
- return i-1;
+ // for indexes greater than the top index, we fetch one item above to shift for the
+ // displacement of the top index
+ return i + 1;
}
}