From 6292e32e7f6ac00482c03009fca065afdc9fa9a9 Mon Sep 17 00:00:00 2001 From: Anushree Ganjam Date: Tue, 19 Mar 2024 23:13:08 -0700 Subject: [PATCH] Add FastScrollSectionInfo with "info icon" when work educard exists. Before: https://b.corp.google.com/issues/325490294#comment1 After: https://b.corp.google.com/issues/325490294#comment5 Bug: 325490294 Test: Manual Flag: NA Change-Id: I557971cddd5829f46697004159d62a9343e75f69 (cherry picked from commit 6dadf21a7fd949850246c1c35722d5aa91b7af1d) --- res/values/strings.xml | 2 ++ .../android/launcher3/allapps/AlphabeticalAppsList.java | 7 +++++++ src/com/android/launcher3/allapps/WorkEduCard.java | 2 ++ 3 files changed, 11 insertions(+) diff --git a/res/values/strings.xml b/res/values/strings.xml index 9f4d308877..73ebaa8a5a 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -437,6 +437,8 @@ Work apps are badged and visible to your IT admin Got it + + \u24D8 Work apps are paused diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java index fba7537dac..35930c71fb 100644 --- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java +++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java @@ -26,6 +26,7 @@ import androidx.annotation.VisibleForTesting; import androidx.recyclerview.widget.DiffUtil; import com.android.launcher3.Flags; +import com.android.launcher3.R; import com.android.launcher3.allapps.BaseAllAppsAdapter.AdapterItem; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.ItemInfo; @@ -270,6 +271,12 @@ public class AlphabeticalAppsList implement addApps = mWorkProviderManager.shouldShowWorkApps(); } if (addApps) { + if (/* education card was added */ position == 1) { + // Add work educard section with "info icon" at 0th position. + mFastScrollerSections.add(new FastScrollSectionInfo( + mActivityContext.getResources().getString( + R.string.work_profile_edu_section), 0)); + } position = addAppsWithSections(mApps, position); } if (Flags.enablePrivateSpace()) { diff --git a/src/com/android/launcher3/allapps/WorkEduCard.java b/src/com/android/launcher3/allapps/WorkEduCard.java index 1059097c5a..5fe2f0c479 100644 --- a/src/com/android/launcher3/allapps/WorkEduCard.java +++ b/src/com/android/launcher3/allapps/WorkEduCard.java @@ -103,6 +103,8 @@ public class WorkEduCard extends FrameLayout implements AllAppsRecyclerView rv = mActivityContext.getAppsView().mAH.get( ActivityAllAppsContainerView.AdapterHolder.WORK).mRecyclerView; rv.getApps().getAdapterItems().remove(mPosition); + // Remove the educard fast scroll section. + rv.getApps().getFastScrollerSections().remove(0); rv.getAdapter().notifyItemRemoved(mPosition); } }