Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 1 | package android.view; |
| 2 | |
Winson Chung | a31922f | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 3 | import android.graphics.GraphicBuffer; |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 4 | import android.graphics.Rect; |
| 5 | import android.os.Parcel; |
| 6 | import android.os.Parcelable; |
| 7 | |
| 8 | /** |
| 9 | * Holds information about how the next app transition animation should be executed. |
| 10 | * |
| 11 | * This class is intended to be used with IWindowManager.overridePendingAppTransition* methods when |
| 12 | * simple arguments are not enough to describe the animation. |
| 13 | * |
| 14 | * @hide |
| 15 | */ |
| 16 | public class AppTransitionAnimationSpec implements Parcelable { |
| 17 | public final int taskId; |
Winson Chung | a31922f | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 18 | public final GraphicBuffer buffer; |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 19 | public final Rect rect; |
| 20 | |
Winson Chung | a31922f | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 21 | public AppTransitionAnimationSpec(int taskId, GraphicBuffer buffer, Rect rect) { |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 22 | this.taskId = taskId; |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 23 | this.rect = rect; |
Winson Chung | a31922f | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 24 | this.buffer = buffer; |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | public AppTransitionAnimationSpec(Parcel in) { |
| 28 | taskId = in.readInt(); |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 29 | rect = in.readParcelable(null); |
Winson Chung | a31922f | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 30 | buffer = in.readParcelable(null); |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | @Override |
| 34 | public int describeContents() { |
| 35 | return 0; |
| 36 | } |
| 37 | |
| 38 | @Override |
| 39 | public void writeToParcel(Parcel dest, int flags) { |
| 40 | dest.writeInt(taskId); |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 41 | dest.writeParcelable(rect, 0 /* flags */); |
Winson Chung | a31922f | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 42 | dest.writeParcelable(buffer, 0); |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | public static final Parcelable.Creator<AppTransitionAnimationSpec> CREATOR |
| 46 | = new Parcelable.Creator<AppTransitionAnimationSpec>() { |
| 47 | public AppTransitionAnimationSpec createFromParcel(Parcel in) { |
| 48 | return new AppTransitionAnimationSpec(in); |
| 49 | } |
| 50 | |
| 51 | public AppTransitionAnimationSpec[] newArray(int size) { |
| 52 | return new AppTransitionAnimationSpec[size]; |
| 53 | } |
| 54 | }; |
| 55 | |
| 56 | @Override |
| 57 | public String toString() { |
Winson Chung | a31922f | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 58 | return "{taskId: " + taskId + ", buffer: " + buffer + ", rect: " + rect + "}"; |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 59 | } |
| 60 | } |