diff --git a/CustomTitleBarWindowDrag/entry/src/main/ets/pages/Index.ets b/CustomTitleBarWindowDrag/entry/src/main/ets/pages/Index.ets index ce22d3f867dcc473cc8a61c15166782be3d13c1d..62509d8daeb1dca35f235ce62a810dc948c4e81b 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 adbf32e7ecd11af11cda34b43d2284b690c72aa4..6a20ed4a4f388b68b937f5f96b9e1fbee3d83dff 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 544f8c9bd85ea92056aeab3745327ab78c41b388..7e40415a58422f7caea3c9adf1be2a41c2fcbacf 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 dd4c638a0689652584a9e0e435e72ac182e1ca3b..30d3a02f85a7f6ca3d758e6d28ce3fb103fb9b25 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 6a1ae4e0fce6d2ac55c784504b10e12c920a2b61..d368655860d0aae449831d6463189e2105a711d5 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 3e3f5257d941dcae8f2ae9f144661ff7a9abbee0..b3df1f9aaabad95d3a138f560413ca6212a43bfd 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}`) }) } }