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