Polish work for work profile

Bug: 191478900 Work profile toggle specs
Bug: 187761192 Fix issue where Installing app scrolling apps to top
Bug: 191121890	Fix issue where top of AllApps becomes empty when returning to AllApps
Bug: 191477329 String change for work profile paused state
Test: local
Change-Id: Idbaab333566b54afa3dc879f5bea98e1f77c44fc
diff --git a/res/drawable/work_apps_toggle_background.xml b/res/drawable/work_apps_toggle_background.xml
index b7115f8..a47c8fe 100644
--- a/res/drawable/work_apps_toggle_background.xml
+++ b/res/drawable/work_apps_toggle_background.xml
@@ -18,14 +18,18 @@
         <shape android:shape="rectangle">
             <corners android:radius="@dimen/work_fab_radius" />
             <solid android:color="?android:attr/colorControlHighlight" />
-            <padding android:left="@dimen/work_fab_radius" android:right="@dimen/work_fab_radius" />
+            <padding
+                android:left="@dimen/work_profile_footer_padding"
+                android:right="@dimen/work_profile_footer_padding" />
         </shape>
     </item>
     <item>
         <shape android:shape="rectangle">
             <corners android:radius="@dimen/work_fab_radius" />
             <solid android:color="@color/all_apps_tab_background_selected" />
-            <padding android:left="@dimen/work_fab_radius" android:right="@dimen/work_fab_radius" />
+            <padding
+                android:left="@dimen/work_profile_footer_padding"
+                android:right="@dimen/work_profile_footer_padding" />
         </shape>
     </item>
 </selector>
diff --git a/res/layout/work_apps_edu.xml b/res/layout/work_apps_edu.xml
index 97feb23..919f1b2 100644
--- a/res/layout/work_apps_edu.xml
+++ b/res/layout/work_apps_edu.xml
@@ -42,7 +42,7 @@
 
         <Button
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_height="@dimen/rounded_button_height"
             android:id="@+id/action_btn"
             android:textColor="?attr/workProfileOverlayTextColor"
             android:text="@string/work_profile_edu_accept"
diff --git a/res/layout/work_apps_paused.xml b/res/layout/work_apps_paused.xml
index 3819256..02a50ca 100644
--- a/res/layout/work_apps_paused.xml
+++ b/res/layout/work_apps_paused.xml
@@ -17,7 +17,7 @@
     android:layout_height="wrap_content"
     android:padding="@dimen/work_edu_card_margin"
     android:orientation="vertical"
-    android:gravity="center">
+    android:gravity="center_horizontal">
 
     <TextView
         style="@style/PrimaryHeadline"
@@ -25,8 +25,7 @@
         android:id="@+id/work_apps_paused_title"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginTop="8dp"
-        android:layout_marginBottom="8dp"
+        android:layout_marginTop="40dp"
         android:text="@string/work_apps_paused_title"
         android:textAlignment="center"
         android:textSize="20sp" />
@@ -38,12 +37,13 @@
         android:textColor="?attr/workProfileOverlayTextColor"
         android:text="@string/work_apps_paused_body"
         android:textAlignment="center"
-        android:layout_marginBottom="8dp"
+        android:layout_marginTop="16dp"
+        android:layout_marginBottom="24dp"
         android:textSize="16sp" />
 
     <Button
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
+        android:layout_height="@dimen/rounded_button_height"
         android:id="@+id/enable_work_apps"
         android:textColor="?attr/workProfileOverlayTextColor"
         android:text="@string/work_apps_enable_btn_text"
diff --git a/res/layout/work_mode_fab.xml b/res/layout/work_mode_fab.xml
index 1771d37..7183817 100644
--- a/res/layout/work_mode_fab.xml
+++ b/res/layout/work_mode_fab.xml
@@ -13,6 +13,7 @@
      limitations under the License.
 -->
 <com.android.launcher3.allapps.WorkModeSwitch xmlns:android="http://schemas.android.com/apk/res/android"
+    style="@style/TextHeadline"
     android:id="@+id/work_mode_toggle"
     android:layout_alignParentBottom="true"
     android:layout_alignParentEnd="true"
