Debian Codegraph @

core/java/android/window/TaskFragmentAnimationParams.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package android.window;
18
19 import android.annotation.ColorInt;
20 import android.annotation.NonNull;
21 import android.annotation.Nullable;
22 import android.os.Parcel;
23 import android.os.Parcelable;
24
25 /**
26 * Data object for animation related override of TaskFragment.
27 * @hide
28 */
29 // TODO(b/206557124): Add more animation customization options.
30 public final class TaskFragmentAnimationParams implements Parcelable {
31
32 /** The default {@link TaskFragmentAnimationParams} to use when there is no app override. */
33 public static final TaskFragmentAnimationParams DEFAULT =
34 new TaskFragmentAnimationParams.Builder().build();
35
36 @ColorInt
37 private final int mAnimationBackgroundColor;
38
39 private TaskFragmentAnimationParams(@ColorInt int animationBackgroundColor) {
40 mAnimationBackgroundColor = animationBackgroundColor;
41 }
42
43 /**
44 * The {@link ColorInt} to use for the background during the animation with this TaskFragment if
45 * the animation requires a background.
46 *
47 * The default value is {@code 0}, which is to use the theme window background.
48 */
49 @ColorInt
50 public int getAnimationBackgroundColor() {
51 return mAnimationBackgroundColor;
52 }
53
54 private TaskFragmentAnimationParams(Parcel in) {
55 mAnimationBackgroundColor = in.readInt();
56 }
57
58 @Override
59 public void writeToParcel(@NonNull Parcel dest, int flags) {
60 dest.writeInt(mAnimationBackgroundColor);
61 }
62
63 @NonNull
64 public static final Creator<TaskFragmentAnimationParams> CREATOR =
65 new Creator<TaskFragmentAnimationParams>() {
66 @Override
67 public TaskFragmentAnimationParams createFromParcel(Parcel in) {
68 return new TaskFragmentAnimationParams(in);
69 }
70
71 @Override
72 public TaskFragmentAnimationParams[] newArray(int size) {
73 return new TaskFragmentAnimationParams[size];
74 }
75 };
76
77 @Override
78 public String toString() {
79 return "TaskFragmentAnimationParams{"
80 + " animationBgColor=" + Integer.toHexString(mAnimationBackgroundColor)
81 + "}";
82 }
83
84 @Override
85 public int hashCode() {
86 return mAnimationBackgroundColor;
87 }
88
89 @Override
90 public boolean equals(@Nullable Object obj) {
91 if (!(obj instanceof TaskFragmentAnimationParams)) {
92 return false;
93 }
94 final TaskFragmentAnimationParams other = (TaskFragmentAnimationParams) obj;
95 return mAnimationBackgroundColor == other.mAnimationBackgroundColor;
96 }
97
98 @Override
99 public int describeContents() {
100 return 0;
101 }
102
103 /** Builder to construct the {@link TaskFragmentAnimationParams}. */
104 public static final class Builder {
105
106 @ColorInt
107 private int mAnimationBackgroundColor = 0;
108
109 /**
110 * Sets the {@link ColorInt} to use for the background during the animation with this
111 * TaskFragment if the animation requires a background. The default value is
112 * {@code 0}, which is to use the theme window background.
113 *
114 * @param color a packed color int, {@code AARRGGBB}, for the animation background color.
115 * @return this {@link Builder}.
116 */
117 @NonNull
118 public Builder setAnimationBackgroundColor(@ColorInt int color) {
119 mAnimationBackgroundColor = color;
120 return this;
121 }
122
123 /** Constructs the {@link TaskFragmentAnimationParams}. */
124 @NonNull
125 public TaskFragmentAnimationParams build() {
126 return new TaskFragmentAnimationParams(mAnimationBackgroundColor);
127 }
128 }
129 }