From dd4ae655bedad3e054980594de4eaf8eac5353b7 Mon Sep 17 00:00:00 2001 From: dhf <1511447814@qq.com> Date: Thu, 27 Feb 2025 15:02:21 +0800 Subject: [PATCH 1/7] =?UTF-8?q?readme=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 ++++------- README_EN.md | 8 ++++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d5daa9f..3dcb99d 100644 --- a/README.md +++ b/README.md @@ -106,10 +106,7 @@ ### 约束与限制 -1. 本示例仅支持标准系统上运行,支持设备:华为手机。 - -2. HarmonyOS系统:HarmonyOS NEXT Developer Beta1及以上。 - -3. DevEco Studio版本:DevEco Studio NEXT Developer Beta1及以上。 - -4. HarmonyOS SDK版本:HarmonyOS NEXT Developer Beta1 SDK及以上。 +1. 本示例仅支持标准系统上运行,支持设备:华为手机、平板、2in1。 +2. HarmonyOS系统:HarmonyOS 5.0.0 Release及以上。 +3. DevEco Studio版本:DevEco Studio 5.0.0 Release及以上。 +4. HarmonyOS SDK版本:HarmonyOS 5.0.0 Release SDK及以上。 diff --git a/README_EN.md b/README_EN.md index 3241a46..2ee200a 100644 --- a/README_EN.md +++ b/README_EN.md @@ -106,10 +106,10 @@ N/A ### Constraints -1. The sample app is supported only on Huawei phones running the standard system. +1. The sample app is supported on Huawei phones, tablets, and 2in1 running the standard system. -2. The HarmonyOS version must be HarmonyOS NEXT Developer Beta1 or later. +2. The HarmonyOS version must be HarmonyOS 5.0.0 Release or later. -3. The DevEco Studio version must be DevEco Studio NEXT Developer Beta1 or later. +3. The DevEco Studio version must be DevEco Studio 5.0.0 Release or later. -4. The HarmonyOS SDK version must be HarmonyOS NEXT Developer Beta1 or later. +4. The HarmonyOS SDK version must be HarmonyOS 5.0.0 Release or later. -- Gitee From b5a81d19190a574c4f276fb7c6f33ebb01fae158 Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Mon, 3 Mar 2025 17:31:41 +0800 Subject: [PATCH 2/7] =?UTF-8?q?HMOSWorld=E6=95=B4=E6=94=B9=20(1)UX?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC=E9=80=82=E9=85=8D;=20(2)=E6=B7=B1=E6=B5=85?= =?UTF-8?q?=E8=89=B2=E9=80=82=E9=85=8D;=20(3)=E6=B2=89=E6=B5=B8=E5=BC=8F?= =?UTF-8?q?=E9=80=82=E9=85=8D;=20(4)=E4=B8=80=E5=A4=9A=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=95=B4=E6=94=B9;=20(5)=E5=9B=BE=E6=A0=87/=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2;=20(6)=E5=9B=BD=E9=99=85=E5=8C=96=E6=95=B4?= =?UTF-8?q?=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/application/MailBox.ets | 23 +++- entry/src/main/ets/application/PhotoAlbum.ets | 28 +++-- entry/src/main/ets/application/Settings.ets | 56 ++++++--- entry/src/main/ets/common/CommonConstants.ets | 80 +++++++++++++ entry/src/main/ets/common/MailContent.ets | 112 ++++++++++++------ entry/src/main/ets/common/MailNavigation.ets | 73 ++++++++---- entry/src/main/ets/common/MailSideBar.ets | 71 +++++++---- entry/src/main/ets/common/PhotoContent.ets | 37 ++++-- entry/src/main/ets/common/PhotoSideBar.ets | 69 +++++++---- entry/src/main/ets/common/SettingItem.ets | 9 +- entry/src/main/ets/common/WlanItem.ets | 79 ++++++++---- .../main/ets/entryability/EntryAbility.ets | 64 +++++++++- entry/src/main/ets/pages/Index.ets | 56 +++++++-- .../main/resources/base/element/float.json | 12 ++ .../main/resources/base/element/string.json | 16 +++ .../main/resources/en_US/element/string.json | 16 +++ .../main/resources/zh_CN/element/string.json | 16 +++ 17 files changed, 620 insertions(+), 197 deletions(-) create mode 100644 entry/src/main/ets/common/CommonConstants.ets create mode 100644 entry/src/main/resources/base/element/float.json diff --git a/entry/src/main/ets/application/MailBox.ets b/entry/src/main/ets/application/MailBox.ets index 8d1806a..4b206d7 100644 --- a/entry/src/main/ets/application/MailBox.ets +++ b/entry/src/main/ets/application/MailBox.ets @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { BreakpointType } from '../common/BreakpointSystem'; import { MailNavigation } from '../common/MailNavigation'; import { MailSideBar } from '../common/MailSideBar'; @@ -24,6 +25,8 @@ struct MailBox { @LocalStorageLink('currentBreakPoint') currentBreakPoint: string = 'md'; @State isFold: boolean = false; @State sideBarWidth: number = 304; + @StorageProp('topRectHeight') + topRectHeight: number = 0; build() { GridRow() { @@ -32,7 +35,12 @@ struct MailBox { // Area A Column() { MailSideBar() - }.width('100%').height('100%').backgroundColor('#f1f3f5') + } + .borderWidth({ right: 0.5 }) + .borderColor({ right: $r('sys.color.comp_divider') }) + .width('100%') + .height('100%') + .backgroundColor($r('sys.color.background_primary')) // Area B+C Column() { @@ -44,16 +52,23 @@ struct MailBox { } }.height('100%').width('100%') } + .divider({ color: $r('sys.color.comp_divider'), strokeWidth: 0 }) .sideBarWidth(this.sideBarWidth) .minSideBarWidth(240) - .minContentWidth(this.currentBreakPoint === 'sm' ? 360 : 600) - .controlButton({ left: 24, top: 40, width: 24, height: 24 }) + .minContentWidth(this.currentBreakPoint === 'sm' ? '100%' : 600) + .controlButton({ + left: new BreakpointType(16, 24, 32).GetValue(this.currentBreakPoint), + top: px2vp(this.topRectHeight), + width: 24, + height: 24 + }) .showSideBar(this.currentBreakPoint === 'lg') .onChange((value: boolean) => { this.isFold = value; }) } - }.onBreakpointChange((breakpoint: string) => { + } + .onBreakpointChange((breakpoint: string) => { this.currentBreakPoint = breakpoint; }) } diff --git a/entry/src/main/ets/application/PhotoAlbum.ets b/entry/src/main/ets/application/PhotoAlbum.ets index 25c8c58..f070fd3 100644 --- a/entry/src/main/ets/application/PhotoAlbum.ets +++ b/entry/src/main/ets/application/PhotoAlbum.ets @@ -12,6 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { BreakpointType } from '../common/BreakpointSystem'; +import { CommonConstants } from '../common/CommonConstants'; import { PhotoContent } from '../common/PhotoContent'; import { PhotoSideBar } from '../common/PhotoSideBar'; @@ -23,28 +25,40 @@ let storage = LocalStorage.getShared(); 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; build() { GridRow() { GridCol({ span: { sm: 12, md: 12, lg: 12 } }) { SideBarContainer(SideBarContainerType.AUTO) { Column() { - PhotoSideBar().margin({ top: 64 }) - }.backgroundColor('#f1f3f5') + PhotoSideBar() + } + .backgroundColor($r('sys.color.comp_background_primary')) Column() { PhotoContent({ sideBarStatus: $sideBarStatus }) } + .backgroundColor($r('sys.color.background_secondary')) } - .controlButton({ left: 24, top: 16, width: 24, height: 24 }) + .divider({ strokeWidth: 0.5, color: $r('sys.color.comp_divider') }) + .controlButton({ + left: new BreakpointType(16, 24, 32).GetValue(this.curBp), + top: px2vp(this.topRectHeight), + width: 24, + height: 24 + }) .onChange((value: boolean) => { this.sideBarStatus = value; }) } - }.onBreakpointChange((breakpoint: string) => { + } + .onBreakpointChange((breakpoint: string) => { this.currentBreakPoint = breakpoint; }) } -} - - +} \ No newline at end of file diff --git a/entry/src/main/ets/application/Settings.ets b/entry/src/main/ets/application/Settings.ets index d030419..b373479 100644 --- a/entry/src/main/ets/application/Settings.ets +++ b/entry/src/main/ets/application/Settings.ets @@ -12,6 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { BreakpointType } from '../common/BreakpointSystem'; +import { CommonConstants } from '../common/CommonConstants'; import { MainItem } from '../common/SettingItem'; import { WlanItem } from '../common/WlanItem'; @@ -23,14 +25,20 @@ 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) { + @Builder + myRouter(name: string, param?: number | undefined) { WlanItem() } - @Builder CustomDivider() { + @Builder + CustomDivider() { Divider() - .strokeWidth('1px') + .strokeWidth(0.5) .color($r('sys.color.ohos_id_color_list_separator')) .margin({ left: 8, right: 8 }) } @@ -43,18 +51,19 @@ struct Settings { GridRow() { GridCol({ span: { sm: 12, md: 12, lg: 12 } }) { Navigation(this.pathInfo) { - List({ space: 10 }) { + List({ space: 12 }) { ListItem() { Search({ placeholder: $r('app.string.search') }) - .backgroundColor('#fff') + .backgroundColor($r('sys.color.comp_background_primary')) + .margin({ top: 16 }) } - .padding({ top: 8, bottom: 8 }) .width('100%') ListItem() { MainItem({ isUserItem: true, src: $r('app.media.ic_mine_normal') }) - .backgroundColor('#fff') - .borderRadius(20).padding({ top: 12, bottom: 12 }) + .backgroundColor($r('sys.color.comp_background_primary')) + .borderRadius(16) + .padding({ top: 12, bottom: 12 }) } ListItem() { @@ -78,8 +87,8 @@ struct Settings { src: $r('app.media.ic_settings_more_connections') }) }.width('100%') - .borderRadius(24) - .backgroundColor($r('sys.color.ohos_id_color_foreground_contrary')) + .borderRadius(16) + .backgroundColor($r('sys.color.comp_background_primary')) .padding({ top: 4, bottom: 4 }) } @@ -89,8 +98,8 @@ struct Settings { this.CustomDivider() MainItem({ itemDesc: $r('app.string.displayAndBrightness'), src: $r('app.media.displayAndBrightness') }) }.width('100%') - .borderRadius(24) - .backgroundColor($r('sys.color.ohos_id_color_foreground_contrary')) + .borderRadius(16) + .backgroundColor($r('sys.color.comp_background_primary')) .padding({ top: 4, bottom: 4 }) } @@ -107,7 +116,7 @@ struct Settings { MainItem({ itemDesc: $r('app.string.privacy'), src: $r('app.media.privacy') }) }.width('100%') .borderRadius(24) - .backgroundColor($r('sys.color.ohos_id_color_foreground_contrary')) + .backgroundColor($r('sys.color.comp_background_primary')) .padding({ top: 4, bottom: 4 }) } @@ -119,22 +128,31 @@ struct Settings { this.CustomDivider() MainItem({ itemDesc: $r('app.string.aboutDevice'), src: $r('app.media.aboutDevice') }) }.width('100%') - .borderRadius(24) - .backgroundColor($r('sys.color.ohos_id_color_foreground_contrary')) + .borderRadius(16) + .backgroundColor($r('sys.color.comp_background_primary')) .padding(4) } } - .width('100%').height('100%') - .padding({ left: 12, right: 12 }) + .scrollBar(BarState.Off) + .width('100%') + .height('100%') + .padding({ + left: new BreakpointType(16, 16, 16).GetValue(this.currentBreakPoint), + right: new BreakpointType(16, 16, 16).GetValue(this.currentBreakPoint) + }) } .navBarWidth(293) .title($r('app.string.settings')) - .backgroundColor('#f1f3f5') + .backgroundColor($r('sys.color.background_secondary')) .width('100%') .height('100%') .navDestination(this.myRouter) } - }.onBreakpointChange((breakpoint: string) => { + } + .borderWidth({ right: 0.5 }) + .borderColor({ right: $r('sys.color.comp_divider') }) + .backgroundColor($r('sys.color.background_secondary')) + .onBreakpointChange((breakpoint: string) => { this.currentBreakPoint = breakpoint; }) } diff --git a/entry/src/main/ets/common/CommonConstants.ets b/entry/src/main/ets/common/CommonConstants.ets new file mode 100644 index 0000000..bd14d9e --- /dev/null +++ b/entry/src/main/ets/common/CommonConstants.ets @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Common constants for all features. + */ + +export class CommonConstants { + /** + * font weight is 500. + */ + static readonly FONT_WEIGHT_FIVE: number = 500; + /** + * font weight is 500. + */ + static readonly FONT_WEIGHT_FOUR: number = 400; + /** + * Index page padding top size. + */ + static readonly PADDING_TOP_INDEX: number = 64; + + /** + * Index page padding bottom size. + */ + static readonly PADDING_BOTTOM_INDEX: number = 16; + /** + * Width the percentage of the 100. + */ + static readonly FULL_WIDTH: string = '100%'; + /** + * Height the percentage of the 100. + */ + static readonly FULL_HEIGHT: string = '100%'; + /** + * Breakpoint sm. + */ + static readonly BREAK_POINT_SM: string = 'sm'; + /** + * Breakpoint md. + */ + static readonly BREAK_POINT_MD: string = 'md'; + /** + * Breakpoint lg. + */ + static readonly BREAK_POINT_LG: string = 'lg'; + /** + * Routes + */ + static readonly ROUTES: Route[] = [ + { + text: $r('app.string.first_title'), to: 'application/MailBox' + }, + { + text: $r('app.string.second_title'), to: 'application/PhotoAlbum' + }, + { + text: $r('app.string.third_title'), to: 'application/Settings' + } + ]; +} + +/** + * Route type define + */ +export interface Route { + text: Resource, + to: string +} \ No newline at end of file diff --git a/entry/src/main/ets/common/MailContent.ets b/entry/src/main/ets/common/MailContent.ets index d9751ea..6693519 100644 --- a/entry/src/main/ets/common/MailContent.ets +++ b/entry/src/main/ets/common/MailContent.ets @@ -14,81 +14,115 @@ */ import { OperateTabs } from '../model/dataType'; +import { BreakpointType } from './BreakpointSystem'; +import { CommonConstants } from './CommonConstants'; @Component export struct MailContent { @State buttonList: OperateTabs[] = [ - new OperateTabs($r('app.media.reply'), $r('app.string.reply')), - new OperateTabs($r('app.media.replyAll'), $r('app.string.replyAll')), - new OperateTabs($r('app.media.forward'), $r('app.string.send')), - new OperateTabs($r('app.media.ic_public_delete'), $r('app.string.delete')), - new OperateTabs($r('app.media.more'), $r('app.string.more')), + new OperateTabs($r('sys.symbol.envelope_badge_arrow_left'), $r('app.string.reply')), + new OperateTabs($r('sys.symbol.envelope_on_envelope_badge_arrow_left'), $r('app.string.replyAll')), + new OperateTabs($r('sys.symbol.rectangle_and_arrowshape_turn_up_right'), $r('app.string.send')), + new OperateTabs($r('sys.symbol.trash'), $r('app.string.delete')), + new OperateTabs($r('sys.symbol.dot_grid_2x2'), $r('app.string.more')), ] - @LocalStorageProp('currentBreakPoint') currentBreakPoint: string = 'md'; + @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; + @StorageProp('bottomRectHeight') + bottomRectHeight: number = 0; + @StorageProp('topRectHeight') + topRectHeight: number = 0; build() { NavDestination() { Column() { Column() { - Row() { - if (this.currentBreakPoint === 'sm') { - Row().width(24).height(24) - } else { - Image($r('app.media.ic_expand')) - .width(24) - .height(24) - } - Text('HHHxx UXD') - .fontSize(20) - .lineHeight(23) - .margin({ left: 21 }) - .fontWeight(FontWeight.Medium) - }.width('100%').height(56) + Text('HHHxx UXD') + .fontSize(22) + .margin({ left: this.curBp === 'sm' ? 32 : 0 }) + .fontWeight(FontWeight.Medium) + .fontColor($r('sys.color.font_primary')) Row() { - Text($r('app.string.recUser')).fontSize(14).fontWeight(FontWeight.Regular) - Text($r('app.string.mailDesc')).padding({ left: 12 }).fontSize(16).fontWeight(FontWeight.Medium) + Text($r('app.string.recUser')) + .fontSize(14) + .fontWeight(FontWeight.Regular) + .fontColor($r('sys.color.font_primary')) + Text($r('app.string.mailDesc')) + .padding({ left: 12 }) + .fontSize(16) + .fontWeight(FontWeight.Medium) + .fontColor($r('sys.color.font_primary')) Blank() - Image($r('app.media.right_expend_grey')).width(24).height(12).opacity(0.8).rotate({ angle: 90 }) - }.width('100%').height(48) + SymbolGlyph($r('sys.symbol.chevron_down')) + .fontSize(24) + .fontColor([$r('sys.color.icon_secondary')]) + } + .width('100%') + .height(48) - Text('PostMaster').fontSize(20).fontColor('#040404').lineHeight(23) - Text('09:42').margin({ top: 2 }).fontColor('#1818a').opacity(0.6) + Text('PostMaster').fontSize(20).fontColor($r('sys.color.font_primary')).lineHeight(23) + Text('09:42').margin({ top: 2 }).fontColor($r('sys.color.font_tertiary')) Scroll() { Column() { - Text($r('app.string.textData')).fontSize(16).fontWeight(FontWeight.Regular).lineHeight(25) - Text($r('app.string.bodyTextPartOne')).fontSize(16).fontWeight(FontWeight.Regular).lineHeight(25) - Text('').lineHeight(25) + Text($r('app.string.textData')).fancyText() + Text($r('app.string.bodyTextPartOne')).fancyText() + Text('').fancyText() Image($r('app.media.orange')).width('100%').height(166).borderRadius(10) - Text('').lineHeight(25) - Text($r('app.string.bodyTextPartTwo')).fontSize(16).fontWeight(FontWeight.Regular).lineHeight(25) - Text($r('app.string.bodyTextPartThree')).fontSize(16).fontWeight(FontWeight.Regular).lineHeight(25) - }.alignItems(HorizontalAlign.Start) + Text('').fancyText() + Text($r('app.string.bodyTextPartTwo')).fancyText() + Text($r('app.string.bodyTextPartThree')).fancyText() + } + .alignItems(HorizontalAlign.Center) } .margin({ top: 20 }) .layoutWeight(1) .width('100%') .scrollBar(BarState.Off) - }.layoutWeight(1).padding({ left: 20, right: 20, top: 24 }).alignItems(HorizontalAlign.Start) + } + .layoutWeight(1) + .padding({ + left: new BreakpointType(16, 24, 32).GetValue(this.curBp), + right: new BreakpointType(16, 24, 32).GetValue(this.curBp), + }) + .alignItems(HorizontalAlign.Start) Row() { ForEach(this.buttonList, (item: OperateTabs) => { Column() { - Image(item.src).width(24).height(24) - Text(item.name).fontSize(10).margin({ top: 3 }).lineHeight(12) + SymbolGlyph(item.src) + .fontColor([$r('sys.color.ohos_id_color_text_secondary')]) + .fontSize(24) + Text(item.name) + .fontColor($r('sys.color.ohos_id_color_text_secondary')) + .fontSize(10) + .lineHeight(12) } }) } + .justifyContent(FlexAlign.SpaceAround) .width('100%') .height(56) - .justifyContent(FlexAlign.SpaceBetween) - .padding(this.currentBreakPoint === 'sm' ? { left: 21, right: 21 } : { left: 46, right: 46 }) - .backgroundColor('#fff') + .backgroundColor($r('sys.color.background_secondary')) } + .padding({ + bottom: px2vp(this.bottomRectHeight), top: px2vp(this.topRectHeight) + }) + .backgroundColor($r('sys.color.background_secondary')) + .width('100%') + .height('100%') } + .backgroundColor($r('sys.color.background_secondary')) .width('100%') .height('100%') .hideTitleBar(true) } +} + +@Extend(Text) +function fancyText() { + .fontColor($r('sys.color.font_primary')) + .fontSize(16) + .fontWeight(FontWeight.Regular) + .lineHeight(25) } \ No newline at end of file diff --git a/entry/src/main/ets/common/MailNavigation.ets b/entry/src/main/ets/common/MailNavigation.ets index 63ee85b..bd3f910 100644 --- a/entry/src/main/ets/common/MailNavigation.ets +++ b/entry/src/main/ets/common/MailNavigation.ets @@ -22,6 +22,8 @@ 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; @Builder myRouter(name: string, param?: number | undefined) { @@ -32,14 +34,16 @@ export struct MailNavigation { NavigationMenus() { if (this.currentBreakPoint !== 'md') { Row() { - Image($r('app.media.add')) - .width(24) - .height(24) - Image($r('app.media.more')) - .width(24) - .height(24) - .margin({ left: 24, right: 0 }) - }.height(56).padding({ top: 48 }) + SymbolGlyph($r('sys.symbol.plus')) + .fontColor([$r('sys.color.icon_primary')]) + .fontSize(24) + SymbolGlyph($r('sys.symbol.dot_grid_2x2')) + .fontColor([$r('sys.color.icon_primary')]) + .fontSize(24) + .margin({ left: 24 }) + } + .height(56) + .padding({ top: px2vp(this.topRectHeight), right: 16 }) } } @@ -47,16 +51,22 @@ export struct MailNavigation { NavigationTitle() { Column() { Text($r('app.string.recvBox')) - .fontColor('#000') + .fontColor($r('sys.color.font_primary')) .fontSize(30) - .lineHeight(41) .fontWeight(FontWeight.Medium) Text('jiaozi@xxx.com') - .fontColor('#99000000') + .fontColor($r('sys.color.font_tertiary')) .fontSize(14) - .lineHeight(20) - .margin({ top: 2 }) - }.alignItems(HorizontalAlign.Start).height(162).width(138).padding({ top: 80, left: 24 }) + .margin({ top: 4, left: 2 }) + } + .alignItems(HorizontalAlign.Start) + .height(140) + .width('100%') + .padding({ + top: 80, + left: new BreakpointType(16, 24, 32).GetValue(this.currentBreakPoint), + right: new BreakpointType(16, 24, 32).GetValue(this.currentBreakPoint) + }) } aboutToAppear() { @@ -67,16 +77,12 @@ export struct MailNavigation { Navigation(this.pathInfo) { Stack({ alignContent: Alignment.Start }) { Column() { - Row() { - Search({ placeholder: $r('app.string.searchMail') }).margin({ left: 12, right: 12 }) - }.height(56) - + Search({ placeholder: $r('app.string.searchMail') }) List() { ForEach(this.mailList, (item: string, index: number | undefined) => { ListItem() { Column() { Row() { - Text($r('app.string.nonSense')).fontSize(16).lineHeight(22).fontColor('#1818a') Blank() Text('4/12').fontSize(12).opacity(0.6) @@ -89,17 +95,32 @@ export struct MailNavigation { .fontColor('#1818a') .opacity(0.6) .lineHeight(19) - }.width('100%').alignItems(HorizontalAlign.Start) - }.height(96).justifyContent(FlexAlign.Center) - }.padding({ left: 12, right: 12 }) + } + .width('100%').alignItems(HorizontalAlign.Start) + } + .height(96).justifyContent(FlexAlign.Center) + } + .padding({ left: 12, right: 12 }) .backgroundColor(index === 2 ? '#19254ff7' : '') .borderRadius(10) }) - }.divider({ strokeWidth: 1, startMargin: 12, endMargin: 12 }) - .height('100%').width('100%') + } + .scrollBar(BarState.Off) + .divider({ + strokeWidth: 0.5, + startMargin: 12, + endMargin: 12, + color: $r('sys.color.comp_divider') + }) + .height('100%') + .width('100%') .layoutWeight(1) - }.height('100%').width('100%') - .padding({ left: 12, right: 12 }) + } + .height('100%').width('100%') + .padding({ + left: new BreakpointType(16, 24, 32).GetValue(this.currentBreakPoint), + right: new BreakpointType(16, 24, 32).GetValue(this.currentBreakPoint) + }) if (this.currentBreakPoint !== 'lg') { Image($r('app.media.ic_public_list_add_light')).width(48).height(48).position({ x: 240, y: 549 }) diff --git a/entry/src/main/ets/common/MailSideBar.ets b/entry/src/main/ets/common/MailSideBar.ets index 5313b5a..46bc151 100644 --- a/entry/src/main/ets/common/MailSideBar.ets +++ b/entry/src/main/ets/common/MailSideBar.ets @@ -14,8 +14,11 @@ */ import { MailType } from '../model/dataType'; +import { BreakpointType } from './BreakpointSystem'; +import { CommonConstants } from './CommonConstants'; -@Extend(Text) function TextStyle() { +@Extend(Text) +function TextStyle() { .backgroundColor('#254ff7') .fontColor('#fff') .fontSize(10) @@ -39,21 +42,26 @@ struct AccountInfo { 'jiaozi@xxx.com', 'jiaozi@163.com', ] + @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; - @Builder accountInfo() { + @Builder + accountInfo() { Column() { Row() { Text($r('app.string.account')) - .fontSize(14) - .fontColor($r('sys.color.ohos_id_color_text_secondary')) + .fontSize(16) + .fontColor($r('sys.color.font_primary')) .fontWeight(FontWeight.Medium) Blank() Text($r('app.string.addAccount')) - .fontSize(14) - .fontColor('#0a59f7') + .fontSize(16) + .fontColor($r('sys.color.brand')) .fontWeight(FontWeight.Medium) - }.width('100%').height(48) - }.margin({ top: 78 }).padding({ left: 16, right: 16 }) + } + .width('100%') + .height(48) + } + .margin({ top: 78 }) } build() { @@ -70,12 +78,13 @@ struct AccountInfo { .backgroundColor(index === 0 ? '#61cfbe' : '#fec700') Text(item) .fontSize(16) - .fontColor(index === 0 ? '#000' : '#E5000000') + .fontColor($r('sys.color.font_primary')) .margin({ left: 13 }) Blank() if (index === 0) { - Image($r('app.media.ic_confirm')).width(16) - .height(16).fillColor('#244ff7') + SymbolGlyph($r('sys.symbol.checkmark')) + .fontSize(18) + .fontColor([$r('sys.color.brand')]) } else { Text('9') .width(18) @@ -89,9 +98,12 @@ struct AccountInfo { } .width('100%') .height('100%') - .padding({ left: 16, right: 16 }) - .divider({ strokeWidth: 1 }) + .divider({ strokeWidth: 0.5, color: $r('sys.color.comp_divider') }) } + .padding({ + left: new BreakpointType(16, 24, 32).GetValue(this.curBp), + right: new BreakpointType(16, 24, 32).GetValue(this.curBp) + }) } } @@ -104,28 +116,35 @@ struct MailStatusList { new MailType($r('app.string.allFolders'), 0, $r('app.media.allFolders')) ] - @Builder accountInfo() { - Column() { - Row() { - Text($r('app.string.account')).fontSize(14) - Blank() - Text($r('app.string.addAccount')) - .fontSize(14) - .fontColor('#0a59f7') - }.width('100%').height(48) + @Builder + accountInfo() { + Row() { + Text($r('app.string.account')) + .fontSize(14) + .fontColor($r('sys.color.font_tertiary')) + + Text($r('app.string.addAccount')) + .fontSize(14) + .fontColor($r('sys.color.brand')) } + .backgroundColor(Color.Red) + .justifyContent(FlexAlign.SpaceBetween) + .width('100%') + .height(48) } build() { List() { ListItem() { this.accountInfo() - }.padding({ left: 9, right: 9 }) + } ForEach(this.mailState, (item: MailType, index: number | undefined) => { ListItem() { Row() { - Image(item.src).width(24).height(24) + Image(item.src) + .width(24) + .height(24) Text(item.type) .fontSize(16) .margin({ left: 16 }) @@ -145,7 +164,9 @@ struct MailStatusList { .backgroundColor(index === 0 ? '#19254ff7' : '') .borderRadius(16) }) - }.width('100%').height('100%') + } + .width('100%') + .height('100%') .padding({ left: 7, right: 7 }) .margin({ top: 8 }) .divider({ strokeWidth: 1, startMargin: 12, endMargin: 12 }) diff --git a/entry/src/main/ets/common/PhotoContent.ets b/entry/src/main/ets/common/PhotoContent.ets index 0dd9e78..3a2caac 100644 --- a/entry/src/main/ets/common/PhotoContent.ets +++ b/entry/src/main/ets/common/PhotoContent.ets @@ -14,6 +14,8 @@ */ import { photoType } from '../model/dataType'; +import { BreakpointType } from './BreakpointSystem'; +import { CommonConstants } from './CommonConstants'; @Component export struct PhotoContent { @@ -29,7 +31,9 @@ export struct PhotoContent { ] @State columnsTemplate: string = '1fr 1fr 1fr'; @Link @Watch('onStateChange') sideBarStatus: boolean; - @LocalStorageProp('currentBreakPoint') currentBreakPoint: string = 'sm'; + @StorageProp('currentBreakpoint') currentBreakPoint: string = CommonConstants.BREAK_POINT_SM; + @StorageProp('topRectHeight') + topRectHeight: number = 0; aboutToAppear() { this.columnsTemplate = this.currentBreakPoint === 'sm' ? '1fr 1fr 1fr 1fr' : '1fr 1fr 1fr'; @@ -50,10 +54,20 @@ export struct PhotoContent { Row() { Text($r('app.string.album')).fontSize(20).fontWeight(FontWeight.Medium) .margin({ left: this.sideBarStatus ? 0 : 36 }) - Blank() - Image($r('app.media.add')).width(24).aspectRatio(1) - Image($r('app.media.more')).width(24).aspectRatio(1).margin({ left: 24 }) - }.height(56).width('100%') + Row() { + SymbolGlyph($r('sys.symbol.plus')) + .fontSize(24) + .fontColor([$r('sys.color.font_primary')]) + .margin({ right: $r('sys.float.padding_level4') }) + SymbolGlyph($r('sys.symbol.dot_grid_2x2')) + .fontSize(24) + .fontColor([$r('sys.color.font_primary')]) + } + } + .justifyContent(FlexAlign.SpaceBetween) + .padding({ top: px2vp(this.topRectHeight) }) + .height(56) + .width('100%') Grid() { ForEach(this.photoList, (item: photoType) => { @@ -67,10 +81,17 @@ export struct PhotoContent { } } }) - }.columnsTemplate(this.columnsTemplate) + } + .height('85%') + .scrollBar(BarState.Off) + .columnsTemplate(this.columnsTemplate) .columnsGap(22) .rowsGap(17) - .margin({ top: 7 }) - }.padding({ left: 24, right: 18 }) + .margin({ top: 24 }) + } + .padding({ + left: new BreakpointType(16, 24, 32).GetValue(this.currentBreakPoint), + right: new BreakpointType(16, 24, 32).GetValue(this.currentBreakPoint) + }) } } \ No newline at end of file diff --git a/entry/src/main/ets/common/PhotoSideBar.ets b/entry/src/main/ets/common/PhotoSideBar.ets index e6a7ccd..91e3c18 100644 --- a/entry/src/main/ets/common/PhotoSideBar.ets +++ b/entry/src/main/ets/common/PhotoSideBar.ets @@ -14,6 +14,8 @@ */ import { photoType } from '../model/dataType'; +import { BreakpointType } from './BreakpointSystem'; +import { CommonConstants } from './CommonConstants'; @Component export struct PhotoSideBar { @@ -27,44 +29,55 @@ export struct PhotoSideBar { new photoType($r('app.string.category'), 234), new photoType($r('app.string.pictureType'), 22), new photoType($r('app.string.hidden'), 1), - ] + ]; + @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; + @StorageProp('topRectHeight') + topRectHeight: number = 0; build() { Column() { - Row() { - Search({ placeholder: $r('app.string.placeholderText') }).backgroundColor('#fff').focusable(false) - }.height(56).width('100%') + Search({ placeholder: $r('app.string.placeholderText') }) + .backgroundColor($r('sys.color.background_secondary')) + .focusable(false) + .width('100%') + .margin({ top: $r('sys.float.padding_level16') }) List() { ListItem() { Row() { - Image($r('app.media.ic_public_picture')).width(24).aspectRatio(1) + SymbolGlyph($r('sys.symbol.picture_2')) + .fontSize(24) + .fontColor([$r('sys.color.icon_primary')]) + .aspectRatio(1) Text($r('app.string.photo')) + .fontColor($r('sys.color.font_primary')) .fontSize(16) .fontWeight(FontWeight.Medium) .opacity(0.9) .height(48) .margin({ left: 8 }) - }.padding({ left: 8 }).width('100%') + } + .padding({ left: 8 }).width('100%') } ListItem() { Row() { - Image($r('app.media.ic_public_folder')).width(24).aspectRatio(1) + SymbolGlyph($r('sys.symbol.picture_2_fill')) + .fontSize(24) + .fontColor([$r('sys.color.brand')]) + .aspectRatio(1) Text($r('app.string.album')) .fontSize(16) .fontWeight(FontWeight.Medium) .opacity(0.9) .height(48) .margin({ left: 8 }) - .fontColor('rgb(10,89,247)') + .fontColor($r('sys.color.brand')) Blank() - Image($r('app.media.ic_public_arrow_down_0')) - .width(24) - .height(12) - .rotate({ angle: 90 }) - .opacity(0.8) - }.padding({ left: 8 }).width('100%') + SymbolGlyph($r('sys.symbol.checkmark')) + .fontColor([$r('sys.color.brand')]) + .fontSize(24) + }.padding({ left: 8, right: 8 }).width('100%') .backgroundColor('#19254ff7') .borderRadius(10) } @@ -73,24 +86,34 @@ export struct PhotoSideBar { ListItem() { Row() { Text(item.name) - .fontSize(16) + .fontColor($r('sys.color.font_secondary')) + .fontSize(14) .fontWeight(FontWeight.Medium) - .opacity(0.9) .height(48) - .margin({ left: 8 }) Blank() if (index === this.photoList.length - 1) { - Image($r('app.media.ic_public_lock_filled')).width(24).aspectRatio(1) + SymbolGlyph($r('sys.symbol.lock')) + .fontSize(18) + .fontColor([$r('sys.color.font_secondary')]) } else { - Text(item.count.toString()).fontSize(14).fontWeight(FontWeight.Regular) + Text(item.count.toString()) + .fontSize(14) + .fontWeight(FontWeight.Regular) + .fontColor($r('sys.color.font_secondary')) } - }.padding({ left: 16, right: 24 }).width('100%') + } + .padding({ left: 14, right: 14 }) + .width('100%') } }) } - .margin({ top: 16 }) .width('100%').height('100%') - }.width('100%').height('100%') - .padding({ left: 12, right: 12 }) + } + .width('100%').height('100%') + .padding({ + top: px2vp(this.topRectHeight), + left: new BreakpointType(16, 24, 32).GetValue(this.curBp), + right: new BreakpointType(16, 24, 32).GetValue(this.curBp) + }) } } \ No newline at end of file diff --git a/entry/src/main/ets/common/SettingItem.ets b/entry/src/main/ets/common/SettingItem.ets index 4db7ec4..32e2d3b 100644 --- a/entry/src/main/ets/common/SettingItem.ets +++ b/entry/src/main/ets/common/SettingItem.ets @@ -80,13 +80,13 @@ export struct SubItem { .lineHeight(22) .fontWeight(FontWeight.Medium) .fontFamily('HarmonyHeiTi') - .fontColor(this.isLinkAddress ? '#254ff7' : $r('sys.color.ohos_id_color_text_primary')) + .fontColor(this.isLinkAddress ? $r('sys.color.brand') : $r('sys.color.font_primary')) .align(Alignment.Start) if (this.content) { Text(this.content) .fontWeight(FontWeight.Regular) .fontSize(14) - .fontColor('#99000000').margin({ top: 1.5 }) + .fontColor($r('sys.color.font_tertiary')).margin({ top: 1.5 }) } }.alignItems(HorizontalAlign.Start) @@ -97,7 +97,7 @@ export struct SubItem { .id('ToggleSwitch') .width(36) .height(20) - .selectedColor('#007DFF') + .selectedColor($r('sys.color.brand')) } else if (this.isShowRightArrow) { if (this.itemStatusDesc) { Text(this.itemStatusDesc).fontWeight(FontWeight.Regular).fontSize(14) @@ -106,7 +106,8 @@ export struct SubItem { .width(12) .height(24) .fillColor($r('sys.color.ohos_id_color_fourth')) - .margin({ left: 4 + .margin({ + left: 4 }) } else { Image(this.src) diff --git a/entry/src/main/ets/common/WlanItem.ets b/entry/src/main/ets/common/WlanItem.ets index 0915894..58f2f45 100644 --- a/entry/src/main/ets/common/WlanItem.ets +++ b/entry/src/main/ets/common/WlanItem.ets @@ -15,11 +15,14 @@ import { SubItem } from './SettingItem'; import { router } from '@kit.ArkUI'; +import { BreakpointType } from './BreakpointSystem'; @Component export struct WlanItem { @State netWorkStatus: Resource = $r('app.string.closed'); @LocalStorageProp('currentBreakPoint') currentBreakPoint: string = 'md'; + @StorageProp('topRectHeight') + topRectHeight: number = 0; @Builder CustomDivider() { @@ -33,24 +36,36 @@ export struct WlanItem { NavDestination() { Row() { if (this.currentBreakPoint === 'sm') { - Image($r('app.media.ic_public_back')).width(24).height(24).margin({ right: 16 }) - .onClick(()=>{ - router.back(); - }) + Button({ type: ButtonType.Circle }) { + SymbolGlyph($r('sys.symbol.chevron_backward')) + .fontColor([$r('sys.color.icon_primary')]) + .fontSize($r('sys.float.Title_M')) + } + .height(40) + .aspectRatio(1) + .backgroundColor($r('sys.color.comp_background_tertiary')) + .onClick(() => { + router.back(); + }) } - Text($r('app.string.WLAN')).fontSize(20).fontWeight(FontWeight.Medium) - Blank() - Image($r('app.media.ic_public_help')).width(24).aspectRatio(1) - }.width('100%').height(26).margin({ top: 38, bottom: 24 }) - .padding({ left: 24, right: 24 }) + Text('WLAN') + .margin({ left: $r('sys.float.padding_level4') }) + .font({ size: 20, weight: 700 }) + .fontColor($r('sys.color.font_primary')) + } + .width('100%') + .height(56) + .zIndex(2) List({ space: 20 }) { ListItem() { SubItem({ itemDesc: $r('app.string.WLAN'), isShowButton: true }) - }.width('100%') + } + .width('100%') .borderRadius(16) - .backgroundColor($r('sys.color.ohos_id_color_foreground_contrary')) + .backgroundColor($r('sys.color.comp_background_primary')) .padding({ top: 4, bottom: 4 }) + .margin({ top: 16 }) ListItem() { SubItem({ @@ -60,19 +75,23 @@ export struct WlanItem { }) }.width('100%') .borderRadius(16) - .backgroundColor($r('sys.color.ohos_id_color_foreground_contrary')) + .backgroundColor($r('sys.color.comp_background_primary')) .padding({ top: 4, bottom: 4 }) ListItem() { SubItem({ itemDesc: $r('app.string.moreWLANSettings'), isShowRightArrow: true }) }.width('100%') .borderRadius(16) - .backgroundColor($r('sys.color.ohos_id_color_foreground_contrary')) + .backgroundColor($r('sys.color.comp_background_primary')) .padding({ top: 4, bottom: 4 }) ListItem() { Column() { - Text($r('app.string.wlanConnected')).fontSize(16).fontColor('#66000000').width('100%').padding({ left: 12 }) + Text($r('app.string.wlanConnected')) + .fontSize(12) + .fontColor($r('sys.color.font_secondary')) + .width('100%') + .padding({ left: 12 }) SubItem({ itemDesc: $r('app.string.wifiName'), content: $r('app.string.connected'), @@ -82,7 +101,7 @@ export struct WlanItem { .margin({ top: 8 }) .width('100%') .borderRadius(16) - .backgroundColor($r('sys.color.ohos_id_color_foreground_contrary')) + .backgroundColor($r('sys.color.comp_background_primary')) .padding({ top: 4, bottom: 4 }) } } @@ -90,7 +109,11 @@ export struct WlanItem { ListItem() { Column() { Row() { - Text($r('app.string.wlanUseful')).fontSize(16).fontColor('#66000000').width('100%').padding({ left: 12 }) + Text($r('app.string.wlanUseful')) + .fontSize(14) + .fontColor($r('sys.color.font_secondary')) + .width('100%') + .padding({ left: 12 }) } Column() { @@ -114,7 +137,7 @@ export struct WlanItem { } .width('100%') .borderRadius(16) - .backgroundColor($r('sys.color.ohos_id_color_foreground_contrary')) + .backgroundColor($r('sys.color.comp_background_primary')) .padding({ top: 4, bottom: 4 }) .margin({ top: 8 }) } @@ -124,16 +147,22 @@ export struct WlanItem { SubItem({ itemDesc: $r('app.string.addNetWork'), isLinkAddress: true }) }.width('100%') .borderRadius(16) - .backgroundColor($r('sys.color.ohos_id_color_foreground_contrary')) + .backgroundColor($r('sys.color.comp_background_primary')) .padding({ top: 4, bottom: 4 }) } - .padding({ left: 12, right: 12 }) - .width('100%').height('100%') - }.title('WLAN') + .scrollBar(BarState.Off) + .width('100%') + .height('92%') + } + .padding({ + left: new BreakpointType(16, 16, 16).GetValue(this.currentBreakPoint), + right: new BreakpointType(16, 16, 16).GetValue(this.currentBreakPoint), + top: px2vp(this.topRectHeight) + }) + .hideTitleBar(true) + .title('WLAN') .hideTitleBar(true) - .backgroundColor('#f1f3f5') + .backgroundColor($r('sys.color.background_secondary')) } -} - - +} \ No newline at end of file diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 45917dc..579b04b 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,13 +13,45 @@ * limitations under the License. */ -import { UIAbility,AbilityConstant,Want } from '@kit.AbilityKit'; -import { window } from '@kit.ArkUI'; +import { AbilityConstant, Configuration, ConfigurationConstant, UIAbility, Want } 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 { + let windowWidthVp = windowWidth / display.getDefaultDisplaySync().densityPixels; + let newBp: string = ''; + if (windowWidthVp < 600) { + newBp = 'sm'; + } else if (windowWidthVp < 840) { + newBp = 'md'; + } else { + newBp = 'lg'; + } + if (this.curBp !== newBp) { + this.curBp = newBp; + AppStorage.setOrCreate('currentBreakpoint', this.curBp); + } + } + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + AppStorage.setOrCreate('systemColorMode', this.context.config.colorMode); + 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 { @@ -27,15 +59,39 @@ export default class EntryAbility extends UIAbility { } onWindowStageCreate(windowStage: window.WindowStage): void { + windowStage.getMainWindow().then((windowObj: window.Window) => { + let type = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR; + let avoidArea = windowObj.getWindowAvoidArea(type); + let bottomRectHeight = avoidArea.bottomRect.height; + AppStorage.setOrCreate('bottomRectHeight', bottomRectHeight); + type = window.AvoidAreaType.TYPE_SYSTEM; + 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); + }) + }); // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - + let context = this.context; + let resourceManager: resourceManager.ResourceManager = context.resourceManager; + AppStorage.setOrCreate('resourceManager', resourceManager); windowStage.loadContent('pages/Index', (err, data) => { if (err.code) { hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); return; } hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + let windowClass: window.Window = windowStage.getMainWindowSync(); + let isLayoutFullScreen = true; + windowClass.setWindowLayoutFullScreen(isLayoutFullScreen).then(() => { + console.info('Succeeded in setting the window layout to full-screen mode.'); + }).catch((err: BusinessError) => { + console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err)); + }); }); } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 6d80b94..17e4f81 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -14,25 +14,55 @@ */ import { router } from '@kit.ArkUI'; +import { CommonConstants, Route } from '../common/CommonConstants'; @Entry @Component struct Index { + @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; + @StorageProp('bottomRectHeight') + bottomRectHeight: number = 0; + @StorageProp('topRectHeight') + topRectHeight: number = 0; + private routes: Route[] = CommonConstants.ROUTES; + build() { Column() { + Text($r('app.string.project_name')) + .fontWeight(FontWeight.Bold) + .fontColor($r('sys.color.font_primary')) + .fontSize($r('sys.float.Title_L')) + .alignSelf(ItemAlign.Start) + .margin({ + left: this.curBp === 'sm' ? $r('sys.float.padding_level0') : + this.curBp === 'md' ? $r('sys.float.padding_level4') : $r('sys.float.padding_level8') + }) Column() { - Button('A+B+C').onClick(() => { - router.pushUrl({ url: "application/MailBox" }) - }).type(ButtonType.Normal).borderRadius(5).width(100).id('caseOne') - - Button('A+C').onClick(() => { - router.pushUrl({ url: "application/PhotoAlbum" }) - }).type(ButtonType.Normal).borderRadius(5).width(100).id('caseTwo') - - Button('B+C').onClick(() => { - router.pushUrl({ url: "application/Settings" }) - }).type(ButtonType.Normal).borderRadius(5).width(100).id('caseThree') - }.width('100%').height('50%').justifyContent(FlexAlign.SpaceAround) - }.width('100%').height('100%') + ForEach(this.routes, (item: Route) => { + Button(item.text) + .fontSize($r('sys.float.Subtitle_M')) + .fontColor($r('sys.color.font_on_primary')) + .width(this.curBp === 'sm' ? '100%' : $r('app.float.index_button_width_lg')) + .height($r('app.float.button_height')) + .margin({ top: $r('sys.float.padding_level6') }) + .backgroundColor($r('sys.color.comp_background_emphasize')) + .onClick(() => { + router.pushUrl({ url: item.to }); + }) + }, (item: Route) => JSON.stringify(item)) + } + .width(CommonConstants.FULL_WIDTH) + } + .backgroundColor($r('sys.color.background_primary')) + .width(CommonConstants.FULL_WIDTH) + .height(CommonConstants.FULL_HEIGHT) + .alignItems(HorizontalAlign.Center) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('sys.float.padding_level8'), + right: $r('sys.float.padding_level8'), + top: CommonConstants.PADDING_TOP_INDEX + px2vp(this.topRectHeight), + bottom: CommonConstants.PADDING_BOTTOM_INDEX + px2vp(this.bottomRectHeight) + }) } } \ No newline at end of file diff --git a/entry/src/main/resources/base/element/float.json b/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000..6d2c7b4 --- /dev/null +++ b/entry/src/main/resources/base/element/float.json @@ -0,0 +1,12 @@ +{ + "float": [ + { + "name": "index_button_width_lg", + "value": "448vp" + }, + { + "name": "button_height", + "value": "40vp" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index b258b82..442f21d 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -259,6 +259,22 @@ { "name": "search", "value": "Searching for..." + }, + { + "name": "project_name", + "value": "Multi Columns" + }, + { + "name": "first_title", + "value": "A + B + C" + }, + { + "name": "second_title", + "value": "A + C" + }, + { + "name": "third_title", + "value": "B + C" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json index b258b82..442f21d 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -259,6 +259,22 @@ { "name": "search", "value": "Searching for..." + }, + { + "name": "project_name", + "value": "Multi Columns" + }, + { + "name": "first_title", + "value": "A + B + C" + }, + { + "name": "second_title", + "value": "A + C" + }, + { + "name": "third_title", + "value": "B + C" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json index 24a2b20..3bd6ab7 100644 --- a/entry/src/main/resources/zh_CN/element/string.json +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -259,6 +259,22 @@ { "name": "search", "value": "搜索..." + }, + { + "name": "project_name", + "value": "一多分栏控件" + }, + { + "name": "first_title", + "value": "A + B + C" + }, + { + "name": "second_title", + "value": "A + C" + }, + { + "name": "third_title", + "value": "B + C" } ] } \ No newline at end of file -- Gitee From 0c6d30bd000210b9cecf7f024272ce9829bc84e1 Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Mon, 3 Mar 2025 18:03:50 +0800 Subject: [PATCH 3/7] =?UTF-8?q?HMOSWorld=E6=95=B4=E6=94=B9=20(1)UX?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC=E9=80=82=E9=85=8D;=20(2)=E6=B7=B1=E6=B5=85?= =?UTF-8?q?=E8=89=B2=E9=80=82=E9=85=8D;=20(3)=E6=B2=89=E6=B5=B8=E5=BC=8F?= =?UTF-8?q?=E9=80=82=E9=85=8D;=20(4)=E4=B8=80=E5=A4=9A=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=95=B4=E6=94=B9;=20(5)=E5=9B=BE=E6=A0=87/=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2;=20(6)=E5=9B=BD=E9=99=85=E5=8C=96=E6=95=B4?= =?UTF-8?q?=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/MailNavigation.ets | 2 +- entry/src/main/ets/common/MailSideBar.ets | 4 ++-- entry/src/main/resources/base/element/string.json | 4 ++-- entry/src/main/resources/en_US/element/string.json | 4 ++-- entry/src/main/resources/zh_CN/element/string.json | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/entry/src/main/ets/common/MailNavigation.ets b/entry/src/main/ets/common/MailNavigation.ets index bd3f910..31d942e 100644 --- a/entry/src/main/ets/common/MailNavigation.ets +++ b/entry/src/main/ets/common/MailNavigation.ets @@ -54,7 +54,7 @@ export struct MailNavigation { .fontColor($r('sys.color.font_primary')) .fontSize(30) .fontWeight(FontWeight.Medium) - Text('jiaozi@xxx.com') + Text('xxxxxxx@xxx.xxx') .fontColor($r('sys.color.font_tertiary')) .fontSize(14) .margin({ top: 4, left: 2 }) diff --git a/entry/src/main/ets/common/MailSideBar.ets b/entry/src/main/ets/common/MailSideBar.ets index 46bc151..b82e1cf 100644 --- a/entry/src/main/ets/common/MailSideBar.ets +++ b/entry/src/main/ets/common/MailSideBar.ets @@ -39,8 +39,8 @@ export struct MailSideBar { @Component struct AccountInfo { @State accountList: string[] = [ - 'jiaozi@xxx.com', - 'jiaozi@163.com', + 'xxxxxxx@xxx.xxx', + 'xxxxxxx@xxx.xxx', ] @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 442f21d..ba4271f 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -138,7 +138,7 @@ }, { "name": "textPartTwo", - "value": "Dear jiaozi, your xxxx membership space has been created..." + "value": "Dear xxxx, your xxxx membership space has been created..." }, { "name": "searchMail", @@ -162,7 +162,7 @@ }, { "name": "mailDesc", - "value": "Imjiaozi and 3 others" + "value": "Im xxxx and 3 others" }, { "name": "reply", diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json index 442f21d..ba4271f 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -138,7 +138,7 @@ }, { "name": "textPartTwo", - "value": "Dear jiaozi, your xxxx membership space has been created..." + "value": "Dear xxxx, your xxxx membership space has been created..." }, { "name": "searchMail", @@ -162,7 +162,7 @@ }, { "name": "mailDesc", - "value": "Imjiaozi and 3 others" + "value": "Im xxxx and 3 others" }, { "name": "reply", diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json index 3bd6ab7..3b33c5e 100644 --- a/entry/src/main/resources/zh_CN/element/string.json +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -138,7 +138,7 @@ }, { "name": "textPartTwo", - "value": "亲爱的 jiaozi , 您的xxxx 会员空间已经创..." + "value": "亲爱的 xxxx , 您的xxxx 会员空间已经创..." }, { "name": "searchMail", @@ -162,7 +162,7 @@ }, { "name": "mailDesc", - "value": "imjiaozi以及其他3个" + "value": "im xxxx 以及其他3个" }, { "name": "reply", -- Gitee From dce4ba51a663f0ebbd2e13e22267b5ea272417fe Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Tue, 4 Mar 2025 17:13:51 +0800 Subject: [PATCH 4/7] =?UTF-8?q?HMOSWorld=E6=95=B4=E6=94=B9=20(1)UX?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC=E9=80=82=E9=85=8D;=20(2)=E6=B7=B1=E6=B5=85?= =?UTF-8?q?=E8=89=B2=E9=80=82=E9=85=8D;=20(3)=E6=B2=89=E6=B5=B8=E5=BC=8F?= =?UTF-8?q?=E9=80=82=E9=85=8D;=20(4)=E4=B8=80=E5=A4=9A=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=95=B4=E6=94=B9;=20(5)=E5=9B=BE=E6=A0=87/=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2;=20(6)=E5=9B=BD=E9=99=85=E5=8C=96=E6=95=B4?= =?UTF-8?q?=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/PhotoContent.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entry/src/main/ets/common/PhotoContent.ets b/entry/src/main/ets/common/PhotoContent.ets index 3a2caac..a2d447f 100644 --- a/entry/src/main/ets/common/PhotoContent.ets +++ b/entry/src/main/ets/common/PhotoContent.ets @@ -36,7 +36,7 @@ export struct PhotoContent { topRectHeight: number = 0; aboutToAppear() { - this.columnsTemplate = this.currentBreakPoint === 'sm' ? '1fr 1fr 1fr 1fr' : '1fr 1fr 1fr'; + this.columnsTemplate = this.currentBreakPoint === 'sm' ? '1fr 1fr 1fr 1fr' : '1fr 1fr 1fr 1fr 1fr 1fr'; } onStateChange() { -- Gitee From 7b6f38ad4bd882fd22c4f6d60fa272295f52299f Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Tue, 4 Mar 2025 17:32:37 +0800 Subject: [PATCH 5/7] =?UTF-8?q?HMOSWorld=E6=95=B4=E6=94=B9=20(1)UX?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC=E9=80=82=E9=85=8D;=20(2)=E6=B7=B1=E6=B5=85?= =?UTF-8?q?=E8=89=B2=E9=80=82=E9=85=8D;=20(3)=E6=B2=89=E6=B5=B8=E5=BC=8F?= =?UTF-8?q?=E9=80=82=E9=85=8D;=20(4)=E4=B8=80=E5=A4=9A=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=95=B4=E6=94=B9;=20(5)=E5=9B=BE=E6=A0=87/=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2;=20(6)=E5=9B=BD=E9=99=85=E5=8C=96=E6=95=B4?= =?UTF-8?q?=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/PhotoContent.ets | 26 +++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/entry/src/main/ets/common/PhotoContent.ets b/entry/src/main/ets/common/PhotoContent.ets index a2d447f..f3cdcbd 100644 --- a/entry/src/main/ets/common/PhotoContent.ets +++ b/entry/src/main/ets/common/PhotoContent.ets @@ -36,14 +36,34 @@ export struct PhotoContent { topRectHeight: number = 0; aboutToAppear() { - this.columnsTemplate = this.currentBreakPoint === 'sm' ? '1fr 1fr 1fr 1fr' : '1fr 1fr 1fr 1fr 1fr 1fr'; + if (this.sideBarStatus === true && this.currentBreakPoint === 'md') { + this.columnsTemplate = '1fr 1fr 1fr'; + } else if (this.sideBarStatus === true && this.currentBreakPoint === 'lg') { + this.columnsTemplate = '1fr 1fr 1fr 1fr 1fr 1fr'; + } else if (this.sideBarStatus === false && this.currentBreakPoint === 'lg') { + this.columnsTemplate = '1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr'; + } else if (this.sideBarStatus === false && this.currentBreakPoint === 'md') { + this.columnsTemplate = '1fr 1fr 1fr 1fr'; + } else if (this.sideBarStatus === true && this.currentBreakPoint === 'sm'){ + this.columnsTemplate = '1fr 1fr 1fr 1fr'; + } else if (this.sideBarStatus === false && this.currentBreakPoint === 'sm'){ + this.columnsTemplate = '1fr 1fr 1fr 1fr'; + } } onStateChange() { animateTo({ duration: 300 }, () => { - if (this.sideBarStatus === true && this.currentBreakPoint !== 'sm') { + if (this.sideBarStatus === true && this.currentBreakPoint === 'md') { this.columnsTemplate = '1fr 1fr 1fr'; - } else { + } else if (this.sideBarStatus === true && this.currentBreakPoint === 'lg') { + this.columnsTemplate = '1fr 1fr 1fr 1fr 1fr 1fr'; + } else if (this.sideBarStatus === false && this.currentBreakPoint === 'lg') { + this.columnsTemplate = '1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr'; + } else if (this.sideBarStatus === false && this.currentBreakPoint === 'md') { + this.columnsTemplate = '1fr 1fr 1fr 1fr'; + } else if (this.sideBarStatus === true && this.currentBreakPoint === 'sm'){ + this.columnsTemplate = '1fr 1fr 1fr 1fr'; + } else if (this.sideBarStatus === false && this.currentBreakPoint === 'sm'){ this.columnsTemplate = '1fr 1fr 1fr 1fr'; } }) -- Gitee From 50f99f61d7eb8212d50d1307d52d03995d126f57 Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Sat, 8 Mar 2025 17:33:05 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B7=B7=E6=B7=86?= =?UTF-8?q?=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/build-profile.json5 | 17 ++++++++++++++++- entry/obfuscation-rules.txt | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 entry/obfuscation-rules.txt diff --git a/entry/build-profile.json5 b/entry/build-profile.json5 index ddd6e5f..6c21bc9 100644 --- a/entry/build-profile.json5 +++ b/entry/build-profile.json5 @@ -14,9 +14,24 @@ */ { - "apiType": 'stageMode', + "apiType": "stageMode", "buildOption": { }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], "targets": [ { "name": "default" diff --git a/entry/obfuscation-rules.txt b/entry/obfuscation-rules.txt new file mode 100644 index 0000000..a1dfa0b --- /dev/null +++ b/entry/obfuscation-rules.txt @@ -0,0 +1,22 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file -- Gitee From 30dd1a5b2250798f8c4701cb86715682b7a80ddf Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Thu, 13 Mar 2025 16:47:16 +0800 Subject: [PATCH 7/7] DTS2025031126065 --- entry/src/main/ets/common/SettingItem.ets | 4 ---- 1 file changed, 4 deletions(-) diff --git a/entry/src/main/ets/common/SettingItem.ets b/entry/src/main/ets/common/SettingItem.ets index 32e2d3b..f4358e6 100644 --- a/entry/src/main/ets/common/SettingItem.ets +++ b/entry/src/main/ets/common/SettingItem.ets @@ -46,10 +46,6 @@ export struct MainItem { } Blank() - - if (this.itemStatusDesc) { - Text(this.itemStatusDesc).fontWeight(FontWeight.Regular).fontSize(14) - } Image($r('app.media.ic_settings_arrow')) .width(12) .height(24) -- Gitee