Fix WindowLeaked issue on AttachmentPreview

Stop attaching animation before removal attachment views and hiding the
AttachmentPreview.

Test: Long-press to attach a media from GalleryGridView and uncheck the
      media to detach immediately.

Change-Id: Ia1014609c056c9f35e428f8968b58dc2c1b704f9
Signed-off-by: Taesu Lee <taesu82.lee@samsung.com>
This commit is contained in:
Taesu Lee
2020-03-06 17:38:15 +09:00
parent e5c3d281ad
commit 1412b40ec6
2 changed files with 20 additions and 3 deletions

View File

@@ -33,6 +33,7 @@ import com.android.messaging.datamodel.data.MessagePartData;
import com.android.messaging.datamodel.data.PendingAttachmentData;
import com.android.messaging.datamodel.media.ImageRequestDescriptor;
import com.android.messaging.ui.AsyncImageView.AsyncImageViewDelayLoader;
import com.android.messaging.ui.animation.PopupTransitionAnimation;
import com.android.messaging.util.AccessibilityUtil;
import com.android.messaging.util.Assert;
import com.android.messaging.util.UiUtils;
@@ -275,7 +276,11 @@ public class MultiAttachmentLayout extends FrameLayout {
// views will slide from their previous position to their new position within the
// layout
if (i == 0) {
AttachmentPreview.tryAnimateViewIn(attachment, attachmentWrapper.view);
if (attachment instanceof MediaPickerMessagePartData) {
final Rect startRect = ((MediaPickerMessagePartData) attachment).getStartRect();
new PopupTransitionAnimation(startRect, attachmentWrapper.view)
.startAfterLayoutComplete();
}
}
attachmentWrapper.needsSlideAnimation = i > 0;
}