summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2023-03-03 01:30:29 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-03-03 01:30:29 +0000
commit7ba4669ced6e409bf74b97c3aca222a0acd692ca (patch)
tree6468841b8a1b8af6ea5083d609148c36f8d456cd /java
parentbf5f59152a1ce2a6bf083fd14921fcc7a6c7687b (diff)
parent5f3b784bd81039cdfc4a2d3582d794bea0662b99 (diff)
Merge "Add animation to custom actions" into tm-qpr-dev am: 6687110d9f am: a9efe580c7 am: 9f6e5eb9b2 am: 5f3b784bd8
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/IntentResolver/+/21694670 Change-Id: I7789cc970c33c394e39223198c382b16b9c65927 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'java')
-rw-r--r--java/res/anim/slide_in_right.xml22
-rw-r--r--java/res/anim/slide_out_left.xml20
-rw-r--r--java/src/com/android/intentresolver/ChooserActionFactory.java14
3 files changed, 55 insertions, 1 deletions
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 @@
+<!--
+ ~ Copyright (C) 2023 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate android:fromXDelta="100%p" android:toXDelta="0"
+ android:duration="@android:integer/config_mediumAnimTime"/>
+ <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:duration="@android:integer/config_mediumAnimTime" />
+</set> \ 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 @@
+<!--
+ ~ Copyright (C) 2023 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate android:fromXDelta="0" android:toXDelta="-100%p"
+ android:duration="@android:integer/config_mediumAnimTime"/>
+</set> \ 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");
}