From 05ba3a265af1b5763899d543f66d033fbd3cbeb7 Mon Sep 17 00:00:00 2001 From: Andrey Epin Date: Wed, 1 Mar 2023 21:28:38 -0800 Subject: Add animation to custom actions Animate custom actions in the same way as targets selection i.e. slide-out to the left / slide-in from the right. Bug: 271366532 Test: manual testing Change-Id: I2fbff047b8a06cbdd890b56db45ba1efce3e3f95 --- java/res/anim/slide_in_right.xml | 22 ++++++++++++++++++++++ java/res/anim/slide_out_left.xml | 20 ++++++++++++++++++++ .../intentresolver/ChooserActionFactory.java | 14 +++++++++++++- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 java/res/anim/slide_in_right.xml create mode 100644 java/res/anim/slide_out_left.xml (limited to 'java') diff --git a/java/res/anim/slide_in_right.xml b/java/res/anim/slide_in_right.xml new file mode 100644 index 00000000..3d3cd919 --- /dev/null +++ b/java/res/anim/slide_in_right.xml @@ -0,0 +1,22 @@ + + + + + + \ No newline at end of file diff --git a/java/res/anim/slide_out_left.xml b/java/res/anim/slide_out_left.xml new file mode 100644 index 00000000..b3471518 --- /dev/null +++ b/java/res/anim/slide_out_left.xml @@ -0,0 +1,20 @@ + + + + + \ No newline at end of file diff --git a/java/src/com/android/intentresolver/ChooserActionFactory.java b/java/src/com/android/intentresolver/ChooserActionFactory.java index 566b2546..14d59720 100644 --- a/java/src/com/android/intentresolver/ChooserActionFactory.java +++ b/java/src/com/android/intentresolver/ChooserActionFactory.java @@ -18,6 +18,7 @@ package com.android.intentresolver; import android.annotation.Nullable; import android.app.Activity; +import android.app.ActivityOptions; import android.app.PendingIntent; import android.content.ClipData; import android.content.ClipboardManager; @@ -490,7 +491,18 @@ public final class ChooserActionFactory implements ChooserContentPreviewUi.Actio icon, () -> { try { - action.getAction().send(); + action.getAction().send( + null, + 0, + null, + null, + null, + null, + ActivityOptions.makeCustomAnimation( + context, + R.anim.slide_in_right, + R.anim.slide_out_left) + .toBundle()); } catch (PendingIntent.CanceledException e) { Log.d(TAG, "Custom action, " + action.getLabel() + ", has been cancelled"); } -- cgit v1.2.3-59-g8ed1b