diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 48493455..55cbdf9d 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -1,15 +1,17 @@ import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; -import { window, display, AppStorageV2 } from '@kit.ArkUI'; +import { window, display, AppStorageV2, ColorMetrics } from '@kit.ArkUI'; import { IBestInit } from "@ibestservices/ibest-ui-v2" import {ExtractDir,CheckExistDir,HilogSadboxFontDirFile} from "../pages/ExtractDir/ExtractDir" -import {MainWindowStageInfo,InitGlobalDisplayWindowInfo,mwInfo}from '../pages/DispWinInfo/DispWinInfo' +import {MainWindowStageInfo,InitGlobalDisplayWindowInfo,mwInfo, mwsInfo}from '../pages/DispWinInfo/DispWinInfo' const DOMAIN = 0x0000; export default class EntryAbility extends UIAbility { private mainWindow: window.Window | undefined; + private subWindow: window.Window | undefined = undefined; onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + //InitFont->Copy Res/resfile/font to sandbox let sbFontsDir=this.context?.filesDir + '/fonts/'; let sbExampleDir=this.context?.filesDir + '/example/'; try { @@ -45,9 +47,16 @@ export default class EntryAbility extends UIAbility { } onWindowStageCreate(windowStage: window.WindowStage): void { - //InitFont->Copy Res/resfile/font to sandbox - InitGlobalDisplayWindowInfo(windowStage); + //Load page + windowStage.loadContent('pages/Index', (err) => { + if (err.code) { + hilog.error(DOMAIN, 'Tag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); + return; + } + IBestInit(windowStage, this.context); + hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.'); + }); //Get Main Window windowStage.getMainWindow((err, data) => { @@ -76,15 +85,13 @@ export default class EntryAbility extends UIAbility { console.info('Succeeded in enabling the listener for window size changes. Data:' + ChangeData.width, ChangeData.height); }); - }); - //Load page - windowStage.loadContent('pages/Index', (err) => { - if (err.code) { - hilog.error(DOMAIN, 'Tag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); - return; - } - IBestInit(windowStage, this.context); - hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.'); + let color: string = '#00000000'; + try { + this.mainWindow.setWindowBackgroundColor(color); + this.mainWindow.setWindowShadowEnabled(true); + } catch (exception) { + console.error(`Failed to set the background color. Cause code: ${exception.code}, message: ${exception.message}`); + }; }); } diff --git a/entry/src/main/ets/pages/EventSubWin/SWBase.ets b/entry/src/main/ets/pages/EventSubWin/SWBase.ets index 4ac9a262..47fad6d5 100644 --- a/entry/src/main/ets/pages/EventSubWin/SWBase.ets +++ b/entry/src/main/ets/pages/EventSubWin/SWBase.ets @@ -34,7 +34,7 @@ export async function CreateAndShowSubWindow(winInfo:WinInfo) { await mwsInfo.winStage.createSubWindowWithOptions('subWindow', options).then((data) => { subWindow = data; //子窗口创建成功后,设置子窗口的位置、大小及相关属性等。 - subWindow.moveWindowTo(50, 50) + subWindow.moveWindowTo(200, 200) //子窗口重置大小 console.info("页面路径:", winInfo.page); subWindow.resize(winInfo.width,winInfo.height); diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 39fa1be3..1510bdb3 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -16,20 +16,19 @@ struct Index { @Local isDragging:boolean=false; @Provider('LeftSideWidth') leftSideWidth:number=mwInfo.width * 0.1; @Provider('RightSideWidth') rightSideWidth:number=mwInfo.width * 0.1; - private uiContext: UIContext = this.getUIContext(); - private overlayManager: OverlayManager = this.uiContext.getOverlayManager(); - private componentContent: ComponentContent | null = null; - + @Local overlayState:boolean=true; build() { + Stack({ alignContent: Alignment.Top }) { //OpenCAX主界面整体布局,采用多行布局 Column() { //头部导航功能区 - TitleTab().height('15%') + Blank().height(this.overlayState?'15%':'0%') + //TitleTab().height('15%') //分割线 Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) //工具栏 Row() { - TitleColumnSub() + TitleColumnSub({ subOverlayState:this.overlayState!! }) }.height('4%') .align(Alignment.Start) @@ -37,7 +36,7 @@ struct Index { Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) Row() { //左侧边导航区 - LeftSideTab() + LeftSideTab().width(this.overlayState?this.leftSideWidth:'0%') // 左拖拽手柄 Divider().vertical(true).strokeWidth(3).lineCap(LineCapStyle.Round).height('100%').backgroundColor(Color.Grey) .onMouse((event) => { @@ -80,8 +79,8 @@ struct Index { } }) //右侧边导航区 - RightSideTab() - }.height('77%') + RightSideTab().width(this.overlayState?this.rightSideWidth:'0%') + }.height(this.overlayState?'77%':'92%') //分割线 Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) ///状态栏 @@ -92,7 +91,15 @@ struct Index { .alignItems(HorizontalAlign.Start) .justifyContent(FlexAlign.Center) .height('4%') - }.width('100%') - .height('100%') + } + TitleTab() + .height(this.overlayState?'15%':'0%') + .backgroundColor(Color.Transparent) + .backgroundBlurStyle(BlurStyle.Thin, { colorMode: ThemeColorMode.LIGHT, adaptiveColor: AdaptiveColor.DEFAULT, scale: 1.0 }) + + }.width('100%') + .height('100%') + .backgroundColor(Color.Transparent) + .backgroundBlurStyle(BlurStyle.Thin, { colorMode: ThemeColorMode.LIGHT, adaptiveColor: AdaptiveColor.DEFAULT, scale: 1.0 }) } } diff --git a/entry/src/main/ets/pages/RightSideLayout/RightSideTab.ets b/entry/src/main/ets/pages/RightSideLayout/RightSideTab.ets index 1c0d7038..807bdd92 100644 --- a/entry/src/main/ets/pages/RightSideLayout/RightSideTab.ets +++ b/entry/src/main/ets/pages/RightSideLayout/RightSideTab.ets @@ -14,10 +14,12 @@ export struct RightSideTab { Column({space:1}){ Tabs({ barPosition: BarPosition.Start, controller: this.leftSideBarTabs }) { TabContent() { - } + }.barHeight(0) + Blank().layoutWeight(1) }.width(this.isExpanded?this.rightSideWidth:0) + Column({space:1}){ Button() .backgroundImagePosition({ x: '5%', y: '5%' }) diff --git a/entry/src/main/ets/pages/TitleLayout/TitleColumnSub.ets b/entry/src/main/ets/pages/TitleLayout/TitleColumnSub.ets index 8b019cf2..5c2c8c8d 100644 --- a/entry/src/main/ets/pages/TitleLayout/TitleColumnSub.ets +++ b/entry/src/main/ets/pages/TitleLayout/TitleColumnSub.ets @@ -17,6 +17,8 @@ export struct TitleColumnSub { @Local dX:number=0; @Local dY:number=0; @Local viewDialog:CustomDialogController|undefined=undefined; + @Param subOverlayState: boolean = true; + @Event $subOverlayState: (val: boolean) => void = (val: boolean) => {}; //文件操作目录数据初始化 private ViewDialog(): CustomDialogController { @@ -62,6 +64,10 @@ export struct TitleColumnSub { height: '80%' // 图片高度占满按钮 }) SubColumnMenu({menus:DisplayMode}) + Blank().layoutWeight(1) + Button('TabsBar显示/隐藏').onClick(()=>{ + this.$subOverlayState(!this.subOverlayState); + }) }.width('100%') .height('100%') .backgroundBlurStyle(BlurStyle.Thin, diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index d384a614..c06fd370 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -14,6 +14,9 @@ "requestPermissions": [ { "name": "ohos.permission.INPUT_MONITORING", + }, + { + "name": "ohos.permission.SET_WINDOW_TRANSPARENT", } ], "abilities": [ diff --git a/entry/src/main/resources/base/element/color.json b/entry/src/main/resources/base/element/color.json index 3c712962..d8806492 100644 --- a/entry/src/main/resources/base/element/color.json +++ b/entry/src/main/resources/base/element/color.json @@ -2,7 +2,7 @@ "color": [ { "name": "start_window_background", - "value": "#FFFFFF" + "value": "#00000000" } ] } \ No newline at end of file