!288 修改动效方案

Merge pull request !288 from 章超123/master
This commit is contained in:
openharmony_ci 2022-10-13 11:18:10 +00:00 committed by Gitee
commit 5697623ab2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 692 additions and 538 deletions

View File

@ -23,121 +23,139 @@ const TAG = 'CloseAppManager';
* close app manager * close app manager
*/ */
export class CloseAppManager { export class CloseAppManager {
private mBaseCloseAppHandlerList: Array<BaseCloseAppHandler> = new Array<BaseCloseAppHandler>(); private mBaseCloseAppHandlerList: Array<BaseCloseAppHandler> = new Array<BaseCloseAppHandler>();
private mPagedesktopCloseItemInfo: any; private mPagedesktopCloseItemInfo: any;
private mPagedesktopClosePosition: { private mPagedesktopClosePosition: {
appIconSize: number, appIconSize: number,
appIconHeight: number, appIconHeight: number,
appIconPositionX: number, appIconPositionX: number,
appIconPositionY: number appIconPositionY: number
} = { appIconSize: 0, } = { appIconSize: 0,
appIconHeight: 0, appIconHeight: 0,
appIconPositionX: 0, appIconPositionX: 0,
appIconPositionY: 0 }; appIconPositionY: 0 };
private mSmartdockCloseItemInfo: any; private mSmartdockCloseItemInfo: any;
private mSmartdockClosePosition: { private mSmartdockClosePosition: {
appIconSize: number, appIconSize: number,
appIconHeight: number, appIconHeight: number,
appIconPositionX: number, appIconPositionX: number,
appIconPositionY: number appIconPositionY: number
} = { appIconSize: 0, } = { appIconSize: 0,
appIconHeight: 0, appIconHeight: 0,
appIconPositionX: 0, appIconPositionX: 0,
appIconPositionY: 0 } appIconPositionY: 0 }
constructor() { constructor() {
}
static getInstance(): CloseAppManager {
if (globalThis.CloseAppManager == null) {
globalThis.CloseAppManager = new CloseAppManager();
}
return globalThis.CloseAppManager;
}
/**
* register baseCloseAppHandler to manager
*
* @param baseCloseAppHandler the instance of close app handler
*/
public registerCloseAppHandler(baseCloseAppHandler: BaseCloseAppHandler): void {
if (CheckEmptyUtils.isEmpty(baseCloseAppHandler)) {
Log.showError(TAG, `registerCloseAppHandler with invalid baseCloseAppHandler`)
return;
} }
static getInstance(): CloseAppManager { this.mBaseCloseAppHandlerList.push(baseCloseAppHandler);
if (globalThis.CloseAppManager == null) { Log.showInfo(TAG, `registerCloseAppHandler mBaseCloseAppHandlerList is ${this.mBaseCloseAppHandlerList.length}} `)
globalThis.CloseAppManager = new CloseAppManager(); }
}
return globalThis.CloseAppManager; /**
* unregister baseCloseAppHandler to manager
*
* @param baseCloseAppHandler the instance of close app handler
*/
public unregisterCloseAppHandler(baseCloseAppHandler: BaseCloseAppHandler): void {
if (CheckEmptyUtils.isEmpty(baseCloseAppHandler)) {
Log.showError(TAG, `unregisterCloseAppHandler with invalid baseCloseAppHandler`)
return;
} }
/** let index: number = 0;
* register baseCloseAppHandler to manager for (var i = 0; i < this.mBaseCloseAppHandlerList.length; i++) {
* if (this.mBaseCloseAppHandlerList[i] === baseCloseAppHandler) {
* @param baseCloseAppHandler the instance of close app handler index = i;
*/ break;
public registerCloseAppHandler(baseCloseAppHandler: BaseCloseAppHandler): void { }
if (CheckEmptyUtils.isEmpty(baseCloseAppHandler)) {
Log.showError(TAG, `registerCloseAppHandler with invalid baseCloseAppHandler`)
return;
}
this.mBaseCloseAppHandlerList.push(baseCloseAppHandler);
Log.showInfo(TAG, `registerCloseAppHandler mBaseCloseAppHandlerList is ${this.mBaseCloseAppHandlerList.length}} `)
} }
/** this.mBaseCloseAppHandlerList.splice(index, 1);
* unregister baseCloseAppHandler to manager Log.showInfo(TAG, `unregisterCloseAppHandler mBaseCloseAppHandlerList is ${this.mBaseCloseAppHandlerList.length}`)
* }
* @param baseCloseAppHandler the instance of close app handler
*/
public unregisterCloseAppHandler(baseCloseAppHandler: BaseCloseAppHandler): void {
if (CheckEmptyUtils.isEmpty(baseCloseAppHandler)) {
Log.showError(TAG, `unregisterCloseAppHandler with invalid baseCloseAppHandler`)
return;
}
let index: number = 0; /**
for (var i = 0; i < this.mBaseCloseAppHandlerList.length; i++) { * get app icon info
if (this.mBaseCloseAppHandlerList[i] === baseCloseAppHandler) { *
index = i; * @param windowTarget windowTarget close window target
break; */
} public getAppIconInfo(windowTarget): void {
} if (CheckEmptyUtils.isEmptyArr(this.mBaseCloseAppHandlerList)) {
Log.showError(TAG, `getAppIconInfo with invalid mBaseCloseAppHandlerList`);
this.mBaseCloseAppHandlerList.splice(index, 1); return;
Log.showInfo(TAG, `unregisterCloseAppHandler mBaseCloseAppHandlerList is ${this.mBaseCloseAppHandlerList.length}`)
} }
/** for (var i = 0; i < this.mBaseCloseAppHandlerList.length; i++) {
* get app icon info this.mBaseCloseAppHandlerList[i].getAppIconInfo(windowTarget);
* }
* @param windowTarget windowTarget close window target }
*/
public getAppIconInfo(windowTarget): void {
if (CheckEmptyUtils.isEmptyArr(this.mBaseCloseAppHandlerList)) {
Log.showError(TAG, `getAppIconInfo with invalid mBaseCloseAppHandlerList`);
return;
}
for (var i = 0; i < this.mBaseCloseAppHandlerList.length; i++) { /**
this.mBaseCloseAppHandlerList[i].getAppIconInfo(windowTarget); * get app icon info
} *
* @param windowTarget windowTarget close window target
*/
public getAppInfo(windowTarget): any {
if (CheckEmptyUtils.isEmptyArr(this.mBaseCloseAppHandlerList)) {
Log.showError(TAG, `getAppIconInfo with invalid mBaseCloseAppHandlerList`);
return {};
} }
public addPagedesktopClosePosition(pagedesktopCloseIconInfo: any, pagedesktopCloseItemInfo?: any) { for (var i = 0; i < this.mBaseCloseAppHandlerList.length; i++) {
Log.showDebug(TAG, `addPagedesktopClosePosition pagedesktopCloasIconInfo is ${JSON.stringify(pagedesktopCloseIconInfo)}`) this.mBaseCloseAppHandlerList[i].getAppIconInfo(windowTarget);
this.mPagedesktopClosePosition = pagedesktopCloseIconInfo;
this.mPagedesktopCloseItemInfo = pagedesktopCloseItemInfo;
} }
public addSmartDockClosePosition(smartdockCloseIconInfo: any, smartdockCloseItemInfo: any) { return {iconInfo: this.getAppCloseIconInfo(), appItemInfo: this.getAppCloseItemInfo()}
Log.showDebug(TAG, `addSmartDockClosePosition smartdockCloasIconInfo is ${JSON.stringify(smartdockCloseIconInfo)}`) }
this.mSmartdockClosePosition = smartdockCloseIconInfo;
this.mSmartdockCloseItemInfo = smartdockCloseItemInfo;
}
public getAppCloseIconInfo(): any{ public addPagedesktopClosePosition(pagedesktopCloseIconInfo: any, pagedesktopCloseItemInfo?: any) {
if (CheckEmptyUtils.isEmpty(this.mPagedesktopClosePosition)) { Log.showDebug(TAG, `addPagedesktopClosePosition pagedesktopCloasIconInfo is ${JSON.stringify(pagedesktopCloseIconInfo)}`)
Log.showDebug(TAG, `getAppCloseIconInfo return mSmartdockClosePosition is ${JSON.stringify(this.mSmartdockClosePosition)}`) this.mPagedesktopClosePosition = pagedesktopCloseIconInfo;
return this.mSmartdockClosePosition; this.mPagedesktopCloseItemInfo = pagedesktopCloseItemInfo;
} else { }
Log.showDebug(TAG, `getAppCloseIconInfo return mPagedesktopClosePosition is ${JSON.stringify(this.mPagedesktopClosePosition)}`)
return this.mPagedesktopClosePosition;
}
}
public getAppCloseItemInfo(): any{ public addSmartDockClosePosition(smartdockCloseIconInfo: any, smartdockCloseItemInfo: any) {
if (CheckEmptyUtils.isEmpty(this.mPagedesktopClosePosition)) { Log.showDebug(TAG, `addSmartDockClosePosition smartdockCloasIconInfo is ${JSON.stringify(smartdockCloseIconInfo)}`)
Log.showDebug(TAG, `getAppCloseIconInfo return mSmartdockClosePosition is ${JSON.stringify(this.mSmartdockClosePosition)}`) this.mSmartdockClosePosition = smartdockCloseIconInfo;
return this.mSmartdockCloseItemInfo; this.mSmartdockCloseItemInfo = smartdockCloseItemInfo;
} else { }
Log.showDebug(TAG, `getAppCloseIconInfo return mPagedesktopClosePosition is ${JSON.stringify(this.mPagedesktopClosePosition)}`)
return this.mPagedesktopCloseItemInfo; public getAppCloseIconInfo(): any{
} if (CheckEmptyUtils.isEmpty(this.mPagedesktopClosePosition)) {
Log.showDebug(TAG, `getAppCloseIconInfo return mSmartdockClosePosition is ${JSON.stringify(this.mSmartdockClosePosition)}`)
return this.mSmartdockClosePosition;
} else {
Log.showDebug(TAG, `getAppCloseIconInfo return mPagedesktopClosePosition is ${JSON.stringify(this.mPagedesktopClosePosition)}`)
return this.mPagedesktopClosePosition;
} }
}
public getAppCloseItemInfo(): any{
if (CheckEmptyUtils.isEmpty(this.mPagedesktopClosePosition)) {
Log.showDebug(TAG, `getAppCloseIconInfo return mSmartdockClosePosition is ${JSON.stringify(this.mSmartdockClosePosition)}`)
return this.mSmartdockCloseItemInfo;
} else {
Log.showDebug(TAG, `getAppCloseIconInfo return mPagedesktopClosePosition is ${JSON.stringify(this.mPagedesktopClosePosition)}`)
return this.mPagedesktopCloseItemInfo;
}
}
} }