Instead of popup to show letters, show private space icon on fast scrolling

Use spannableString to show the icon instead of regular letters for the private space icons.

bug:304752744
Test manual: https://drive.google.com/file/d/1LFy4-bu69Kuo8eV4erjJOsbkiQJs09kC/view?usp=sharing
Flag: None

Change-Id: I149d7aba6b0a4fdafacd2684e56827c7e1b9d724
This commit is contained in:
Brandon Dayauon committed 2024-04-17 12:37:38 -07:00
1 parent f15a96608a
commit a1af2cee1c
6 files changed
+51 -21

No files matched your search

@@ -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;
@@ -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;
@@ -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);
}