Merge "Fix folder preview animation when adding or removing icons." into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2022-06-15 21:20:55 +00:00
committed by Android (Google) Code Review
@@ -79,6 +79,8 @@ public class PreviewItemManager {
private int mPrevTopPadding = -1;
private Drawable mReferenceDrawable = null;
private int mNumOfPrevItems = 0;
// These hold the first page preview items
private ArrayList<PreviewItemDrawingParams> mFirstPageParams = new ArrayList<>();
// These hold the current page preview items. It is empty if the current page is the first page.
@@ -254,7 +256,6 @@ public class PreviewItemManager {
void buildParamsForPage(int page, ArrayList<PreviewItemDrawingParams> params, boolean animate) {
List<WorkspaceItemInfo> items = mIcon.getPreviewItemsOnPage(page);
int prevNumItems = params.size();
// We adjust the size of the list to match the number of items in the preview.
while (items.size() < params.size()) {
@@ -278,8 +279,9 @@ public class PreviewItemManager {
mReferenceDrawable = p.drawable;
}
} else {
FolderPreviewItemAnim anim = new FolderPreviewItemAnim(this, p, i, prevNumItems, i,
numItemsInFirstPagePreview, DROP_IN_ANIMATION_DURATION, null);
FolderPreviewItemAnim anim = new FolderPreviewItemAnim(this, p, i,
mNumOfPrevItems, i, numItemsInFirstPagePreview, DROP_IN_ANIMATION_DURATION,
null);
if (p.anim != null) {
if (p.anim.hasEqualFinalState(anim)) {
@@ -318,7 +320,9 @@ public class PreviewItemManager {
}
void updatePreviewItems(boolean animate) {
int numOfPrevItemsAux = mFirstPageParams.size();
buildParamsForPage(0, mFirstPageParams, animate);
mNumOfPrevItems = numOfPrevItemsAux;
}
void updatePreviewItems(Predicate<WorkspaceItemInfo> itemCheck) {