增加SubAbility的强制隐藏启动页.主要针对子ability启动startWindow的启动单独配置
This commit is contained in:
parent
1241061ce4
commit
c737830f17
@ -19,8 +19,8 @@
|
||||
{
|
||||
"name": "default",
|
||||
"signingConfig": "default",
|
||||
"targetSdkVersion": "6.1.0(23)",
|
||||
"compatibleSdkVersion": "6.1.0(23)",
|
||||
"targetSdkVersion": "6.0.2(22)",
|
||||
"compatibleSdkVersion": "6.0.2(22)",
|
||||
"runtimeOS": "HarmonyOS",
|
||||
"buildOption": {
|
||||
"nativeCompiler": "BiSheng",
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
import { window } from "@kit.ArkUI";
|
||||
import { common, Want } from "@kit.AbilityKit";
|
||||
import { common } from "@kit.AbilityKit";
|
||||
import {
|
||||
CheckExistDir,
|
||||
ExtractDir,
|
||||
HilogSadboxFontDirFile
|
||||
} from "./ExtractDir";
|
||||
import UIAbility from "@ohos.app.ability.UIAbility";
|
||||
|
||||
export function InitFonts(uac:common.UIAbilityContext):boolean{
|
||||
try {
|
||||
@ -16,7 +14,7 @@ export function InitFonts(uac:common.UIAbilityContext):boolean{
|
||||
console.info(`extract dir file to sandbox dir`);
|
||||
const fontsCopied = ExtractDir(uac, 'fonts');
|
||||
const exampleCopied = ExtractDir(uac, 'example');
|
||||
console.info(`restart app`);
|
||||
console.info(`ExtractResDir Done!`);
|
||||
}
|
||||
HilogSadboxFontDirFile(uac,'fonts');
|
||||
HilogSadboxFontDirFile(uac,'example');
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { AppStorageV2, display,window} from '@kit.ArkUI';
|
||||
import {mdwInfo,DisplayWindowInfo} from '../pages/dispwininfo/DispWinInfo'
|
||||
import {display,window} from '@kit.ArkUI';
|
||||
import {mdwInfo} from '../pages/dispwininfo/DispWinInfo'
|
||||
export function InitGlobalDWI(windowStage: window.WindowStage):boolean{
|
||||
//const mdwInfo = AppStorageV2.connect<DisplayWindowInfo>(DisplayWindowInfo, () => new DisplayWindowInfo())!;
|
||||
try{
|
||||
mdwInfo.displayId = display.getDefaultDisplaySync().id;
|
||||
mdwInfo.displayWidth = display.getDefaultDisplaySync().width;
|
||||
|
||||
@ -23,31 +23,34 @@ export default class SubAbility extends UIAbility {
|
||||
}
|
||||
//执行窗口参数
|
||||
InitWindowParam(winInfo:SubWinInfo){
|
||||
///window.shiftAppWindowFocus
|
||||
//Load page
|
||||
this.subWinStage?.loadContent(winInfo.page, (err) => {
|
||||
if (err.code) {
|
||||
hilog.error(DOMAIN, 'Tag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err));
|
||||
return;
|
||||
}
|
||||
//隐藏最大化,最小化,显示关闭
|
||||
this.subWin?.setWindowTitleButtonVisible(false, false, true)
|
||||
//禁止拖动改变窗口大小
|
||||
this.subWin?.setResizeByDragEnabled(false)
|
||||
//窗口出现坐标
|
||||
this.subWin?.moveWindowTo(winInfo.subPointX, winInfo.subPointY,(err) => {
|
||||
if (err.code) {
|
||||
console.error(`Failed to Move Init Point the window. Code: ${err.code}, message: ${err.message}`);
|
||||
return;
|
||||
}
|
||||
});
|
||||
//窗口Size
|
||||
console.info('SubWindowSize:',winInfo.width,winInfo.height);
|
||||
this.subWin?.resize(winInfo.width,winInfo.height, (err) => {
|
||||
if (err.code) {
|
||||
console.error(`Failed to resize the window. Code: ${err.code}, message: ${err.message}`);
|
||||
return;
|
||||
}
|
||||
});
|
||||
this.subWin?.setWindowTitle(winInfo.name)
|
||||
hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.');
|
||||
});
|
||||
|
||||
//moveWindowTo
|
||||
this.subWin?.moveWindowTo(winInfo.subPointX, winInfo.subPointY,(err) => {
|
||||
if (err.code) {
|
||||
console.error(`Failed to Move Init Point the window. Code: ${err.code}, message: ${err.message}`);
|
||||
return;
|
||||
}
|
||||
});
|
||||
//resize mainWindow Size
|
||||
console.info('SubWindowSize:',winInfo.width,winInfo.height);
|
||||
this.subWin?.resize(winInfo.width,winInfo.height, (err) => {
|
||||
if (err.code) {
|
||||
console.error(`Failed to resize the window. Code: ${err.code}, message: ${err.message}`);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
|
||||
this.want=want;
|
||||
@ -61,6 +64,7 @@ export default class SubAbility extends UIAbility {
|
||||
onWindowStageCreate(windowStage: window.WindowStage): void {
|
||||
if(this.subWinStage==undefined&&this.subWin==undefined){
|
||||
this.subWinStage=windowStage;
|
||||
this.subWinStage.removeStartingWindow()
|
||||
this.subWin = windowStage.getMainWindowSync();
|
||||
let ctx =this.context.getApplicationContext()
|
||||
ctx.eventHub.emit('SubWinInitialized',true);
|
||||
|
||||
@ -54,6 +54,7 @@
|
||||
"startWindowBackground": "$color:start_window_background",
|
||||
"exported": true,
|
||||
"launchType":"specified",
|
||||
"startWindow": "$profile:start_sub_window",
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"startWindowType": "REQUIRED_HIDE",
|
||||
"startWindowColorModeType": "FOLLOW_SYSTEM",
|
||||
"startWindowAppIcon": "$media:base_sub_background",
|
||||
"startWindowBrandingImage": "$media:base_sub_background",
|
||||
"startWindowBackgroundColor": "$color:start_window_background"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user