From 31d5b01ecf775dc7c65da252208f9ec8992f0966 Mon Sep 17 00:00:00 2001 From: fbaron Date: Fri, 7 Jun 2024 15:08:16 -0700 Subject: [PATCH] Fix folder animation clipping and RTL issue Fix: 341433475 Test: NONE Flag: EXEMPT bugfix Change-Id: I05c1ca65efea2fdcebb6ff9435fda1f4bbafb9f1 --- .../folder/FolderAnimationManager.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java index 7ef3209262..98249921c4 100644 --- a/src/com/android/launcher3/folder/FolderAnimationManager.java +++ b/src/com/android/launcher3/folder/FolderAnimationManager.java @@ -242,11 +242,26 @@ public class FolderAnimationManager { // Create reveal animator for the folder content (capture the top 4 icons 2x2) int width = mDeviceProfile.folderCellLayoutBorderSpacePx.x + mDeviceProfile.folderCellWidthPx * 2; + int rtlExtraWidth = 0; int height = mDeviceProfile.folderCellLayoutBorderSpacePx.y + mDeviceProfile.folderCellHeightPx * 2; int page = mIsOpening ? mContent.getCurrentPage() : mContent.getDestinationPage(); + // In RTL we want to move to the last 2 columns of icons in the folder. + if (Utilities.isRtl(mContext.getResources())) { + page = (mContent.getPageCount() - 1) - page; + CellLayout clAtPage = mContent.getPageAt(page); + if (clAtPage != null) { + int numExtraRows = clAtPage.getCountX() - 2; + rtlExtraWidth = (int) Math.max(numExtraRows * (mDeviceProfile.folderCellWidthPx + + mDeviceProfile.folderCellLayoutBorderSpacePx.x), rtlExtraWidth); + } + } int left = mContent.getPaddingLeft() + page * lp.width; - Rect contentStart = new Rect(left, 0, left + width, height); + Rect contentStart = new Rect( + left + rtlExtraWidth, + 0, + left + width + mContent.getPaddingRight() + rtlExtraWidth, + height); Rect contentEnd = new Rect(left, 0, left + lp.width, lp.height); play(a, shapeDelegate.createRevealAnimator( mFolder.getContent(), contentStart, contentEnd, finalRadius, !mIsOpening));