From 8e8349019032fcb4d351343c3ef05b360ad516eb Mon Sep 17 00:00:00 2001 From: sfchu <183564171@qq.com> Date: Tue, 30 Sep 2025 14:17:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E6=A0=8F=E7=9A=84=E5=BA=94=E7=94=A8=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E9=AB=98=E6=80=A7=E8=83=BD=E6=8B=96=E5=8A=A8=E3=80=81?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=BA=94=E7=94=A8=E5=AD=90=E7=AA=97=E6=97=8B?= =?UTF-8?q?=E8=BD=AC=E5=8A=9F=E8=83=BD=E3=80=81=E4=B8=80=E5=A4=9A=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E9=80=82=E9=85=8D=E5=BC=80=E5=8F=91=E5=AE=9E=E8=B7=B5?= =?UTF-8?q?=20=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5=E9=85=8D=E5=A5=97?= =?UTF-8?q?=E5=B7=A5=E7=A8=8B=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entry/src/main/ets/pages/Index.ets | 6 ++-- .../main/ets/entryability/EntryAbility.ets | 6 ++-- .../entrybackupability/EntryBackupAbility.ets | 6 ++-- .../entry/src/main/ets/pages/Index.ets | 28 +++++++++---------- .../src/main/ets/components/WindowUtil.ets | 8 ++---- .../main/ets/entryability/EntryAbility.ets | 4 +-- 6 files changed, 26 insertions(+), 32 deletions(-) diff --git a/CustomTitleBarWindowDrag/entry/src/main/ets/pages/Index.ets b/CustomTitleBarWindowDrag/entry/src/main/ets/pages/Index.ets index ce22d3f8..62509d8d 100644 --- a/CustomTitleBarWindowDrag/entry/src/main/ets/pages/Index.ets +++ b/CustomTitleBarWindowDrag/entry/src/main/ets/pages/Index.ets @@ -17,9 +17,9 @@ import { BusinessError } from '@kit.BasicServicesKit'; import { window } from '@kit.ArkUI'; -const COLUMN_WIDTH = 108; -const COLUMN_TOP = 50; -const COLUMN_LEFT = 100; +const COLUMN_WIDTH: number = 108; +const COLUMN_TOP: number = 50; +const COLUMN_LEFT: number = 100; @Entry @Component diff --git a/SubwindowAdaptWhenRotate/entry/src/main/ets/entryability/EntryAbility.ets b/SubwindowAdaptWhenRotate/entry/src/main/ets/entryability/EntryAbility.ets index adbf32e7..6a20ed4a 100644 --- a/SubwindowAdaptWhenRotate/entry/src/main/ets/entryability/EntryAbility.ets +++ b/SubwindowAdaptWhenRotate/entry/src/main/ets/entryability/EntryAbility.ets @@ -18,9 +18,9 @@ import { hilog } from '@kit.PerformanceAnalysisKit'; import { window } from '@kit.ArkUI'; import { BusinessError } from '@kit.BasicServicesKit'; -const DOMAIN = 0x0000; -const TAG = 'EntryAbility'; -const FORMAT = '%{public}s'; +const DOMAIN: number = 0x0000; +const TAG: string = 'EntryAbility'; +const FORMAT: string = '%{public}s'; export default class EntryAbility extends UIAbility { onCreate(): void { diff --git a/SubwindowAdaptWhenRotate/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/SubwindowAdaptWhenRotate/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets index 544f8c9b..7e40415a 100644 --- a/SubwindowAdaptWhenRotate/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +++ b/SubwindowAdaptWhenRotate/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets @@ -16,9 +16,9 @@ import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; -const DOMAIN = 0x0000; -const TAG = 'EntryBackupAbility'; -const FORMAT = '%{public}s'; +const DOMAIN: number = 0x0000; +const TAG: string = 'EntryBackupAbility'; +const FORMAT: string = '%{public}s'; export default class EntryBackupAbility extends BackupExtensionAbility { async onBackup() { diff --git a/SubwindowAdaptWhenRotate/entry/src/main/ets/pages/Index.ets b/SubwindowAdaptWhenRotate/entry/src/main/ets/pages/Index.ets index dd4c638a..30d3a02f 100644 --- a/SubwindowAdaptWhenRotate/entry/src/main/ets/pages/Index.ets +++ b/SubwindowAdaptWhenRotate/entry/src/main/ets/pages/Index.ets @@ -18,16 +18,16 @@ import { window } from '@kit.ArkUI'; import { BusinessError } from '@kit.BasicServicesKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; -const SUB_WINDOW_LEFT_OFFSET = 50; -const SUB_WINDOW_TOP_OFFSET = 500; -const TAG = 'subWindowAdaptWhenRotate'; -const DOMAIN = 0x0000; +const SUB_WINDOW_LEFT_OFFSET: number = 50; +const SUB_WINDOW_TOP_OFFSET: number = 500; +const TAG: string = 'subWindowAdaptWhenRotate'; +const DOMAIN: number = 0x0000; @Entry @Component struct Index { - private mainWindow: window.Window | undefined = undefined; - private subWindow: window.Window | undefined = undefined; + public mainWindow: window.Window | undefined = undefined; + public subWindow: window.Window | undefined = undefined; aboutToAppear(): void { // create subWindow @@ -42,7 +42,7 @@ struct Index { }) } - private adjustSubwindowSizeAndPosition() { + private adjustSubwindowSizeAndPosition(): void { if (!this.subWindow) { hilog.error(DOMAIN, TAG, 'subWindow is null'); return; @@ -51,8 +51,7 @@ struct Index { try { subwindowRect = this.subWindow.getWindowProperties().windowRect; } catch (error) { - let err = error as BusinessError; - hilog.warn(0x000, 'testTag', `getWindowProperties failed, code=${err.code}, message=${err.message}`); + hilog.warn(0x000, 'testTag', `getWindowProperties failed, code: ${error.code}, message: ${error.message}`); } let newWidth: number = subwindowRect!.height; let newHeight: number = subwindowRect!.width; @@ -75,12 +74,12 @@ struct Index { } // [StartExclude rotate_sample] - private createSubWindow() { + private createSubWindow(): void { window.createWindow({ name: 'subWindow', windowType: window.WindowType.TYPE_DIALOG, ctx: this.getUIContext().getHostContext(), - }).then((subWindow) => { + }).then((subWindow: window.Window) => { this.subWindow = subWindow; if (!this.mainWindow) { @@ -90,8 +89,7 @@ struct Index { try { mainWindowRect = this.mainWindow.getWindowProperties().windowRect; } catch (error) { - let err = error as BusinessError; - hilog.warn(0x000, 'testTag', `getWindowProperties failed, code=${err.code}, message=${err.message}`); + hilog.warn(0x000, 'testTag', `getWindowProperties failed, code: ${error.code}, message: ${error.message}`); } let mainWindowWidth: number = mainWindowRect!.width; @@ -108,8 +106,8 @@ struct Index { try { this.subWindow?.setWindowBackgroundColor('#ff0000'); } catch (error) { - let err = error as BusinessError; - hilog.warn(0x000, 'testTag', `setWindowBackgroundColor failed, code=${err.code}, message=${err.message}`); + hilog.warn(0x000, 'testTag', + `setWindowBackgroundColor failed, code: ${error.code}, message: ${error.message}`); } this.subWindow?.showWindow().then(() => { hilog.info(DOMAIN, TAG, 'Show subwindow success'); diff --git a/bptaMultiWindow/entry/src/main/ets/components/WindowUtil.ets b/bptaMultiWindow/entry/src/main/ets/components/WindowUtil.ets index 6a1ae4e0..d3686558 100644 --- a/bptaMultiWindow/entry/src/main/ets/components/WindowUtil.ets +++ b/bptaMultiWindow/entry/src/main/ets/components/WindowUtil.ets @@ -41,8 +41,7 @@ export class WindowUtil { }); } } catch (error) { - let err = error as BusinessError; - hilog.warn(0x000, 'testTag', `getWindowStatus failed, code=${err.code}, message=${err.message}`); + hilog.warn(0x000, 'testTag', `getWindowStatus failed, code: ${error.code}, message: ${error.message}`); } } @@ -61,13 +60,10 @@ export class WindowUtil { }); } } catch (error) { - let err = error as BusinessError; - hilog.warn(0x000, 'testTag', `getWindowStatus failed, code=${err.code}, message=${err.message}`); + hilog.warn(0x000, 'testTag', `getWindowStatus failed, code: ${error.code}, message: ${error.message}`); } } - // [EndExclude maximize] } - // [End maximize] // [End recover] \ No newline at end of file diff --git a/bptaMultiWindow/entry/src/main/ets/entryability/EntryAbility.ets b/bptaMultiWindow/entry/src/main/ets/entryability/EntryAbility.ets index 3e3f5257..b3df1f9a 100644 --- a/bptaMultiWindow/entry/src/main/ets/entryability/EntryAbility.ets +++ b/bptaMultiWindow/entry/src/main/ets/entryability/EntryAbility.ets @@ -42,12 +42,12 @@ export default class EntryAbility extends UIAbility { windowClass.setWindowLayoutFullScreen(true) .catch((err: BusinessError) => { hilog.error(0x000, 'testTag', - `setWindowLayoutFullScreen failed, code=${err.code}, message=${err.message}`) + `setWindowLayoutFullScreen failed, code: ${err.code}, message: ${err.message}`) }) } }) .catch((err: BusinessError) => { - hilog.error(0x000, 'testTag', `getMainWindow failed, code=${err.code}, message=${err.message}`) + hilog.error(0x000, 'testTag', `getMainWindow failed, code: ${err.code}, message: ${err.message}`) }) } } -- Gitee