Merge "Bumping icon version to clear db to trigger loading from IconProvider." into ub-launcher3-calgary
diff --git a/src/com/android/launcher3/BaseContainerView.java b/src/com/android/launcher3/BaseContainerView.java
index 84bd88d..45d0b52 100644
--- a/src/com/android/launcher3/BaseContainerView.java
+++ b/src/com/android/launcher3/BaseContainerView.java
@@ -53,7 +53,8 @@
         Launcher launcher = Launcher.getLauncher(context);
         int width = launcher.getDeviceProfile().availableWidthPx;
         if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP &&
-                this instanceof AllAppsContainerView && !launcher.getDeviceProfile().isLandscape) {
+                this instanceof AllAppsContainerView &&
+                !launcher.getDeviceProfile().isVerticalBarLayout()) {
             mHorizontalPadding = 0;
         } else {
             mHorizontalPadding = DeviceProfile.getContainerPadding(context, width);
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index 5245509..b2f24be 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -227,4 +227,8 @@
             setBackground(mBackground);
         }
     }
+
+    public int getBackgroundDrawableAlpha() {
+        return Color.alpha(mBackgroundColor);
+    }
 }
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 5ac3f0b..2d3e8dd 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -321,7 +321,7 @@
         return (getMeasuredHeight() - getViewportHeight()) / 2;
     }
 
-    PageIndicator getPageIndicator() {
+    public PageIndicator getPageIndicator() {
         return mPageIndicator;
     }
 
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index d1da6d9..e67c9df 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -459,6 +459,20 @@
         lp.leftMargin = bgPadding.left;
         lp.rightMargin = bgPadding.right;
 
+
+        // Clip the view to the left and right edge of the background to
+        // to prevent shadows from rendering beyond the edges
+        final Rect newClipBounds = new Rect(
+                bgPadding.left,
+                0,
+                getWidth() - bgPadding.right,
+                getHeight()
+        );
+        setClipBounds(newClipBounds);
+
+        // Allow the overscroll effect to reach the edges of the view
+        mAppsRecyclerView.setClipToPadding(false);
+
         DeviceProfile grid = mLauncher.getDeviceProfile();
         if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
             if (!grid.isVerticalBarLayout()) {
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 3157c13..4e4e87c 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -137,7 +137,9 @@
                     return true;
                 }
             } else {
-                if (mLauncher.getDragLayer().isEventOverHotseat(ev) && !grid.isVerticalBarLayout()) {
+                if ((mLauncher.getDragLayer().isEventOverHotseat(ev)
+                        || mLauncher.getDragLayer().isEventOverPageIndicator(ev))
+                        && !grid.isVerticalBarLayout()) {
                     return true;
                 }
             }
@@ -239,7 +241,7 @@
             if (!mLauncher.isAllAppsVisible()) {
                 mLauncher.tryAndUpdatePredictedApps();
 
-                mHotseatBackgroundAlpha = mHotseat.getBackground().getAlpha() / 255f;
+                mHotseatBackgroundAlpha = mHotseat.getBackgroundDrawableAlpha() / 255f;
                 mHotseat.setBackgroundTransparent(true /* transparent */);
                 mAppsView.setVisibility(View.VISIBLE);
                 mAppsView.getContentView().setVisibility(View.VISIBLE);
@@ -270,18 +272,26 @@
 
     private void updateLightStatusBar(float progress) {
         boolean enable = (progress < mStatusBarHeight / 2);
+        // Do not modify status bar on landscape as all apps is not full bleed.
+        if (mLauncher.getDeviceProfile().isVerticalBarLayout()) {
+            return;
+        }
         // Already set correctly
         if (mLightStatusBar == enable) {
             return;
         }
         int systemUiFlags = mLauncher.getWindow().getDecorView().getSystemUiVisibility();
+        // SYSTEM_UI_FLAG_LIGHT_NAV_BAR == SYSTEM_UI_FLAG_LIGHT_STATUS_BAR << 1
+        // Use proper constant once API is submitted.
         if (enable) {
             mLauncher.getWindow().getDecorView().setSystemUiVisibility(systemUiFlags
-                    | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+                    | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
+                    | (View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR << 1));
 
         } else {
             mLauncher.getWindow().getDecorView().setSystemUiVisibility(systemUiFlags
-                    & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+                    & ~(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
+                            |(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR << 1)));
 
         }
         mLightStatusBar = enable;
diff --git a/src/com/android/launcher3/allapps/HeaderElevationController.java b/src/com/android/launcher3/allapps/HeaderElevationController.java
index 07f583c..e8f74eb 100644
--- a/src/com/android/launcher3/allapps/HeaderElevationController.java
+++ b/src/com/android/launcher3/allapps/HeaderElevationController.java
@@ -2,6 +2,7 @@
 
 import android.annotation.TargetApi;
 import android.content.res.Resources;
+import android.graphics.Outline;
 import android.graphics.Rect;
 import android.graphics.drawable.GradientDrawable;
 import android.os.Build;
@@ -82,11 +83,31 @@
 
         public ControllerVL(View header) {
             mHeader = header;
-            mHeader.setOutlineProvider(ViewOutlineProvider.BOUNDS);
-
-            Resources res = header.getContext().getResources();
+            Resources res = mHeader.getContext().getResources();
             mMaxElevation = res.getDimension(R.dimen.all_apps_header_max_elevation);
             mScrollToElevation = res.getDimension(R.dimen.all_apps_header_scroll_to_elevation);
+
+            // We need to provide a custom outline so the shadow only appears on the bottom edge.
+            // The top, left and right edges are all extended out, and the shadow is clipped
+            // by the parent.
+            final ViewOutlineProvider vop = new ViewOutlineProvider() {
+                @Override
+                public void getOutline(View view, Outline outline) {
+                    final View parent = (View) mHeader.getParent();
+
+                    final int left = parent.getLeft(); // Use the parent to account for offsets
+                    final int top = view.getTop();
+                    final int right = left + view.getWidth();
+                    final int bottom = view.getBottom();
+
+                    outline.setRect(
+                            left - (int) mMaxElevation,
+                            top - (int) mMaxElevation,
+                            right + (int) mMaxElevation,
+                            bottom);
+                }
+            };
+            mHeader.setOutlineProvider(vop);
         }
 
         @Override
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index 4966938..8aed6d8 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -187,6 +187,11 @@
         removeView(mOverlayView);
     }
 
+    public boolean isEventOverPageIndicator(MotionEvent ev) {
+        getDescendantRectRelativeToSelf(mLauncher.getWorkspace().getPageIndicator(), mHitRect);
+        return mHitRect.contains((int) ev.getX(), (int) ev.getY());
+    }
+
     public boolean isEventOverHotseat(MotionEvent ev) {
         getDescendantRectRelativeToSelf(mLauncher.getHotseat(), mHitRect);
         return mHitRect.contains((int) ev.getX(), (int) ev.getY());