@@ -22,6 +23,7 @@
     android:includeFontPadding="false"
     android:drawableTint="@color/all_apps_tab_text"
     android:textColor="@color/all_apps_tab_text"
+    android:textSize="14sp"
     android:background="@drawable/work_apps_toggle_background"
     android:drawablePadding="16dp"
     android:drawableStart="@drawable/ic_corp_off"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3dbd760..5940a26 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -394,7 +394,7 @@
     <string name="work_profile_edu_accept">Got it</string>
 
     <!--- heading shown when user opens work apps tab while work apps are paused -->
-    <string name="work_apps_paused_title">Work apps are off</string>
+    <string name="work_apps_paused_title">Work apps are paused</string>
     <!--- body shown when user opens work apps tab while work apps are paused -->
     <string name="work_apps_paused_body">Your work apps can’t send you notifications, use your battery, or access your location</string>
     <!-- content description for paused work apps list -->
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index c5d280d..11ddafb 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1079,7 +1079,7 @@
         if (ALL_APPS.equals(mPrevLauncherState) && !ALL_APPS.equals(state)
                 // Making sure mAllAppsSessionLogId is not null to avoid double logging.
                 && mAllAppsSessionLogId != null) {
-            getAppsView().getSearchUiManager().resetSearch();
+            getAppsView().reset(false);
             getStatsLogManager().logger()
                     .withContainerInfo(LauncherAtom.ContainerInfo.newBuilder()
                             .setWorkspace(
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 67f2a9e..1010148 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -255,7 +255,6 @@
             mWorkModeSwitch.updateCurrentState(isEnabled);
         }
         mWorkAdapterProvider.updateCurrentState(isEnabled);
-        mAH[AdapterHolder.WORK].applyPadding();
     }
 
     private void hideInput() {
@@ -509,7 +508,10 @@
                     R.layout.work_mode_fab, this, false);
             this.addView(mWorkModeSwitch);
             mWorkModeSwitch.setInsets(mInsets);
-            mWorkModeSwitch.post(this::resetWorkProfile);
+            mWorkModeSwitch.post(() -> {
+                mAH[AdapterHolder.WORK].applyPadding();
+                resetWorkProfile();
+            });
         }
     }
 
@@ -633,6 +635,7 @@
             mSearchModeWhileUsingTabs = true;
             rebindAdapters(false); // hide tabs
         }
+        mHeader.setCollapsed(true);
     }
 
     public void onClearSearchResult() {
@@ -715,7 +718,7 @@
         if (mHeaderPaint.getColor() != mScrimColor && mHeaderPaint.getColor() != 0) {
             int bottom = mUsingTabs && mHeader.mHeaderCollapsed ? mHeader.getVisibleBottomBound()
                     : mSearchContainer.getBottom();
-            canvas.drawRect(0, 0, getWidth(), bottom + getTranslationY(),
+            canvas.drawRect(0, 0, canvas.getWidth(), bottom + getTranslationY(),
                     mHeaderPaint);
         }
     }
@@ -783,7 +786,6 @@
                 int bottomOffset = mWorkModeSwitch != null && mIsWork ? switchH : 0;
                 recyclerView.setPadding(padding.left, padding.top, padding.right,
                         padding.bottom + bottomOffset);
-                recyclerView.scrollToTop();
             }
         }
 
diff --git a/src/com/android/launcher3/views/SpringRelativeLayout.java b/src/com/android/launcher3/views/SpringRelativeLayout.java
index 8f814a1..923eb19 100644
--- a/src/com/android/launcher3/views/SpringRelativeLayout.java
+++ b/src/com/android/launcher3/views/SpringRelativeLayout.java
@@ -105,9 +105,8 @@
 
         @NonNull @Override
         protected EdgeEffect createEdgeEffect(RecyclerView view, int direction) {
-            switch (direction) {
-                case DIRECTION_TOP:
-                    return new EdgeEffectProxy(getContext(), mEdgeGlowTop);
+            if (direction == DIRECTION_TOP) {
+                return new EdgeEffectProxy(getContext(), mEdgeGlowTop);
             }
             return super.createEdgeEffect(view, direction);
         }