• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkUI
19 */
20
21import { AsyncCallback } from './@ohos.base';
22
23/**
24 * Window animation manager.
25 *
26 * @namespace windowAnimationManager
27 * @syscap SystemCapability.WindowManager.WindowManager.Core
28 * @systemapi Hide this for inner system use.
29 * @since 9
30 */
31declare namespace windowAnimationManager {
32  /**
33   * Set the window animation controller.
34   *
35   * @param { WindowAnimationController } controller - Window animation controller.
36   * @syscap SystemCapability.WindowManager.WindowManager.Core
37   * @systemapi Hide this for inner system use.
38   * @since 9
39   */
40  function setController(controller: WindowAnimationController): void;
41
42  /**
43   * Minimize the window target with animation.
44   *
45   * @param { WindowAnimationTarget } windowTarget - The window target to be minimized.
46   * @param { AsyncCallback<WindowAnimationFinishedCallback> } callback - Returns the animation finished callback.
47   * @syscap SystemCapability.WindowManager.WindowManager.Core
48   * @systemapi Hide this for inner system use.
49   * @since 9
50   */
51  function minimizeWindowWithAnimation(windowTarget: WindowAnimationTarget,
52    callback: AsyncCallback<WindowAnimationFinishedCallback>): void;
53
54  /**
55   * Minimize the window target with animation.
56   *
57   * @param { WindowAnimationTarget }windowTarget - The window target to be minimized.
58   * @returns { Promise<WindowAnimationFinishedCallback> } Promise used to return the animation finished callback.
59   * @syscap SystemCapability.WindowManager.WindowManager.Core
60   * @systemapi Hide this for inner system use.
61   * @since 9
62   */
63  function minimizeWindowWithAnimation(windowTarget: WindowAnimationTarget): Promise<WindowAnimationFinishedCallback>;
64
65  /**
66   * Round rect.
67   *
68   * @interface RRect
69   * @syscap SystemCapability.WindowManager.WindowManager.Core
70   * @systemapi Hide this for inner system use.
71   * @since 9
72   */
73  export interface RRect {
74    /**
75     * The X-axis coordinate of the upper left vertex of the round rect, in pixels.
76     * @type { number }
77     * @syscap SystemCapability.WindowManager.WindowManager.Core
78     * @systemapi Hide this for inner system use.
79     * @since 9
80     */
81    left: number;
82
83    /**
84     * The Y-axis coordinate of the upper left vertex of the round rect, in pixels.
85     * @type { number }
86     * @syscap SystemCapability.WindowManager.WindowManager.Core
87     * @systemapi Hide this for inner system use.
88     * @since 9
89     */
90    top: number;
91
92    /**
93     * Width of the round rect, in pixels.
94     * @type { number }
95     * @syscap SystemCapability.WindowManager.WindowManager.Core
96     * @systemapi Hide this for inner system use.
97     * @since 9
98     */
99    width: number;
100
101    /**
102     * Height of the round rect, in pixels.
103     * @type { number }
104     * @syscap SystemCapability.WindowManager.WindowManager.Core
105     * @systemapi Hide this for inner system use.
106     * @since 9
107     */
108    height: number;
109
110    /**
111     * Radius of the round corner of the round rect, in pixels.
112     * @type { number }
113     * @syscap SystemCapability.WindowManager.WindowManager.Core
114     * @systemapi Hide this for inner system use.
115     * @since 9
116     */
117    radius: number;
118  }
119
120  /**
121   * Window animation target.
122   *
123   * @interface WindowAnimationTarget
124   * @syscap SystemCapability.WindowManager.WindowManager.Core
125   * @systemapi Hide this for inner system use.
126   * @since 9
127   */
128  export interface WindowAnimationTarget {
129    /**
130     * The bundle name of the window animation target.
131     * @type { string }
132     * @readonly
133     * @syscap SystemCapability.WindowManager.WindowManager.Core
134     * @systemapi Hide this for inner system use.
135     * @since 9
136     */
137    readonly bundleName: string;
138
139    /**
140    /* The ability name of the window animation target.
141     * @type { string }
142     * @readonly
143     * @syscap SystemCapability.WindowManager.WindowManager.Core
144     * @systemapi Hide this for inner system use.
145     * @since 9
146     */
147    readonly abilityName: string;
148
149    /**
150    /* The window bounds of the window animation target.
151     * @type { RRect }
152     * @readonly
153     * @syscap SystemCapability.WindowManager.WindowManager.Core
154     * @systemapi Hide this for inner system use.
155     * @since 9
156     */
157    readonly windowBounds: RRect;
158
159    /**
160    /* The mission id of the window animation target.
161     * @type { number }
162     * @readonly
163     * @syscap SystemCapability.WindowManager.WindowManager.Core
164     * @systemapi Hide this for inner system use.
165     * @since 9
166     */
167    readonly missionId: number;
168  }
169
170  /**
171   * Window animation finished callback.
172   *
173   * @interface WindowAnimationFinishedCallback
174   * @syscap SystemCapability.WindowManager.WindowManager.Core
175   * @systemapi Hide this for inner system use.
176   * @since 9
177   */
178  export interface WindowAnimationFinishedCallback {
179    /**
180     * The function of window animation finished callback.
181     *
182     * @syscap SystemCapability.WindowManager.WindowManager.Core
183     * @systemapi Hide this for inner system use.
184     * @since 9
185     */
186    onAnimationFinish(): void;
187  }
188
189  /**
190   * Window animation controller.
191   *
192   * @interface WindowAnimationController
193   * @syscap SystemCapability.WindowManager.WindowManager.Core
194   * @systemapi Hide this for inner system use.
195   * @since 9
196   */
197  export interface WindowAnimationController {
198    /**
199     * Called on starting an application form launcher.
200     *
201     * @param { WindowAnimationTarget } startingWindowTarget  - indicates Window target of the starting application.
202     * @param { WindowAnimationFinishedCallback } finishCallback - Animation finished callback.
203     * @syscap SystemCapability.WindowManager.WindowManager.Core
204     * @systemapi Hide this for inner system use.
205     * @since 9
206     */
207    onStartAppFromLauncher(startingWindowTarget: WindowAnimationTarget,
208      finishCallback: WindowAnimationFinishedCallback): void;
209
210    /**
211     * Called on starting an application form recent.
212     *
213     * @param { WindowAnimationTarget } startingWindowTarget - Window target of the starting application.
214     * @param { WindowAnimationFinishedCallback } finishCallback - Animation finished callback.
215     * @syscap SystemCapability.WindowManager.WindowManager.Core
216     * @systemapi Hide this for inner system use.
217     * @since 9
218     */
219    onStartAppFromRecent(startingWindowTarget: WindowAnimationTarget,
220      finishCallback: WindowAnimationFinishedCallback): void;
221
222    /**
223     * Called on starting an application form other.
224     *
225     * @param { WindowAnimationTarget } startingWindowTarget - Window target of the starting application.
226     * @param { WindowAnimationFinishedCallback } finishCallback - Animation finished callback.
227     * @syscap SystemCapability.WindowManager.WindowManager.Core
228     * @systemapi Hide this for inner system use.
229     * @since 9
230     */
231    onStartAppFromOther(startingWindowTarget: WindowAnimationTarget,
232      finishCallback: WindowAnimationFinishedCallback): void;
233
234    /**
235     * Called on application transition.
236     *
237     * @param { WindowAnimationTarget } fromWindowTarget - Window target of the source application.
238     * @param { WindowAnimationTarget } toWindowTarget - Window target of the destination application.
239     * @param { WindowAnimationFinishedCallback } finishCallback - Animation finished callback.
240     * @syscap SystemCapability.WindowManager.WindowManager.Core
241     * @systemapi Hide this for inner system use.
242     * @since 9
243     */
244    onAppTransition(fromWindowTarget: WindowAnimationTarget, toWindowTarget: WindowAnimationTarget,
245      finishCallback: WindowAnimationFinishedCallback): void;
246
247    /**
248     * Called on minimizing a window.
249     *
250     * @param { WindowAnimationTarget } minimizingWindowTarget - Window target of the minimizing window.
251     * @param { WindowAnimationFinishedCallback } finishCallback - Animation finished callback.
252     * @syscap SystemCapability.WindowManager.WindowManager.Core
253     * @systemapi Hide this for inner system use.
254     * @since 9
255     */
256    onMinimizeWindow(minimizingWindowTarget: WindowAnimationTarget,
257      finishCallback: WindowAnimationFinishedCallback): void;
258
259    /**
260     * Called on closing a window.
261     *
262     * @param { WindowAnimationTarget }closingWindowTarget - Window target of the closing window.
263     * @param { WindowAnimationFinishedCallback } finishCallback - Animation finished callback.
264     * @syscap SystemCapability.WindowManager.WindowManager.Core
265     * @systemapi Hide this for inner system use.
266     * @since 9
267     */
268    onCloseWindow(closingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void;
269
270    /**
271     * Called on unlocking the screen.
272     *
273     * @param {WindowAnimationFinishedCallback } finishCallback - Animation finished callback.
274     * @syscap SystemCapability.WindowManager.WindowManager.Core
275     * @systemapi Hide this for inner system use.
276     * @since 9
277     */
278    onScreenUnlock(finishCallback: WindowAnimationFinishedCallback): void;
279
280
281    /**
282     * Called on window animation targets update.
283     *
284     * @param { WindowAnimationTarget } fullScreenWindowTarget - The fullscreen window target.
285     * @param { Array<WindowAnimationTarget> } floatingWindowTargets - All the floating window targets.
286     * @syscap SystemCapability.WindowManager.WindowManager.Core
287     * @systemapi Hide this for inner system use.
288     * @since 9
289     */
290    onWindowAnimationTargetsUpdate(fullScreenWindowTarget: WindowAnimationTarget,
291      floatingWindowTargets: Array<WindowAnimationTarget>): void;
292  }
293}
294
295export default windowAnimationManager;
296