Loading res/drawable/ic_private_profile_app_scroller_badge.xml 0 → 100644 +28 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2024 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" android:viewportWidth="32" android:viewportHeight="32" android:width="32dp" android:height="32dp"> <path android:pathData="M16.0007 2.66602L5.33398 6.66602V14.786C5.33398 21.5194 9.88065 27.7993 16.0007 29.3327C22.1207 27.7993 26.6673 21.5194 26.6673 14.786V6.66602L16.0007 2.66602ZM20.0007 19.9993V22.666H17.334V23.9993H14.6673V17.1193C12.7473 16.546 11.334 14.786 11.334 12.666C11.334 10.0927 13.4273 7.99935 16.0007 7.99935C18.574 7.99935 20.6673 10.0927 20.6673 12.666C20.6673 14.7727 19.254 16.546 17.334 17.1193V19.9993H20.0007Z" android:fillType="evenOdd" android:fillColor="@android:color/white" /> <path android:pathData="M16 14.666C17.1046 14.666 18 13.7706 18 12.666C18 11.5614 17.1046 10.666 16 10.666C14.8954 10.666 14 11.5614 14 12.666C14 13.7706 14.8954 14.666 16 14.666Z" android:fillColor="@android:color/white" /> </vector> src/com/android/launcher3/FastScrollRecyclerView.java +1 −11 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ public abstract class FastScrollRecyclerView extends RecyclerView { * Maps the touch (from 0..1) to the adapter position that should be visible. * <p>Override in each subclass of this base class. */ public abstract String scrollToPositionAtProgress(float touchFraction); public abstract CharSequence scrollToPositionAtProgress(float touchFraction); /** * Updates the bounds for the scrollbar. Loading Loading @@ -193,14 +193,4 @@ public abstract class FastScrollRecyclerView extends RecyclerView { } scrollToPosition(0); } /** * Scrolls this recycler view to the bottom with easing and duration. */ public void scrollToBottomWithMotion(int duration) { if (mScrollbar != null) { mScrollbar.reattachThumbToScroll(); } smoothScrollBy(0, getAvailableScrollHeight(), Interpolators.EMPHASIZED, duration); } } src/com/android/launcher3/allapps/AllAppsRecyclerView.java +1 −1 Original line number Diff line number Diff line Loading @@ -180,7 +180,7 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView { * Maps the touch (from 0..1) to the adapter position that should be visible. */ @Override public String scrollToPositionAtProgress(float touchFraction) { public CharSequence scrollToPositionAtProgress(float touchFraction) { int rowCount = mApps.getNumAppRows(); if (rowCount == 0) { return ""; Loading src/com/android/launcher3/allapps/AlphabeticalAppsList.java +16 −5 Original line number Diff line number Diff line Loading @@ -22,6 +22,10 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_PRIVATE_SPACE_USER_INSTALLED_APPS_COUNT; import android.content.Context; import android.graphics.drawable.Drawable; import android.text.Spannable; import android.text.SpannableString; import android.text.style.ImageSpan; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; Loading Loading @@ -65,11 +69,11 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement */ public static class FastScrollSectionInfo { // The section name public final String sectionName; public final CharSequence sectionName; // The item position public final int position; public FastScrollSectionInfo(String sectionName, int position) { public FastScrollSectionInfo(CharSequence sectionName, int position) { this.sectionName = sectionName; this.position = position; } Loading @@ -93,6 +97,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement // The of ordered component names as a result of a search query private final ArrayList<AdapterItem> mSearchResults = new ArrayList<>(); private final SpannableString mPrivateProfileAppScrollerBadge; private BaseAllAppsAdapter<T> mAdapter; private AppInfoComparator mAppNameComparator; private int mNumAppsPerRowAllApps; Loading @@ -110,6 +115,10 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement if (mAllAppsStore != null) { mAllAppsStore.addUpdateListener(this); } mPrivateProfileAppScrollerBadge = new SpannableString(" "); mPrivateProfileAppScrollerBadge.setSpan(new ImageSpan(context, R.drawable.ic_private_profile_app_scroller_badge, ImageSpan.ALIGN_CENTER), 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } /** Set the number of apps per row when device profile changes. */ Loading Loading @@ -383,6 +392,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement private int addAppsWithSections(List<AppInfo> appList, int startPosition) { String lastSectionName = null; boolean hasPrivateApps = false; int position = startPosition; if (mPrivateProviderManager != null) { hasPrivateApps = appList.stream(). allMatch(mPrivateProviderManager.getItemInfoMatcher()); Loading @@ -403,11 +413,12 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement // Create a new section if the section names do not match if (!sectionName.equals(lastSectionName)) { lastSectionName = sectionName; mFastScrollerSections.add(new FastScrollSectionInfo(sectionName, startPosition)); mFastScrollerSections.add(new FastScrollSectionInfo(hasPrivateApps ? mPrivateProfileAppScrollerBadge : sectionName, position)); } startPosition++; position++; } return startPosition; return position; } /** Loading src/com/android/launcher3/views/RecyclerViewFastScroller.java +4 −3 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; import android.graphics.RectF; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.util.Property; Loading Loading @@ -121,7 +122,7 @@ public class RecyclerViewFastScroller extends View { // Fast scroller popup private TextView mPopupView; private boolean mPopupVisible; private String mPopupSectionName; private CharSequence mPopupSectionName; private Insets mSystemGestureInsets; protected FastScrollRecyclerView mRv; Loading Loading @@ -307,13 +308,13 @@ public class RecyclerViewFastScroller extends View { // Update the fastscroller section name at this touch position int bottom = mRv.getScrollbarTrackHeight() - mThumbHeight; float boundedY = (float) Math.max(0, Math.min(bottom, y - mTouchOffsetY)); String sectionName = mRv.scrollToPositionAtProgress(boundedY / bottom); CharSequence sectionName = mRv.scrollToPositionAtProgress(boundedY / bottom); if (!sectionName.equals(mPopupSectionName)) { mPopupSectionName = sectionName; mPopupView.setText(sectionName); performHapticFeedback(CLOCK_TICK); } animatePopupVisibility(!sectionName.isEmpty()); animatePopupVisibility(!TextUtils.isEmpty(sectionName)); mLastTouchY = boundedY; setThumbOffsetY((int) mLastTouchY); } Loading Loading
res/drawable/ic_private_profile_app_scroller_badge.xml 0 → 100644 +28 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2024 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" android:viewportWidth="32" android:viewportHeight="32" android:width="32dp" android:height="32dp"> <path android:pathData="M16.0007 2.66602L5.33398 6.66602V14.786C5.33398 21.5194 9.88065 27.7993 16.0007 29.3327C22.1207 27.7993 26.6673 21.5194 26.6673 14.786V6.66602L16.0007 2.66602ZM20.0007 19.9993V22.666H17.334V23.9993H14.6673V17.1193C12.7473 16.546 11.334 14.786 11.334 12.666C11.334 10.0927 13.4273 7.99935 16.0007 7.99935C18.574 7.99935 20.6673 10.0927 20.6673 12.666C20.6673 14.7727 19.254 16.546 17.334 17.1193V19.9993H20.0007Z" android:fillType="evenOdd" android:fillColor="@android:color/white" /> <path android:pathData="M16 14.666C17.1046 14.666 18 13.7706 18 12.666C18 11.5614 17.1046 10.666 16 10.666C14.8954 10.666 14 11.5614 14 12.666C14 13.7706 14.8954 14.666 16 14.666Z" android:fillColor="@android:color/white" /> </vector>
src/com/android/launcher3/FastScrollRecyclerView.java +1 −11 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ public abstract class FastScrollRecyclerView extends RecyclerView { * Maps the touch (from 0..1) to the adapter position that should be visible. * <p>Override in each subclass of this base class. */ public abstract String scrollToPositionAtProgress(float touchFraction); public abstract CharSequence scrollToPositionAtProgress(float touchFraction); /** * Updates the bounds for the scrollbar. Loading Loading @@ -193,14 +193,4 @@ public abstract class FastScrollRecyclerView extends RecyclerView { } scrollToPosition(0); } /** * Scrolls this recycler view to the bottom with easing and duration. */ public void scrollToBottomWithMotion(int duration) { if (mScrollbar != null) { mScrollbar.reattachThumbToScroll(); } smoothScrollBy(0, getAvailableScrollHeight(), Interpolators.EMPHASIZED, duration); } }
src/com/android/launcher3/allapps/AllAppsRecyclerView.java +1 −1 Original line number Diff line number Diff line Loading @@ -180,7 +180,7 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView { * Maps the touch (from 0..1) to the adapter position that should be visible. */ @Override public String scrollToPositionAtProgress(float touchFraction) { public CharSequence scrollToPositionAtProgress(float touchFraction) { int rowCount = mApps.getNumAppRows(); if (rowCount == 0) { return ""; Loading
src/com/android/launcher3/allapps/AlphabeticalAppsList.java +16 −5 Original line number Diff line number Diff line Loading @@ -22,6 +22,10 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_PRIVATE_SPACE_USER_INSTALLED_APPS_COUNT; import android.content.Context; import android.graphics.drawable.Drawable; import android.text.Spannable; import android.text.SpannableString; import android.text.style.ImageSpan; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; Loading Loading @@ -65,11 +69,11 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement */ public static class FastScrollSectionInfo { // The section name public final String sectionName; public final CharSequence sectionName; // The item position public final int position; public FastScrollSectionInfo(String sectionName, int position) { public FastScrollSectionInfo(CharSequence sectionName, int position) { this.sectionName = sectionName; this.position = position; } Loading @@ -93,6 +97,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement // The of ordered component names as a result of a search query private final ArrayList<AdapterItem> mSearchResults = new ArrayList<>(); private final SpannableString mPrivateProfileAppScrollerBadge; private BaseAllAppsAdapter<T> mAdapter; private AppInfoComparator mAppNameComparator; private int mNumAppsPerRowAllApps; Loading @@ -110,6 +115,10 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement if (mAllAppsStore != null) { mAllAppsStore.addUpdateListener(this); } mPrivateProfileAppScrollerBadge = new SpannableString(" "); mPrivateProfileAppScrollerBadge.setSpan(new ImageSpan(context, R.drawable.ic_private_profile_app_scroller_badge, ImageSpan.ALIGN_CENTER), 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } /** Set the number of apps per row when device profile changes. */ Loading Loading @@ -383,6 +392,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement private int addAppsWithSections(List<AppInfo> appList, int startPosition) { String lastSectionName = null; boolean hasPrivateApps = false; int position = startPosition; if (mPrivateProviderManager != null) { hasPrivateApps = appList.stream(). allMatch(mPrivateProviderManager.getItemInfoMatcher()); Loading @@ -403,11 +413,12 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement // Create a new section if the section names do not match if (!sectionName.equals(lastSectionName)) { lastSectionName = sectionName; mFastScrollerSections.add(new FastScrollSectionInfo(sectionName, startPosition)); mFastScrollerSections.add(new FastScrollSectionInfo(hasPrivateApps ? mPrivateProfileAppScrollerBadge : sectionName, position)); } startPosition++; position++; } return startPosition; return position; } /** Loading
src/com/android/launcher3/views/RecyclerViewFastScroller.java +4 −3 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; import android.graphics.RectF; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.util.Property; Loading Loading @@ -121,7 +122,7 @@ public class RecyclerViewFastScroller extends View { // Fast scroller popup private TextView mPopupView; private boolean mPopupVisible; private String mPopupSectionName; private CharSequence mPopupSectionName; private Insets mSystemGestureInsets; protected FastScrollRecyclerView mRv; Loading Loading @@ -307,13 +308,13 @@ public class RecyclerViewFastScroller extends View { // Update the fastscroller section name at this touch position int bottom = mRv.getScrollbarTrackHeight() - mThumbHeight; float boundedY = (float) Math.max(0, Math.min(bottom, y - mTouchOffsetY)); String sectionName = mRv.scrollToPositionAtProgress(boundedY / bottom); CharSequence sectionName = mRv.scrollToPositionAtProgress(boundedY / bottom); if (!sectionName.equals(mPopupSectionName)) { mPopupSectionName = sectionName; mPopupView.setText(sectionName); performHapticFeedback(CLOCK_TICK); } animatePopupVisibility(!sectionName.isEmpty()); animatePopupVisibility(!TextUtils.isEmpty(sectionName)); mLastTouchY = boundedY; setThumbOffsetY((int) mLastTouchY); } Loading