Merge "Updating the hotseat background to a solid color with rounded corners" into ub-launcher3-master
diff --git a/res/layout/all_apps.xml b/res/layout/all_apps.xml
index 3f6be2c..8cf32bd 100644
--- a/res/layout/all_apps.xml
+++ b/res/layout/all_apps.xml
@@ -41,14 +41,6 @@
 
         <include layout="@layout/predictions_view" android:id="@+id/header_content" />
 
-        <include layout="@layout/all_apps_divider"
-            android:id="@+id/divider"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="@dimen/all_apps_tabs_side_padding"
-            android:layout_marginRight="@dimen/all_apps_tabs_side_padding"
-            android:layout_alignBottom="@+id/tabs" />
-
         <com.android.launcher3.allapps.PersonalWorkSlidingTabStrip
             android:id="@+id/tabs"
             android:layout_width="match_parent"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index d9163bc..1ae7cbf 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -101,6 +101,7 @@
     <dimen name="all_apps_work_profile_tab_footer_top_padding">16dp</dimen>
     <dimen name="all_apps_work_profile_tab_footer_bottom_padding">20dp</dimen>
     <dimen name="all_apps_tabs_side_padding">12dp</dimen>
+    <dimen name="all_apps_divider_height">1dp</dimen>
 
 <!-- Search bar in All Apps -->
     <dimen name="all_apps_header_max_elevation">3dp</dimen>
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index b98d852..8154845 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -547,7 +547,7 @@
         return mHeader;
     }
 
-    private void setupHeader() {
+    public void setupHeader() {
         if (mHeader == null) {
             return;
         }
diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java
index 409985c..1419a2a 100644
--- a/src/com/android/launcher3/allapps/FloatingHeaderView.java
+++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java
@@ -18,7 +18,6 @@
 
 import android.animation.ValueAnimator;
 import android.content.Context;
-import android.content.res.Resources;
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.support.annotation.NonNull;
@@ -66,7 +65,6 @@
 
     private PredictionRowView mPredictionRow;
     private ViewGroup mTabLayout;
-    private View mDivider;
     private AllAppsRecyclerView mMainRV;
     private AllAppsRecyclerView mWorkRV;
     private AllAppsRecyclerView mCurrentRV;
@@ -90,7 +88,6 @@
     protected void onFinishInflate() {
         super.onFinishInflate();
         mTabLayout = findViewById(R.id.tabs);
-        mDivider = findViewById(R.id.divider);
         mPredictionRow = findViewById(R.id.header_content);
     }
 
@@ -98,17 +95,15 @@
             HashMap<ComponentKey, AppInfo> componentToAppMap, int numPredictedAppsPerRow) {
         mTabsHidden = mAH[AllAppsContainerView.AdapterHolder.WORK].recyclerView == null;
         mTabLayout.setVisibility(mTabsHidden ? View.GONE : View.VISIBLE);
-        mPredictionRow.setPadding(0, 0, 0, mTabsHidden ? getResources()
-                .getDimensionPixelSize(R.dimen.all_apps_prediction_row_divider_height) : 0);
         mPredictionRow.setup(mAH[AllAppsContainerView.AdapterHolder.MAIN].adapter,
                 componentToAppMap, numPredictedAppsPerRow);
+        mPredictionRow.setShowDivider(mTabsHidden);
         mMaxTranslation = mPredictionRow.getExpectedHeight();
         mMainRV = setupRV(mMainRV, mAH[AllAppsContainerView.AdapterHolder.MAIN].recyclerView);
         mWorkRV = setupRV(mWorkRV, mAH[AllAppsContainerView.AdapterHolder.WORK].recyclerView);
         mParent = (ViewGroup) mMainRV.getParent();
         setMainActive(true);
         reset();
-        setupDivider();
     }
 
     private AllAppsRecyclerView setupRV(AllAppsRecyclerView old, AllAppsRecyclerView updated) {
@@ -118,17 +113,6 @@
         return updated;
     }
 
-    private void setupDivider() {
-        Resources res = getResources();
-        int verticalGap = res.getDimensionPixelSize(R.dimen.all_apps_divider_margin_vertical);
-        int sideGap = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);
-        mDivider.setPadding(sideGap, verticalGap,sideGap, mTabsHidden ? verticalGap : 0);
-        RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) mDivider.getLayoutParams();
-        lp.removeRule(RelativeLayout.ALIGN_BOTTOM);
-        lp.addRule(RelativeLayout.ALIGN_BOTTOM, mTabsHidden ? R.id.header_content : R.id.tabs);
-        mDivider.setLayoutParams(lp);
-    }
-
     public void setMainActive(boolean active) {
         mCurrentRV = active ? mMainRV : mWorkRV;
     }
@@ -137,10 +121,6 @@
         return mPredictionRow;
     }
 
-    public View getDivider() {
-        return mDivider;
-    }
-
     private boolean canSnapAt(int currentScrollY) {
         return Math.abs(currentScrollY) <= mPredictionRow.getHeight();
     }
@@ -180,7 +160,6 @@
             mPredictionRow.setTranslationY(uncappedTranslationY);
         }
         mTabLayout.setTranslationY(mTranslationY);
