From b294afcc33bbddc7038ecfb6aedcd1ee552005b1 Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Tue, 1 Apr 2025 22:21:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/application/MailBox.ets | 4 +--- entry/src/main/ets/application/PhotoAlbum.ets | 6 +----- entry/src/main/ets/application/Settings.ets | 6 ------ entry/src/main/ets/common/MailContent.ets | 6 ++---- entry/src/main/ets/common/MailNavigation.ets | 5 ++--- entry/src/main/ets/common/PhotoContent.ets | 3 +-- entry/src/main/ets/common/PhotoSideBar.ets | 3 +-- entry/src/main/ets/common/WlanItem.ets | 3 +-- entry/src/main/ets/entryability/EntryAbility.ets | 16 +++------------- entry/src/main/ets/pages/Index.ets | 6 ++---- 10 files changed, 14 insertions(+), 44 deletions(-) diff --git a/entry/src/main/ets/application/MailBox.ets b/entry/src/main/ets/application/MailBox.ets index 4b206d7..11240b8 100644 --- a/entry/src/main/ets/application/MailBox.ets +++ b/entry/src/main/ets/application/MailBox.ets @@ -13,7 +13,6 @@ * limitations under the License. */ import { BreakpointType } from '../common/BreakpointSystem'; - import { MailNavigation } from '../common/MailNavigation'; import { MailSideBar } from '../common/MailSideBar'; @@ -25,8 +24,7 @@ struct MailBox { @LocalStorageLink('currentBreakPoint') currentBreakPoint: string = 'md'; @State isFold: boolean = false; @State sideBarWidth: number = 304; - @StorageProp('topRectHeight') - topRectHeight: number = 0; + @StorageProp('topRectHeight') topRectHeight: number = 0; build() { GridRow() { diff --git a/entry/src/main/ets/application/PhotoAlbum.ets b/entry/src/main/ets/application/PhotoAlbum.ets index f070fd3..bb79582 100644 --- a/entry/src/main/ets/application/PhotoAlbum.ets +++ b/entry/src/main/ets/application/PhotoAlbum.ets @@ -14,7 +14,6 @@ */ import { BreakpointType } from '../common/BreakpointSystem'; import { CommonConstants } from '../common/CommonConstants'; - import { PhotoContent } from '../common/PhotoContent'; import { PhotoSideBar } from '../common/PhotoSideBar'; @@ -26,10 +25,7 @@ struct PhotoAlbum { @State sideBarStatus: boolean = true; @LocalStorageLink('currentBreakPoint') currentBreakPoint: string = 'sm'; @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; - @StorageProp('bottomRectHeight') - bottomRectHeight: number = 0; - @StorageProp('topRectHeight') - topRectHeight: number = 0; + @StorageProp('topRectHeight') topRectHeight: number = 0; build() { GridRow() { diff --git a/entry/src/main/ets/application/Settings.ets b/entry/src/main/ets/application/Settings.ets index b373479..a2c1887 100644 --- a/entry/src/main/ets/application/Settings.ets +++ b/entry/src/main/ets/application/Settings.ets @@ -13,8 +13,6 @@ * limitations under the License. */ import { BreakpointType } from '../common/BreakpointSystem'; -import { CommonConstants } from '../common/CommonConstants'; - import { MainItem } from '../common/SettingItem'; import { WlanItem } from '../common/WlanItem'; @@ -25,10 +23,6 @@ let storage = LocalStorage.getShared(); struct Settings { @State pathInfo: NavPathStack = new NavPathStack(); @LocalStorageLink('currentBreakPoint') currentBreakPoint: string = 'md'; - @StorageProp('bottomRectHeight') - bottomRectHeight: number = 0; - @StorageProp('topRectHeight') - topRectHeight: number = 0; @Builder myRouter(name: string, param?: number | undefined) { diff --git a/entry/src/main/ets/common/MailContent.ets b/entry/src/main/ets/common/MailContent.ets index cc9b2ef..83b767d 100644 --- a/entry/src/main/ets/common/MailContent.ets +++ b/entry/src/main/ets/common/MailContent.ets @@ -27,10 +27,8 @@ export struct MailContent { new OperateTabs($r('sys.symbol.dot_grid_2x2'), $r('app.string.more')), ] @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; - @StorageProp('bottomRectHeight') - bottomRectHeight: number = 0; - @StorageProp('topRectHeight') - topRectHeight: number = 0; + @StorageProp('bottomRectHeight') bottomRectHeight: number = 0; + @StorageProp('topRectHeight') topRectHeight: number = 0; build() { NavDestination() { diff --git a/entry/src/main/ets/common/MailNavigation.ets b/entry/src/main/ets/common/MailNavigation.ets index 4a458f5..05c21b9 100644 --- a/entry/src/main/ets/common/MailNavigation.ets +++ b/entry/src/main/ets/common/MailNavigation.ets @@ -22,11 +22,10 @@ export struct MailNavigation { @State currentIndex: number = 0; @State mailList: string[] = ['1', '1', '1', '1', '1', '1']; @LocalStorageProp('currentBreakPoint') currentBreakPoint: string = 'md'; - @StorageProp('topRectHeight') - topRectHeight: number = 0; + @StorageProp('topRectHeight') topRectHeight: number = 0; @Builder - myRouter(name: string, param?: number | undefined) { + myRouter() { MailContent() } diff --git a/entry/src/main/ets/common/PhotoContent.ets b/entry/src/main/ets/common/PhotoContent.ets index 3a01be3..a5b0a3d 100644 --- a/entry/src/main/ets/common/PhotoContent.ets +++ b/entry/src/main/ets/common/PhotoContent.ets @@ -32,8 +32,7 @@ export struct PhotoContent { @State columnsTemplate: string = '1fr 1fr 1fr'; @Link @Watch('onStateChange') sideBarStatus: boolean; @StorageProp('currentBreakpoint') currentBreakPoint: string = CommonConstants.BREAK_POINT_SM; - @StorageProp('topRectHeight') - topRectHeight: number = 0; + @StorageProp('topRectHeight') topRectHeight: number = 0; aboutToAppear() { if (this.sideBarStatus === true && this.currentBreakPoint === 'md') { diff --git a/entry/src/main/ets/common/PhotoSideBar.ets b/entry/src/main/ets/common/PhotoSideBar.ets index 2becec3..a545e72 100644 --- a/entry/src/main/ets/common/PhotoSideBar.ets +++ b/entry/src/main/ets/common/PhotoSideBar.ets @@ -31,8 +31,7 @@ export struct PhotoSideBar { new PhotoType($r('app.string.hidden'), 1), ]; @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; - @StorageProp('topRectHeight') - topRectHeight: number = 0; + @StorageProp('topRectHeight') topRectHeight: number = 0; build() { Column() { diff --git a/entry/src/main/ets/common/WlanItem.ets b/entry/src/main/ets/common/WlanItem.ets index 58f2f45..2339310 100644 --- a/entry/src/main/ets/common/WlanItem.ets +++ b/entry/src/main/ets/common/WlanItem.ets @@ -21,8 +21,7 @@ import { BreakpointType } from './BreakpointSystem'; export struct WlanItem { @State netWorkStatus: Resource = $r('app.string.closed'); @LocalStorageProp('currentBreakPoint') currentBreakPoint: string = 'md'; - @StorageProp('topRectHeight') - topRectHeight: number = 0; + @StorageProp('topRectHeight') topRectHeight: number = 0; @Builder CustomDivider() { diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index d0db6a5..91bd278 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -13,14 +13,13 @@ * limitations under the License. */ -import { Configuration, ConfigurationConstant, UIAbility } from '@kit.AbilityKit'; +import { ConfigurationConstant, UIAbility } from '@kit.AbilityKit'; import { display, window } from '@kit.ArkUI'; import { hilog } from '@kit.PerformanceAnalysisKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { resourceManager } from '@kit.LocalizationKit'; export default class EntryAbility extends UIAbility { - private windowObj?: window.Window; private curBp: string = ''; private updateBreakpoint(windowWidth: number): void { @@ -39,7 +38,8 @@ export default class EntryAbility extends UIAbility { AppStorage.setOrCreate('currentBreakpoint', this.curBp); } } catch (exception) { - hilog.error(0x0000, 'testTag', `UpdateBreakpoint fail, error message${JSON.stringify(exception)}`); + hilog.error(0x0000, 'testTag', + `UpdateBreakpoint fail, error message${JSON.stringify((exception as BusinessError).code)}`); } } @@ -49,15 +49,6 @@ export default class EntryAbility extends UIAbility { this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); } - onConfigurationUpdate(newConfig: Configuration): void { - let newColorMode: ConfigurationConstant.ColorMode = - newConfig.colorMode || ConfigurationConstant.ColorMode.COLOR_MODE_DARK; - let currentColorMode = AppStorage.get('systemColorMode'); - if (newColorMode !== currentColorMode) { - AppStorage.setOrCreate('systemColorMode', newColorMode); - } - } - onDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } @@ -72,7 +63,6 @@ export default class EntryAbility extends UIAbility { avoidArea = windowObj.getWindowAvoidArea(type); let topRectHeight = avoidArea.topRect.height; AppStorage.setOrCreate('topRectHeight', topRectHeight); - this.windowObj = windowObj; this.updateBreakpoint(windowObj.getWindowProperties().windowRect.width); windowObj.on('windowSizeChange', (windowSize) => { this.updateBreakpoint(windowSize.width); diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 17e4f81..f12350b 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -20,10 +20,8 @@ import { CommonConstants, Route } from '../common/CommonConstants'; @Component struct Index { @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; - @StorageProp('bottomRectHeight') - bottomRectHeight: number = 0; - @StorageProp('topRectHeight') - topRectHeight: number = 0; + @StorageProp('bottomRectHeight') bottomRectHeight: number = 0; + @StorageProp('topRectHeight') topRectHeight: number = 0; private routes: Route[] = CommonConstants.ROUTES; build() { -- Gitee