diff --git a/res/drawable/ic_private_profile_divider_badge.xml b/res/drawable/ic_private_profile_divider_badge.xml
new file mode 100644
index 0000000000..07c740d912
--- /dev/null
+++ b/res/drawable/ic_private_profile_divider_badge.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
diff --git a/res/drawable/ic_private_profile_letter_list_fast_scroller_badge.xml b/res/drawable/ic_private_profile_letter_list_fast_scroller_badge.xml
new file mode 100644
index 0000000000..8d125988c1
--- /dev/null
+++ b/res/drawable/ic_private_profile_letter_list_fast_scroller_badge.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
index 4e1e95011b..e705d94d23 100644
--- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
@@ -346,17 +346,12 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView {
(LetterListTextView) LayoutInflater.from(context).inflate(
R.layout.fast_scroller_letter_list_text_view, mLetterList, false);
int viewId = View.generateViewId();
- textView.setId(viewId);
+ textView.apply(sectionInfo /* FastScrollSectionInfo */, viewId /* viewId */);
sectionInfo.setId(viewId);
- textView.setText(sectionInfo.sectionName);
if (i == fastScrollSections.size() - 1) {
// The last section info is just a duplicate so that user can scroll to the bottom.
textView.setVisibility(INVISIBLE);
}
- ConstraintLayout.LayoutParams lp = new ConstraintLayout.LayoutParams(
- MATCH_CONSTRAINT, WRAP_CONTENT);
- lp.dimensionRatio = "v,1:1";
- textView.setLayoutParams(lp);
textViews.add(textView);
mLetterList.addView(textView);
}
diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
index 8e44d65d50..709b52a174 100644
--- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
@@ -106,6 +106,7 @@ public class AlphabeticalAppsList implement
// The of ordered component names as a result of a search query
private final ArrayList mSearchResults = new ArrayList<>();
private final SpannableString mPrivateProfileAppScrollerBadge;
+ private final SpannableString mPrivateProfileDividerBadge;
private BaseAllAppsAdapter mAdapter;
private AppInfoComparator mAppNameComparator;
private int mNumAppsPerRowAllApps;
@@ -124,9 +125,14 @@ public class AlphabeticalAppsList implement
mAllAppsStore.addUpdateListener(this);
}
mPrivateProfileAppScrollerBadge = new SpannableString(" ");
- mPrivateProfileAppScrollerBadge.setSpan(new ImageSpan(context,
+ mPrivateProfileAppScrollerBadge.setSpan(new ImageSpan(context, Flags.letterFastScroller()
+ ? R.drawable.ic_private_profile_letter_list_fast_scroller_badge :
R.drawable.ic_private_profile_app_scroller_badge, ImageSpan.ALIGN_CENTER),
0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ mPrivateProfileDividerBadge = new SpannableString(" ");
+ mPrivateProfileDividerBadge.setSpan(new ImageSpan(context,
+ R.drawable.ic_private_profile_divider_badge, ImageSpan.ALIGN_CENTER),
+ 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
/** Set the number of apps per row when device profile changes. */
@@ -404,6 +410,11 @@ public class AlphabeticalAppsList implement
// Add system apps separator.
if (Flags.privateSpaceSysAppsSeparation()) {
position = mPrivateProviderManager.addSystemAppsDivider(mAdapterItems);
+ if (Flags.letterFastScroller()) {
+ FastScrollSectionInfo sectionInfo =
+ new FastScrollSectionInfo(mPrivateProfileDividerBadge, position);
+ mFastScrollerSections.add(sectionInfo);
+ }
}
// Add system apps.
position = addAppsWithSections(split.get(false), position);
@@ -437,8 +448,11 @@ public class AlphabeticalAppsList implement
Log.d(TAG, "addAppsWithSections: adding sectionName: " + sectionName
+ " with appInfoTitle: " + info.title);
lastSectionName = sectionName;
- mFastScrollerSections.add(new FastScrollSectionInfo(hasPrivateApps ?
- mPrivateProfileAppScrollerBadge : sectionName, position));
+ boolean usePrivateAppScrollerBadge = !Flags.letterFastScroller() && hasPrivateApps;
+ FastScrollSectionInfo sectionInfo = new FastScrollSectionInfo(
+ usePrivateAppScrollerBadge ?
+ mPrivateProfileAppScrollerBadge : sectionName, position);
+ mFastScrollerSections.add(sectionInfo);
}
position++;
}
diff --git a/src/com/android/launcher3/allapps/LetterListTextView.java b/src/com/android/launcher3/allapps/LetterListTextView.java
index 9326d79f18..433a7f2e7d 100644
--- a/src/com/android/launcher3/allapps/LetterListTextView.java
+++ b/src/com/android/launcher3/allapps/LetterListTextView.java
@@ -16,6 +16,9 @@
package com.android.launcher3.allapps;
+import static androidx.constraintlayout.widget.ConstraintSet.MATCH_CONSTRAINT;
+import static androidx.constraintlayout.widget.ConstraintSet.WRAP_CONTENT;
+
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
@@ -23,6 +26,7 @@ import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.TextView;
+import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.graphics.ColorUtils;
import com.android.launcher3.R;
@@ -70,6 +74,20 @@ public class LetterListTextView extends TextView {
setVisibility(VISIBLE);
}
+ /**
+ * Applies a viewId to the letter list text view and sets the background and text based on the
+ * sectionInfo.
+ */
+ public void apply(AlphabeticalAppsList.FastScrollSectionInfo fastScrollSectionInfo,
+ int viewId) {
+ setId(viewId);
+ setText(fastScrollSectionInfo.sectionName);
+ ConstraintLayout.LayoutParams lp = new ConstraintLayout.LayoutParams(
+ MATCH_CONSTRAINT, WRAP_CONTENT);
+ lp.dimensionRatio = "v,1:1";
+ setLayoutParams(lp);
+ }
+
/**
* Animates the letter list text view based on the current finger position.
*