-        mDivider.setTranslationY(mTabsHidden ? uncappedTranslationY : mTranslationY);
         mClip.top = mMaxTranslation + mTranslationY;
         // clipping on a draw might cause additional redraw
         mMainRV.setClipBounds(mClip);
diff --git a/src/com/android/launcher3/allapps/PersonalWorkSlidingTabStrip.java b/src/com/android/launcher3/allapps/PersonalWorkSlidingTabStrip.java
index 54948b0..057c64a 100644
--- a/src/com/android/launcher3/allapps/PersonalWorkSlidingTabStrip.java
+++ b/src/com/android/launcher3/allapps/PersonalWorkSlidingTabStrip.java
@@ -35,6 +35,7 @@
 public class PersonalWorkSlidingTabStrip extends LinearLayout {
     private final Paint mPersonalTabIndicatorPaint;
     private final Paint mWorkTabIndicatorPaint;
+    private final Paint mDividerPaint;
 
     private int mSelectedIndicatorHeight;
     private int mIndicatorLeft = -1;
@@ -59,6 +60,10 @@
         mWorkTabIndicatorPaint.setColor(getResources().getColor(R.color.work_profile_color));
 
         mIsRtl = Utilities.isRtl(getResources());
+
+        mDividerPaint = new Paint();
+        mDividerPaint.setColor(Themes.getAttrColor(context, android.R.attr.colorControlHighlight));
+        mDividerPaint.setStrokeWidth(getResources().getDimensionPixelSize(R.dimen.all_apps_divider_height));
     }
 
     public void updateIndicatorPosition(int position, float positionOffset) {
@@ -116,6 +121,9 @@
     protected void onDraw(Canvas canvas) {
         super.onDraw(canvas);
 
+        float y = getHeight() - mDividerPaint.getStrokeWidth();
+        canvas.drawLine(getPaddingLeft(), y, getWidth() - getPaddingRight(), y, mDividerPaint);
+
         final float middleX = getWidth() / 2.0f;
         if (mIndicatorLeft <= middleX) {
             canvas.drawRect(mIndicatorLeft, getHeight() - mSelectedIndicatorHeight,
diff --git a/src/com/android/launcher3/allapps/PredictionRowView.java b/src/com/android/launcher3/allapps/PredictionRowView.java
index 1aee948..4aacc6d 100644
--- a/src/com/android/launcher3/allapps/PredictionRowView.java
+++ b/src/com/android/launcher3/allapps/PredictionRowView.java
@@ -17,6 +17,8 @@
 package com.android.launcher3.allapps;
 
 import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.util.AttributeSet;
@@ -27,9 +29,11 @@
 import com.android.launcher3.AppInfo;
 import com.android.launcher3.BubbleTextView;
 import com.android.launcher3.Launcher;
+import com.android.launcher3.R;
 import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.util.ComponentKey;
 import com.android.launcher3.util.ComponentKeyMapper;
+import com.android.launcher3.util.Themes;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -46,8 +50,10 @@
     private final List<ComponentKeyMapper<AppInfo>> mPredictedAppComponents = new ArrayList<>();
     // The set of predicted apps resolved from the component names and the current set of apps
     private final List<AppInfo> mPredictedApps = new ArrayList<>();
+    private final Paint mPaint;
     // This adapter is only used to create an identical item w/ same behavior as in the all apps RV
     private AllAppsGridAdapter mAdapter;
+    private boolean mShowDivider;
 
     public PredictionRowView(@NonNull Context context) {
         this(context, null);
@@ -56,6 +62,10 @@
     public PredictionRowView(@NonNull Context context, @Nullable AttributeSet attrs) {
         super(context, attrs);
         setOrientation(LinearLayout.HORIZONTAL);
+        setWillNotDraw(false);
+        mPaint = new Paint();
+        mPaint.setColor(Themes.getAttrColor(context, android.R.attr.colorControlHighlight));
+        mPaint.setStrokeWidth(getResources().getDimensionPixelSize(R.dimen.all_apps_divider_height));
     }
 
     public void setup(AllAppsGridAdapter adapter, HashMap<ComponentKey, AppInfo> componentToAppMap,
@@ -82,6 +92,13 @@
         return height;
     }
 
+    public void setShowDivider(boolean showDivider) {
+        mShowDivider = showDivider;
+        int paddingBottom = showDivider ? getResources()
+                .getDimensionPixelSize(R.dimen.all_apps_prediction_row_divider_height) : 0;
+        setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(), paddingBottom);
+    }
+
     /**
      * Sets the number of apps per row.
      */
@@ -169,4 +186,17 @@
         }
         return predictedApps;
     }
+
+    @Override
+    protected void onDraw(Canvas canvas) {
+        super.onDraw(canvas);
+
+        if (mShowDivider) {
+            int side = getResources().getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);
+            int y = getHeight() - (getPaddingBottom() / 2);
+            int x1 = getPaddingLeft() + side;
+            int x2 = getWidth() - getPaddingRight() - side;
+            canvas.drawLine(x1, y, x2, y, mPaint);
+        }
+    }
 }