mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 18:06:48 +00:00
Implementing support for item diffing instead of creating out the
complete UI on every update Bug: 229860311 Test: Verified locally Change-Id: I5712b5d76878a0ed72cc1392ede59b3778b7a1dc
This commit is contained in:
@@ -71,6 +71,26 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
|
||||
public void onChanged() {
|
||||
mCachedScrollPositions.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeChanged(int positionStart, int itemCount) {
|
||||
onChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeInserted(int positionStart, int itemCount) {
|
||||
onChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeRemoved(int positionStart, int itemCount) {
|
||||
onChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeMoved(int fromPosition, int toPosition, int itemCount) {
|
||||
onChanged();
|
||||
}
|
||||
};
|
||||
|
||||
// The empty-search result background
|
||||
@@ -241,17 +261,14 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
|
||||
// Find the fastscroll section that maps to this touch fraction
|
||||
List<AlphabeticalAppsList.FastScrollSectionInfo> fastScrollSections =
|
||||
mApps.getFastScrollerSections();
|
||||
AlphabeticalAppsList.FastScrollSectionInfo lastInfo = fastScrollSections.get(0);
|
||||
for (int i = 1; i < fastScrollSections.size(); i++) {
|
||||
AlphabeticalAppsList.FastScrollSectionInfo info = fastScrollSections.get(i);
|
||||
if (info.touchFraction > touchFraction) {
|
||||
break;
|
||||
}
|
||||
lastInfo = info;
|
||||
int count = fastScrollSections.size();
|
||||
if (count == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
mFastScrollHelper.smoothScrollToSection(lastInfo);
|
||||
return lastInfo.sectionName;
|
||||
int index = Utilities.boundToRange((int) (touchFraction * count), 0, count - 1);
|
||||
AlphabeticalAppsList.FastScrollSectionInfo section = fastScrollSections.get(index);
|
||||
mFastScrollHelper.smoothScrollToSection(section);
|
||||
return section.sectionName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user