launcher启动不预加载应用中心

Signed-off-by: qano <nimaosen1@huawei.com>
This commit is contained in:
qano 2022-07-29 11:28:56 +08:00
parent 248dbec22a
commit 93a588db2c
4 changed files with 18 additions and 15 deletions

View File

@ -99,6 +99,7 @@ export class StyleConstants {
static readonly DEFAULT_56 = 56;
static readonly DEFAULT_60 = 60;
static readonly DEFAULT_80 = 80;
static readonly WINDOW_SHOW_DELAY: number = 150;
static readonly DEFAULT_DIVIDER_COLOR = 'rgb(207, 195, 195)';
static readonly DEFAULT_FOLDER_APP_ITEM_WIDTH = 36;
static readonly DEFAULT_FOLDER_APP_ITEM_WIDTH_SMALL = 45;

View File

@ -135,20 +135,25 @@ class WindowManager {
createWindow(context: ServiceExtensionContext, name: string, windowType: number, loadContent: string, isShow: boolean = true, callback?: Function) {
Window.create(context, name, windowType).then((win) => {
void win.loadContent(loadContent).then(() => {
Log.showInfo(TAG, `then begin ${name} window loadContent in then!`);
void win.setSystemBarProperties({
navigationBarColor: StyleConstants.DEFAULT_SYSTEM_UI_COLOR,
statusBarColor: StyleConstants.DEFAULT_SYSTEM_UI_COLOR
}).then(() => {
if (name !== this.RECENT_WINDOW_NAME) {
void win.setLayoutFullScreen(true).then(() => {
Log.showInfo(TAG, `${name} setLayoutFullScreen`);
});
}
if (callback) {
callback(win);
}
isShow && this.showWindow(name);
win.setBackgroundColor(StyleConstants.DEFAULT_SYSTEM_UI_COLOR, () => {
Log.showInfo(TAG, `then begin ${name} window loadContent in then!`);
if (name !== this.RECENT_WINDOW_NAME) {
void win.setLayoutFullScreen(true).then(() => {
Log.showInfo(TAG, `${name} setLayoutFullScreen`);
});
}
if (callback) {
callback(win);
}
// there is a low probability that white flashes when no delay because of setBackgroundColor is asynchronous
setTimeout(() => {
isShow && this.showWindow(name);
}, StyleConstants.WINDOW_SHOW_DELAY)
})
});
}, (error) => {
Log.showError(TAG, `createWindow, create error: ${JSON.stringify(error)}`);

View File

@ -53,9 +53,6 @@ export default class MainAbility extends ServiceExtension {
// load recent and AppCenter
windowManager.createRecentWindow();
windowManager.createWindow(globalThis.desktopContext, windowManager.APP_CENTER_WINDOW_NAME,
windowManager.DESKTOP_RANK, 'pages/' + windowManager.APP_CENTER_WINDOW_NAME, false);
}
private initGlobalConst(): void {
@ -91,7 +88,7 @@ export default class MainAbility extends ServiceExtension {
Log.showInfo(TAG,`onRequest, want: ${want.abilityName}`);
windowManager.minimizeAllApps();
windowManager.hideWindow(windowManager.RECENT_WINDOW_NAME);
windowManager.hideWindow(windowManager.APP_CENTER_WINDOW_NAME);
windowManager.destroyWindow(windowManager.APP_CENTER_WINDOW_NAME);
this.closeFolder();
this.closeRecentDockPopup();
}

View File

@ -68,7 +68,7 @@ struct AppCenterView {
onBackPress(): boolean {
Log.showInfo(TAG, `onBackPress`);
AppStorage.SetOrCreate('selectDesktopAppItem', '');
windowManager.hideWindow(windowManager.APP_CENTER_WINDOW_NAME);
windowManager.destroyWindow(windowManager.APP_CENTER_WINDOW_NAME);
return true;
}