From 78c99e78a8222186874af89b60259b0dad3d2ff6 Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Thu, 20 Feb 2025 11:21:16 +0800 Subject: [PATCH 1/5] =?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 --- build-profile.json5 | 16 ++++- .../main/ets/constants/CommonConstants.ets | 23 +++++++ .../main/ets/entryability/EntryAbility.ets | 30 ++++++++- .../ets/pages/AdaptiveTabCenteringIndex.ets | 34 ++++------ .../pages/DoubleTabAdaptiveCenteringIndex.ets | 53 ++++++--------- entry/src/main/ets/pages/Index.ets | 64 +++++++++++++------ .../ets/pages/TableAdaptiveExtensionIndex.ets | 37 ++++------- .../main/resources/base/element/float.json | 32 +++++++++- 8 files changed, 189 insertions(+), 100 deletions(-) diff --git a/build-profile.json5 b/build-profile.json5 index c033ce4..1f17cb1 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -1,6 +1,20 @@ { "app": { - "signingConfigs": [], + "signingConfigs": [ + { + "name": "default", + "type": "HarmonyOS", + "material": { + "certpath": "C:\\Users\\wpp\\.ohos\\config\\default_multi-ticket-class_5qKw0X0SO6oV-0rbjSYozcdFhCBMcog-D5x4MYCEFoI=.cer", + "storePassword": "0000001B89D3B02FD7FCE40B290788C11070ED482325472071C7FD3A1C7197D0B40C4BD9BB91AAD513CD47", + "keyAlias": "debugKey", + "keyPassword": "0000001BC482C482231A7727CC7EE301EE5F6F7DB3548807A3F9C7902457D0E108484101DBDD6C62A56E89", + "profile": "C:\\Users\\wpp\\.ohos\\config\\default_multi-ticket-class_5qKw0X0SO6oV-0rbjSYozcdFhCBMcog-D5x4MYCEFoI=.p7b", + "signAlg": "SHA256withECDSA", + "storeFile": "C:\\Users\\wpp\\.ohos\\config\\default_multi-ticket-class_5qKw0X0SO6oV-0rbjSYozcdFhCBMcog-D5x4MYCEFoI=.p12" + } + } + ], "products": [ { "name": "default", diff --git a/entry/src/main/ets/constants/CommonConstants.ets b/entry/src/main/ets/constants/CommonConstants.ets index f554fcb..ac13d60 100644 --- a/entry/src/main/ets/constants/CommonConstants.ets +++ b/entry/src/main/ets/constants/CommonConstants.ets @@ -131,7 +131,15 @@ export class CommonConstants { * Text font size. */ static readonly TEXT_FONT_SIZE: number = 10; + /** + * Index page padding top size. + */ + static readonly PADDING_TOP_INDEX: number = 16; + /** + * Index page padding bottom size. + */ + static readonly PADDING_BOTTOM_INDEX: number = 29; /** * Gray font flag. */ @@ -141,4 +149,19 @@ export class CommonConstants { * Red font flag. */ static readonly RED_FONT_FLAG: string = 'Red'; + + /** + * Single tab title. + */ + static readonly SINGLETAB_TITLE: string = 'tab自适应居中'; + + /** + * Single tab title. + */ + static readonly TABLE_TITLE: string = '表格自适应延伸'; + + /** + * Single tab title. + */ + static readonly DOUBLETAB_TITLE: string = '双tab自适应居中'; } \ 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 433dd87..97eeaa5 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -13,16 +13,28 @@ * limitations under the License. */ -import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; +import { AbilityConstant, Configuration, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; import { display, window } from '@kit.ArkUI'; import { CommonConstants } from '../constants/CommonConstants'; +import { BusinessError } from '@kit.BasicServicesKit'; export default class EntryAbility extends UIAbility { private windowObj?: window.Window; 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 { @@ -34,6 +46,14 @@ export default class EntryAbility extends UIAbility { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); windowStage.getMainWindow().then((data: window.Window) => { + let type = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR; + let avoidArea = data.getWindowAvoidArea(type); + let bottomRectHeight = avoidArea.bottomRect.height; + AppStorage.setOrCreate('bottomRectHeight', bottomRectHeight); + type = window.AvoidAreaType.TYPE_SYSTEM; + avoidArea = data.getWindowAvoidArea(type); + let topRectHeight = avoidArea.topRect.height; + AppStorage.setOrCreate('topRectHeight', topRectHeight); this.windowObj = data; this.updateBreakpoint(this.windowObj.getWindowProperties().windowRect.width); this.windowObj.on('windowSizeChange', (windowSize: window.Size) => { @@ -41,12 +61,20 @@ export default class EntryAbility extends UIAbility { }); }) + 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/AdaptiveTabCenteringIndex.ets b/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets index d3ed4fd..fe07dbc 100644 --- a/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets +++ b/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets @@ -22,25 +22,14 @@ export struct AdaptiveTabCenteringIndex { @StorageLink('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_SM; @Consume('pageInfos') pageInfos: NavPathStack; @State tabIndexSelected: number = 0; + @StorageProp('bottomRectHeight') + bottomRectHeight: number = 0; + @StorageProp('topRectHeight') + topRectHeight: number = 0; build() { NavDestination() { Column() { - Row() { - Image($r('app.media.icon_back')) - .width($r('app.float.image_width')) - .height($r('app.float.image_height')) - .onClick(() => { - this.pageInfos.pop(); - }) - } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .margin({ - left: $r('app.float.back_margin_left'), - top: $r('app.float.back_margin_top') - }) - .justifyContent(FlexAlign.Start) - Column() { Row() { Column() { @@ -54,7 +43,8 @@ export struct AdaptiveTabCenteringIndex { Text(item) .fontSize($r('app.float.font_size_16')) .fontWeight(CommonConstants.FONT_WEIGHT_500) - .fontColor(this.tabIndexSelected === index ? $r('app.color.red') : $r('app.color.black')) + .fontColor(this.tabIndexSelected === index ? $r('sys.color.font_emphasize') : + $r('sys.color.font_primary')) .height($r('app.float.text_height')) .focusable(true) .groupDefaultFocus(index === 0 ? true : false) @@ -76,6 +66,7 @@ export struct AdaptiveTabCenteringIndex { bottom: BorderStyle.Solid } }) + .borderColor($r('sys.color.font_emphasize')) .onClick(() => { this.tabIndexSelected = index; }) @@ -86,7 +77,7 @@ export struct AdaptiveTabCenteringIndex { } .width($r('app.float.width_296')) .height($r('app.float.height_56')) - .backgroundColor($r('app.color.adaptive_tab_background')) + .backgroundColor($r('sys.color.background_primary')) .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) .layoutWeight(CommonConstants.COMMON_FAL_1) @@ -94,10 +85,13 @@ export struct AdaptiveTabCenteringIndex { .height($r('app.float.height_56')) .width(CommonConstants.FULL_WIDTH_PERCENT) } - .height(CommonConstants.NINETY_PERCENT) - .justifyContent(FlexAlign.Center) + .height('100%') + .justifyContent(FlexAlign.Start) } + .height('100%') } - .hideTitleBar(true) + .padding({ top: px2vp(this.topRectHeight) }) + .backgroundColor($r('sys.color.background_primary')) + .title(CommonConstants.SINGLETAB_TITLE, { backgroundColor: $r('sys.color.background_primary') }) } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets b/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets index 6a66e8a..5a12da7 100644 --- a/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets +++ b/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets @@ -23,25 +23,14 @@ export struct DoubleTabAdaptiveCenteringIndex { @Consume('pageInfos') pageInfos: NavPathStack; @State tabIndexSelected: number = 0; @State tabIndexSelected2: number = 0; + @StorageProp('bottomRectHeight') + bottomRectHeight: number = 0; + @StorageProp('topRectHeight') + topRectHeight: number = 0; build() { NavDestination() { Column() { - Row() { - Image($r('app.media.icon_back')) - .width($r('app.float.image_width')) - .height($r('app.float.image_height')) - .onClick(() => { - this.pageInfos.pop(); - }) - } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .margin({ - left: $r('app.float.back_margin_left'), - top: $r('app.float.back_margin_top') - }) - .justifyContent(FlexAlign.Start) - Column() { Row() { Column() { @@ -55,7 +44,8 @@ export struct DoubleTabAdaptiveCenteringIndex { Text(item) .fontSize($r('app.float.font_size_16')) .fontWeight(CommonConstants.FONT_WEIGHT_500) - .fontColor(this.tabIndexSelected === index ? $r('app.color.red') : $r('app.color.black')) + .fontColor(this.tabIndexSelected === index ? $r('sys.color.font_emphasize') : + $r('sys.color.font_primary')) .height($r('app.float.text_height')) .focusable(true) .groupDefaultFocus(index === 0 ? true : false) @@ -68,7 +58,7 @@ export struct DoubleTabAdaptiveCenteringIndex { $r('app.float.bottom_width_2') : $r('app.float.bottom_width_0') }, color: { - bottom: this.tabIndexSelected === index ? $r('app.color.red') : '' + bottom: this.tabIndexSelected === index ? $r('sys.color.font_emphasize') : '' }, style: { bottom: BorderStyle.Solid @@ -92,18 +82,15 @@ export struct DoubleTabAdaptiveCenteringIndex { } .width($r('app.float.width_296')) .height($r('app.float.height_56')) - .margin({ left: $r('app.float.stock_column_margin') }) + .padding({ left: $r('sys.float.padding_level12') }) .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) .layoutWeight(CommonConstants.COMMON_FAL_1) - Image($r('app.media.ic_public_more')) - .width($r('app.float.image_width')) - .height($r('app.float.image_height')) - .margin({ - left: $r('app.float.more_margin_left'), - right: $r('app.float.more_margin_right') - }) + SymbolGlyph($r('sys.symbol.line_3_horizontal')) + .fontColor([$r('sys.color.icon_primary')]) + .fontSize($r('sys.float.Title_M')) + .margin({ right: $r('sys.float.padding_level10') }) .visibility(this.breakPoint === CommonConstants.BREAK_POINT_LG ? Visibility.Hidden : Visibility.Visible) } .height($r('app.float.height_56')) @@ -121,9 +108,8 @@ export struct DoubleTabAdaptiveCenteringIndex { Text(item) .fontSize($r('app.float.font_size_14')) .fontWeight(CommonConstants.FONT_WEIGHT_500) - .fontColor( - this.tabIndexSelected2 === index ? $r('app.color.selected_text_color') : $r('app.color.black') - ) + .fontColor(this.tabIndexSelected2 === index ? $r('sys.color.font_on_primary') : + $r('sys.color.font_primary')) .margin({ top: $r('app.float.text_margin_top_and_bottom'), bottom: $r('app.float.text_margin_top_and_bottom'), @@ -136,8 +122,8 @@ export struct DoubleTabAdaptiveCenteringIndex { } } .backgroundColor( - this.tabIndexSelected2 === index ? $r('app.color.selected_text_background') : - $r('app.color.text_background') + this.tabIndexSelected2 === index ? $r('sys.color.font_emphasize') : + $r('sys.color.comp_background_tertiary') ) .border({ radius: CommonConstants.BORDER_RADIUS }) .onClick(() => { @@ -154,13 +140,16 @@ export struct DoubleTabAdaptiveCenteringIndex { .alignItems(HorizontalAlign.Center) .layoutWeight(CommonConstants.COMMON_FAL_1) } + .padding({ left: $r('sys.float.padding_level8') }) .height($r('app.float.height_56')) .width(CommonConstants.FULL_WIDTH_PERCENT) } .height(CommonConstants.NINETY_PERCENT) - .justifyContent(FlexAlign.Center) + .justifyContent(FlexAlign.Start) } } - .hideTitleBar(true) + .padding({ top: px2vp(this.topRectHeight) }) + .backgroundColor($r('sys.color.background_primary')) + .title(CommonConstants.DOUBLETAB_TITLE) } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 75fb8f9..873c588 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -18,6 +18,7 @@ import { ListDataConstants } from '../constants/ListDataConstants'; import { AdaptiveTabCenteringIndex } from './AdaptiveTabCenteringIndex'; import { TableAdaptiveExtensionIndex } from './TableAdaptiveExtensionIndex'; import { DoubleTabAdaptiveCenteringIndex } from './DoubleTabAdaptiveCenteringIndex'; +import { BreakpointType } from '../utils/BreakpointType'; class DirectoryItem { title: ResourceStr = ''; @@ -28,9 +29,13 @@ class DirectoryItem { @Entry @Component struct Index { + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack(); @StorageLink('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_SM; - @Provide('pageInfos') pageInfos : NavPathStack = new NavPathStack(); - private title: string | Resource = $r('app.string.title'); + @StorageProp('bottomRectHeight') + bottomRectHeight: number = 0; + @StorageProp('topRectHeight') + topRectHeight: number = 0; + private title: string | Resource = $r('app.string.EntryAbility_label'); private directory: DirectoryItem[] = [ { title: $r('app.string.tab_adaptive'), @@ -49,12 +54,13 @@ struct Index { } ]; - @Builder PageMap(name : string){ - if(name === ListDataConstants.TAB_ADAPTIVE_URI){ + @Builder + PageMap(name: string) { + if (name === ListDataConstants.TAB_ADAPTIVE_URI) { AdaptiveTabCenteringIndex() - }else if(name === ListDataConstants.TABLE_ADAPTIVE_URI){ + } else if (name === ListDataConstants.TABLE_ADAPTIVE_URI) { TableAdaptiveExtensionIndex() - }else{ + } else { DoubleTabAdaptiveCenteringIndex() } } @@ -79,32 +85,48 @@ struct Index { lg: CommonConstants.COLUMN_LG } }) { - Column() { - Navigation(this.pageInfos) { + Navigation(this.pageInfos) { + Column() { + Text(this.title) + .fontWeight(FontWeight.Bold) + .fontColor($r('sys.color.font_primary')) + .fontSize($r('sys.float.Title_L')) + .alignSelf(ItemAlign.Start) Column() { - Text(this.title) - ForEach(this.directory, (item: DirectoryItem) => { Button(item.title) .id(item.id) - .fontSize($r('app.float.font_size')) - .width(CommonConstants.NINETY_PERCENT) + .fontSize($r('sys.float.Subtitle_M')) + .fontColor($r('sys.color.font_on_primary')) + .width(this.breakPoint === 'sm' ? $r('app.float.index_button_width_sm') : + $r('app.float.index_button_width_lg')) .height($r('app.float.button_height')) - .margin($r('app.float.button_margin')) - .backgroundColor($r('app.color.button_background')) + .margin({ bottom: $r('sys.float.padding_level6') }) + .backgroundColor($r('sys.color.comp_background_emphasize')) .onClick(() => { - this.pageInfos.pushPath(new NavPathInfo(item.uri,[])); + this.pageInfos.pushPath(new NavPathInfo(item.uri, [])); }) }, (item: DirectoryItem) => JSON.stringify(item)) } - .width(CommonConstants.FULL_WIDTH_PERCENT) } - .navDestination(this.PageMap) - .mode(NavigationMode.Stack) - .hideBackButton(true) - .titleMode(NavigationTitleMode.Mini) - .title(this.title) + .backgroundColor($r('sys.color.background_primary')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height(CommonConstants.FULL_WIDTH_PERCENT) + .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) + }) } + .height(CommonConstants.FULL_WIDTH_PERCENT) + .backgroundColor($r('sys.color.background_primary')) + .navDestination(this.PageMap) + .mode(NavigationMode.Stack) + .hideBackButton(true) + .titleMode(NavigationTitleMode.Mini) } } } diff --git a/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets b/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets index d9f463a..867191d 100644 --- a/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets +++ b/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets @@ -21,17 +21,21 @@ export struct TableAdaptiveExtensionIndex { @StorageLink('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_SM; @Consume('pageInfos') pageInfos: NavPathStack; @State tabIndexSelected: number = 0; + @StorageProp('bottomRectHeight') + bottomRectHeight: number = 0; + @StorageProp('topRectHeight') + topRectHeight: number = 0; @Builder Item(item: string, index: number, color: string) { Row() { Text(item) .maxLines(1) - .textOverflow({ overflow: TextOverflow.Ellipsis}) + .textOverflow({ overflow: TextOverflow.Ellipsis }) .fontSize($r('app.float.font_size_14')) .fontWeight(CommonConstants.FONT_WEIGHT_500) - .fontColor(color === CommonConstants.GRAY_FONT_FLAG ? (index > 0 ? Color.Gray : Color.Black) : - ((index === 2 || index === 3) ? Color.Red : Color.Black)) + .fontColor(color === CommonConstants.GRAY_FONT_FLAG ? (index > 0 ? Color.Gray : $r('sys.color.font_primary')) : + ((index === 2 || index === 3) ? $r('sys.color.font_emphasize') : $r('sys.color.font_primary'))) .height($r('app.float.text_height')) } .flexShrink(CommonConstants.COMMON_FAL_1) @@ -40,21 +44,6 @@ export struct TableAdaptiveExtensionIndex { build() { NavDestination() { Column() { - Row() { - Image($r('app.media.icon_back')) - .width($r('app.float.image_width')) - .height($r('app.float.image_height')) - .onClick(() => { - this.pageInfos.pop(); - }) - } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .margin({ - left: $r('app.float.back_margin_left'), - top: $r('app.float.back_margin_top') - }) - .justifyContent(FlexAlign.Start) - Row() { if (this.breakPoint === CommonConstants.BREAK_POINT_LG) { Column() { @@ -78,7 +67,7 @@ export struct TableAdaptiveExtensionIndex { Text(item) .fontSize($r('app.float.font_size_14')) .fontWeight(CommonConstants.FONT_WEIGHT_500) - .fontColor(Color.Black) + .fontColor($r('sys.color.font_primary')) .height($r('app.float.text_height')) Image(index > 0 ? $r('app.media.ic_public_right') : $r('app.media.ic_public_info')) .width($r('app.float.icon_size')) @@ -89,7 +78,7 @@ export struct TableAdaptiveExtensionIndex { Text('60**39') .fontSize(CommonConstants.TEXT_FONT_SIZE) .fontWeight(CommonConstants.FONT_WEIGHT_500) - .fontColor($r('app.color.text_font_color')) + .fontColor($r('sys.color.font_secondary')) .height($r('app.float.text_height')) } } @@ -108,7 +97,7 @@ export struct TableAdaptiveExtensionIndex { .justifyContent(FlexAlign.SpaceBetween) Divider() - .color($r('app.color.text_font_color')) + .color($r('sys.color.comp_foreground_primary')) Row() { Column() { @@ -156,7 +145,7 @@ export struct TableAdaptiveExtensionIndex { .height(CommonConstants.EIGHTY_PERCENT) .width(this.breakPoint === CommonConstants.BREAK_POINT_LG ? CommonConstants.FIFTY_PERCENT : CommonConstants.FULL_WIDTH_PERCENT) - .justifyContent(this.breakPoint === CommonConstants.BREAK_POINT_LG ? FlexAlign.End : FlexAlign.Center) + .justifyContent(FlexAlign.Start) .padding({ left: $r('app.float.stock_data_margin'), right: $r('app.float.stock_data_margin') @@ -165,6 +154,8 @@ export struct TableAdaptiveExtensionIndex { .width(CommonConstants.FULL_WIDTH_PERCENT) } } - .hideTitleBar(true) + .padding({ top: px2vp(this.topRectHeight) }) + .backgroundColor($r('sys.color.background_primary')) + .title(CommonConstants.TABLE_TITLE) } } \ 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 index e61e17f..5f299aa 100644 --- a/entry/src/main/resources/base/element/float.json +++ b/entry/src/main/resources/base/element/float.json @@ -4,9 +4,29 @@ "name": "font_size", "value": "20fp" }, + { + "name": "title_font_size", + "value": "30px" + }, + { + "name": "button_font_size", + "value": "16px" + }, + { + "name": "title_font_weight", + "value": "500" + }, { "name": "button_height", - "value": "55vp" + "value": "40vp" + }, + { + "name": "index_button_width_sm", + "value": "328vp" + }, + { + "name": "index_button_width_lg", + "value": "448vp" }, { "name": "button_margin", @@ -114,11 +134,19 @@ }, { "name": "recommendation_margin_top", - "value": "18vp" + "value": "22vp" }, { "name": "recommendation_margin_bottom", "value": "13vp" + }, + { + "name": "default_16", + "value": "16vp" + }, + { + "name": "default_29", + "value": "29vp" } ] } \ No newline at end of file -- Gitee From 239f01b2b00d15702287e934f81f4edcb5fc8908 Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Fri, 21 Feb 2025 15:34:06 +0800 Subject: [PATCH 2/5] =?UTF-8?q?HMOSWorld=E6=95=B4=E6=94=B91:=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 --- .../main/ets/constants/CommonConstants.ets | 30 ++- .../ets/pages/AdaptiveTabCenteringIndex.ets | 115 ++++----- .../pages/DoubleTabAdaptiveCenteringIndex.ets | 233 ++++++++++-------- entry/src/main/ets/pages/Index.ets | 22 +- .../ets/pages/TableAdaptiveExtensionIndex.ets | 40 ++- .../main/resources/base/element/float.json | 44 +++- .../main/resources/base/element/string.json | 4 + .../main/resources/en_US/element/string.json | 4 + .../main/resources/zh_CN/element/string.json | 4 + 9 files changed, 316 insertions(+), 180 deletions(-) diff --git a/entry/src/main/ets/constants/CommonConstants.ets b/entry/src/main/ets/constants/CommonConstants.ets index ac13d60..cb7069c 100644 --- a/entry/src/main/ets/constants/CommonConstants.ets +++ b/entry/src/main/ets/constants/CommonConstants.ets @@ -55,7 +55,11 @@ export class CommonConstants { /** * Tab adaptive padding sm. */ - static readonly TAB_PADDING_SM: string = '18vp'; + static readonly TAB_PADDING_SM: string = '8vp'; + /** + * number 2 + */ + static readonly NUMBER_TWO: number = 2; /** * Tab adaptive padding md. @@ -90,7 +94,7 @@ export class CommonConstants { /** * Double tab adaptive padding lg. */ - static readonly DOUBLE_TAB_PADDING_LG2: string = '67vp'; + static readonly DOUBLE_TAB_PADDING_LG2: string = '130vp'; /** * The full percentage of component. @@ -139,7 +143,7 @@ export class CommonConstants { /** * Index page padding bottom size. */ - static readonly PADDING_BOTTOM_INDEX: number = 29; + static readonly PADDING_BOTTOM_INDEX: number = 8; /** * Gray font flag. */ @@ -164,4 +168,24 @@ export class CommonConstants { * Single tab title. */ static readonly DOUBLETAB_TITLE: string = '双tab自适应居中'; + + /** + * Common font weight. + */ + static readonly FONT_WEIGHT_700: number = 700; + + /** + * Table list padding sm. + */ + static readonly TABLE_LIST_PADDING_SM: number = 24; + + /** + * Table list padding md. + */ + static readonly TABLE_LIST_PADDING_MD: number = 95; + + /** + * Table list padding lg. + */ + static readonly TABLE_LIST_PADDING_LG: number = 175; } \ No newline at end of file diff --git a/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets b/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets index fe07dbc..1d3a4ea 100644 --- a/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets +++ b/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets @@ -30,68 +30,73 @@ export struct AdaptiveTabCenteringIndex { build() { NavDestination() { Column() { - Column() { - Row() { - Column() { - List({ - space: new BreakpointType(CommonConstants.TAB_PADDING_SM, CommonConstants.TAB_PADDING_MD, - CommonConstants.TAB_PADDING_LG).getValue(this.breakPoint) - }) { - ForEach(ListDataConstants.RECOMMENDATION_TAB_LIST, (item: string, index: number) => { - ListItem() { - Column() { - Text(item) - .fontSize($r('app.float.font_size_16')) - .fontWeight(CommonConstants.FONT_WEIGHT_500) - .fontColor(this.tabIndexSelected === index ? $r('sys.color.font_emphasize') : - $r('sys.color.font_primary')) - .height($r('app.float.text_height')) - .focusable(true) - .groupDefaultFocus(index === 0 ? true : false) - } - } - .margin({ - top: $r('app.float.recommendation_margin_top'), - bottom: $r('app.float.recommendation_margin_bottom') - }) - .border({ - width: { - bottom: this.tabIndexSelected === index ? - $r('app.float.bottom_width_2') : $r('app.float.bottom_width_0') - }, - color: { - bottom: this.tabIndexSelected === index ? $r('app.color.red') : '' - }, - style: { - bottom: BorderStyle.Solid - } - }) - .borderColor($r('sys.color.font_emphasize')) - .onClick(() => { - this.tabIndexSelected = index; - }) - }, (item: string, index: number) => index + JSON.stringify(item)) + Row() { + Button({ type: ButtonType.Circle }) { + SymbolGlyph($r('sys.symbol.chevron_backward')) + .fontColor([$r('sys.color.icon_primary')]) + .fontSize($r('sys.float.Title_M')) + } + .height($r('app.float.back_button_height')) + .aspectRatio(1) + .backgroundColor($r('sys.color.comp_background_tertiary')) + .onClick(() => this.pageInfos.pop()) + + Text(CommonConstants.SINGLETAB_TITLE) + .margin({ left: $r('sys.float.padding_level4') }) + .font({ size: $r('app.float.bar_font_size'), weight: CommonConstants.FONT_WEIGHT_700 }) + .fontColor($r('sys.color.font_primary')) + } + .margin({ + left: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), + $r('sys.float.padding_level16')).getValue(this.breakPoint) + }) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height($r('app.float.bar_height')) + .zIndex(CommonConstants.NUMBER_TWO) + + Row() { + List({ space: CommonConstants.TAB_PADDING_SM }) { + ForEach(ListDataConstants.RECOMMENDATION_TAB_LIST, (item: string, index: number) => { + ListItem() { + Button(item) + .fontSize($r('app.float.font_size_16')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .backgroundColor(this.tabIndexSelected === index ? $r('sys.color.comp_background_emphasize') : + $r('sys.color.comp_background_tertiary')) + .fontColor(this.tabIndexSelected === index ? $r('sys.color.font_on_primary') : + $r('sys.color.font_primary')) + .width($r('app.float.text_width1')) + .height($r('app.float.text_height')) + .focusable(true) + .groupDefaultFocus(index === 0 ? true : false) } - .scrollBar(BarState.Off) - .listDirection(Axis.Horizontal) - } - .width($r('app.float.width_296')) - .height($r('app.float.height_56')) - .backgroundColor($r('sys.color.background_primary')) - .justifyContent(FlexAlign.Center) - .alignItems(HorizontalAlign.Center) - .layoutWeight(CommonConstants.COMMON_FAL_1) + .width($r('app.float.text_width1')) + .margin({ + top: $r('app.float.recommendation_margin_top'), + bottom: $r('app.float.recommendation_margin_bottom') + }) + .onClick(() => { + this.tabIndexSelected = index; + }) + }, (item: string, index: number) => index + JSON.stringify(item)) } - .height($r('app.float.height_56')) - .width(CommonConstants.FULL_WIDTH_PERCENT) + .alignListItem(ListItemAlign.Start) + .scrollBar(BarState.Off) + .listDirection(Axis.Horizontal) } - .height('100%') - .justifyContent(FlexAlign.Start) + .margin({ + left: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), + $r('sys.float.padding_level16')).getValue(this.breakPoint) + }) + .backgroundColor($r('sys.color.background_secondary')) + .height($r('app.float.height_56')) + .width(CommonConstants.FULL_WIDTH_PERCENT) } .height('100%') } + .hideTitleBar(true) .padding({ top: px2vp(this.topRectHeight) }) - .backgroundColor($r('sys.color.background_primary')) + .backgroundColor($r('sys.color.background_secondary')) .title(CommonConstants.SINGLETAB_TITLE, { backgroundColor: $r('sys.color.background_primary') }) } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets b/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets index 5a12da7..0d9aabe 100644 --- a/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets +++ b/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets @@ -31,125 +31,150 @@ export struct DoubleTabAdaptiveCenteringIndex { build() { NavDestination() { Column() { - Column() { - Row() { - Column() { - List({ - space: new BreakpointType(CommonConstants.DOUBLE_TAB_PADDING_SM, CommonConstants.DOUBLE_TAB_PADDING_MD1, - CommonConstants.DOUBLE_TAB_PADDING_LG1).getValue(this.breakPoint) - }) { - ForEach(ListDataConstants.STOCK_OPTIONS_LIST1, (item: string, index: number) => { - ListItem() { - Column() { - Text(item) - .fontSize($r('app.float.font_size_16')) - .fontWeight(CommonConstants.FONT_WEIGHT_500) - .fontColor(this.tabIndexSelected === index ? $r('sys.color.font_emphasize') : - $r('sys.color.font_primary')) - .height($r('app.float.text_height')) - .focusable(true) - .groupDefaultFocus(index === 0 ? true : false) - } - } - .margin({ top: $r('app.float.stock_options_margin') }) - .border({ - width: { - bottom: this.tabIndexSelected === index ? - $r('app.float.bottom_width_2') : $r('app.float.bottom_width_0') - }, - color: { - bottom: this.tabIndexSelected === index ? $r('sys.color.font_emphasize') : '' - }, - style: { - bottom: BorderStyle.Solid - } - }) - .onClick(() => { - this.tabIndexSelected = index; - }) - }, (item: string, index: number) => index + JSON.stringify(item)) + Row() { + Button({ type: ButtonType.Circle }) { + SymbolGlyph($r('sys.symbol.chevron_backward')) + .fontColor([$r('sys.color.icon_primary')]) + .fontSize($r('sys.float.Title_M')) + } + .height($r('app.float.back_button_height')) + .aspectRatio(1) + .backgroundColor($r('sys.color.comp_background_tertiary')) + .onClick(() => this.pageInfos.pop()) + Text(CommonConstants.DOUBLETAB_TITLE) + .margin({ left: $r('sys.float.padding_level4') }) + .font({ size: $r('app.float.bar_font_size'), weight: CommonConstants.FONT_WEIGHT_700 }) + .fontColor($r('sys.color.font_primary')) + } + .margin({ + left: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), + $r('sys.float.padding_level16')).getValue(this.breakPoint) + }) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height($r('app.float.bar_height')) + .zIndex(CommonConstants.NUMBER_TWO) + + //Column() { + Row() { + Column() { + List({ + space: new BreakpointType(CommonConstants.TABLE_LIST_PADDING_SM, CommonConstants.TABLE_LIST_PADDING_MD, + CommonConstants.TABLE_LIST_PADDING_LG).getValue(this.breakPoint) + }) { + ForEach(ListDataConstants.STOCK_OPTIONS_LIST1, (item: string, index: number) => { ListItem() { - Image($r('app.media.ic_public_more')) - .width($r('app.float.image_width')) - .height($r('app.float.image_height')) + Column() { + Text(item) + .fontSize($r('app.float.font_size_16')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontColor(this.tabIndexSelected === index ? $r('sys.color.font_emphasize') : + $r('sys.color.font_primary')) + .height($r('app.float.text_height')) + .focusable(true) + .groupDefaultFocus(index === 0 ? true : false) + } } - .margin({ top: $r('app.float.more_margin_top') }) - .visibility(this.breakPoint === CommonConstants.BREAK_POINT_LG ? Visibility.Visible : Visibility.Hidden) - } - .scrollBar(BarState.Off) - .listDirection(Axis.Horizontal) + .margin({ top: $r('app.float.stock_options_margin') }) + .border({ + width: { + bottom: this.tabIndexSelected === index ? + $r('app.float.bottom_width_2') : $r('app.float.bottom_width_0') + }, + color: { + bottom: this.tabIndexSelected === index ? $r('sys.color.font_emphasize') : '' + }, + style: { + bottom: BorderStyle.Solid + } + }) + .onClick(() => { + this.tabIndexSelected = index; + }) + }, (item: string, index: number) => index + JSON.stringify(item)) } - .width($r('app.float.width_296')) - .height($r('app.float.height_56')) - .padding({ left: $r('sys.float.padding_level12') }) - .justifyContent(FlexAlign.Center) - .alignItems(HorizontalAlign.Center) - .layoutWeight(CommonConstants.COMMON_FAL_1) - - SymbolGlyph($r('sys.symbol.line_3_horizontal')) - .fontColor([$r('sys.color.icon_primary')]) - .fontSize($r('sys.float.Title_M')) - .margin({ right: $r('sys.float.padding_level10') }) - .visibility(this.breakPoint === CommonConstants.BREAK_POINT_LG ? Visibility.Hidden : Visibility.Visible) + .alignListItem(ListItemAlign.Center) + .scrollBar(BarState.Off) + .listDirection(Axis.Horizontal) } + .margin({ bottom: $r('app.float.stock_options_margin') }) + .alignItems(HorizontalAlign.Start) + .justifyContent(FlexAlign.Start) + .width(new BreakpointType($r('app.float.width_296'), $r('app.float.width_312'), + $r('app.float.width_312')).getValue(this.breakPoint)) .height($r('app.float.height_56')) - .width(CommonConstants.FULL_WIDTH_PERCENT) - Row() { - Column() { - List({ - space: new BreakpointType(CommonConstants.DOUBLE_TAB_PADDING_SM, CommonConstants.DOUBLE_TAB_PADDING_MD2, - CommonConstants.DOUBLE_TAB_PADDING_LG2).getValue(this.breakPoint) - }) { - ForEach(ListDataConstants.STOCK_OPTIONS_LIST2, (item: string, index: number) => { - ListItem() { - Column() { - Text(item) - .fontSize($r('app.float.font_size_14')) - .fontWeight(CommonConstants.FONT_WEIGHT_500) - .fontColor(this.tabIndexSelected2 === index ? $r('sys.color.font_on_primary') : - $r('sys.color.font_primary')) - .margin({ - top: $r('app.float.text_margin_top_and_bottom'), - bottom: $r('app.float.text_margin_top_and_bottom'), - left: $r('app.float.text_margin_left_and_right'), - right: $r('app.float.text_margin_left_and_right') - }) - .textAlign(TextAlign.Center) - .focusable(true) - .groupDefaultFocus(index === 0 ? true : false) - } + .layoutWeight(CommonConstants.COMMON_FAL_1) + + SymbolGlyph($r('sys.symbol.line_3_horizontal')) + .fontColor([$r('sys.color.icon_primary')]) + .fontSize($r('sys.float.Title_M')) + .margin({ + right: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), + $r('sys.float.padding_level16')).getValue(this.breakPoint) + }) + } + .justifyContent(FlexAlign.Start) + .backgroundColor($r('sys.color.background_secondary')) + .margin({ + left: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), + $r('sys.float.padding_level16')).getValue(this.breakPoint) + }) + .height($r('app.float.height_56')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + + Row() { + Column() { + List({ + space: new BreakpointType(CommonConstants.DOUBLE_TAB_PADDING_SM, CommonConstants.DOUBLE_TAB_PADDING_MD2, + CommonConstants.DOUBLE_TAB_PADDING_LG2).getValue(this.breakPoint) + }) { + ForEach(ListDataConstants.STOCK_OPTIONS_LIST2, (item: string, index: number) => { + ListItem() { + Column() { + Text(item) + .fontSize($r('app.float.font_size_14')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontColor(this.tabIndexSelected2 === index ? $r('sys.color.font_on_primary') : + $r('sys.color.font_primary')) + .margin({ + top: $r('app.float.text_margin_top_and_bottom'), + bottom: $r('app.float.text_margin_top_and_bottom'), + left: $r('app.float.text_margin_left_and_right'), + right: $r('app.float.text_margin_left_and_right') + }) + .textAlign(TextAlign.Center) + .focusable(true) + .groupDefaultFocus(index === 0 ? true : false) } - .backgroundColor( - this.tabIndexSelected2 === index ? $r('sys.color.font_emphasize') : - $r('sys.color.comp_background_tertiary') - ) - .border({ radius: CommonConstants.BORDER_RADIUS }) - .onClick(() => { - this.tabIndexSelected2 = index; - }) - }, (item: string, index: number) => index + JSON.stringify(item)) - } - .scrollBar(BarState.Off) - .listDirection(Axis.Horizontal) + } + .backgroundColor( + this.tabIndexSelected2 === index ? $r('sys.color.font_emphasize') : + $r('sys.color.comp_background_tertiary') + ) + .border({ radius: CommonConstants.BORDER_RADIUS }) + .onClick(() => { + this.tabIndexSelected2 = index; + }) + }, (item: string, index: number) => index + JSON.stringify(item)) } - .width($r('app.float.width_296')) - .height($r('app.float.height_56')) - .justifyContent(FlexAlign.Center) - .alignItems(HorizontalAlign.Center) - .layoutWeight(CommonConstants.COMMON_FAL_1) + .scrollBar(BarState.Off) + .listDirection(Axis.Horizontal) } - .padding({ left: $r('sys.float.padding_level8') }) + .width($r('app.float.width_296')) .height($r('app.float.height_56')) - .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Center) + .alignItems(HorizontalAlign.Center) + .layoutWeight(CommonConstants.COMMON_FAL_1) } - .height(CommonConstants.NINETY_PERCENT) - .justifyContent(FlexAlign.Start) + .padding({ left: $r('sys.float.padding_level8') }) + .height($r('app.float.height_56')) + .width(CommonConstants.FULL_WIDTH_PERCENT) } } + .hideTitleBar(true) .padding({ top: px2vp(this.topRectHeight) }) - .backgroundColor($r('sys.color.background_primary')) + .backgroundColor($r('sys.color.background_secondary')) .title(CommonConstants.DOUBLETAB_TITLE) } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 873c588..997e60f 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -92,33 +92,41 @@ struct Index { .fontColor($r('sys.color.font_primary')) .fontSize($r('sys.float.Title_L')) .alignSelf(ItemAlign.Start) + .margin({ + left: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), + $r('sys.float.padding_level16')).getValue(this.breakPoint) + }) Column() { ForEach(this.directory, (item: DirectoryItem) => { Button(item.title) .id(item.id) .fontSize($r('sys.float.Subtitle_M')) .fontColor($r('sys.color.font_on_primary')) - .width(this.breakPoint === 'sm' ? $r('app.float.index_button_width_sm') : - $r('app.float.index_button_width_lg')) + .width(CommonConstants.FULL_WIDTH_PERCENT) .height($r('app.float.button_height')) - .margin({ bottom: $r('sys.float.padding_level6') }) + .margin({ top: $r('sys.float.padding_level6') }) .backgroundColor($r('sys.color.comp_background_emphasize')) .onClick(() => { this.pageInfos.pushPath(new NavPathInfo(item.uri, [])); }) }, (item: DirectoryItem) => JSON.stringify(item)) } + .width(new BreakpointType($r('app.string.fullwidth'), $r('app.float.index_button_width_md'), + $r('app.float.index_button_width_lg')).getValue(this.breakPoint)) + .padding({ + left: new BreakpointType($r('app.float.index_button_width_sm'), $r('app.float.index_button_padding_md_lg'), + $r('app.float.index_button_padding_md_lg')).getValue(this.breakPoint), + right: new BreakpointType($r('app.float.index_button_width_sm'), $r('app.float.index_button_padding_md_lg'), + $r('app.float.index_button_padding_md_lg')).getValue(this.breakPoint) + }) } .backgroundColor($r('sys.color.background_primary')) .width(CommonConstants.FULL_WIDTH_PERCENT) .height(CommonConstants.FULL_WIDTH_PERCENT) - .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) + bottom: px2vp(this.bottomRectHeight) }) } .height(CommonConstants.FULL_WIDTH_PERCENT) diff --git a/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets b/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets index 867191d..29627e9 100644 --- a/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets +++ b/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets @@ -15,6 +15,7 @@ import { ListDataConstants } from '../constants/ListDataConstants'; import { CommonConstants } from '../constants/CommonConstants'; +import { BreakpointType } from '../utils/BreakpointType'; @Component export struct TableAdaptiveExtensionIndex { @@ -44,6 +45,30 @@ export struct TableAdaptiveExtensionIndex { build() { NavDestination() { Column() { + Row() { + Button({ type: ButtonType.Circle }) { + SymbolGlyph($r('sys.symbol.chevron_backward')) + .fontColor([$r('sys.color.icon_primary')]) + .fontSize($r('sys.float.Title_M')) + } + .height($r('app.float.back_button_height')) + .aspectRatio(1) + .backgroundColor($r('sys.color.comp_background_tertiary')) + .onClick(() => this.pageInfos.pop()) + + Text(CommonConstants.TABLE_TITLE) + .margin({ left: $r('sys.float.padding_level4') }) + .font({ size: $r('app.float.bar_font_size'), weight: CommonConstants.FONT_WEIGHT_700 }) + .fontColor($r('sys.color.font_primary')) + } + .margin({ + left: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), + $r('sys.float.padding_level16')).getValue(this.breakPoint) + }) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height($r('app.float.bar_height')) + .zIndex(CommonConstants.NUMBER_TWO) + Row() { if (this.breakPoint === CommonConstants.BREAK_POINT_LG) { Column() { @@ -89,7 +114,6 @@ export struct TableAdaptiveExtensionIndex { if (index < 3) { Blank() } - }, (item: string, index: number) => index + JSON.stringify(item)) } .height($r('app.float.indicator_name_height')) @@ -145,17 +169,19 @@ export struct TableAdaptiveExtensionIndex { .height(CommonConstants.EIGHTY_PERCENT) .width(this.breakPoint === CommonConstants.BREAK_POINT_LG ? CommonConstants.FIFTY_PERCENT : CommonConstants.FULL_WIDTH_PERCENT) - .justifyContent(FlexAlign.Start) - .padding({ - left: $r('app.float.stock_data_margin'), - right: $r('app.float.stock_data_margin') - }) } + .padding({ + left: new BreakpointType($r('sys.float.padding_level5'), $r('sys.float.padding_level7'), + $r('app.float.index_button_padding_md_lg')).getValue(this.breakPoint), + right: new BreakpointType($r('sys.float.padding_level5'), $r('sys.float.padding_level7'), + $r('app.float.index_button_padding_md_lg')).getValue(this.breakPoint) + }) .width(CommonConstants.FULL_WIDTH_PERCENT) } } + .hideTitleBar(true) .padding({ top: px2vp(this.topRectHeight) }) - .backgroundColor($r('sys.color.background_primary')) + .backgroundColor($r('sys.color.background_secondary')) .title(CommonConstants.TABLE_TITLE) } } \ 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 index 5f299aa..2026edc 100644 --- a/entry/src/main/resources/base/element/float.json +++ b/entry/src/main/resources/base/element/float.json @@ -22,7 +22,35 @@ }, { "name": "index_button_width_sm", - "value": "328vp" + "value": "16vp" + }, + { + "name": "index_button_padding_sm", + "value": "16vp" + }, + { + "name": "index_button_padding_md_lg", + "value": "0vp" + }, + { + "name": "bar_margin_top", + "value": "36vp" + }, + { + "name": "back_button_height", + "value": "40vp" + }, + { + "name": "bar_font_size", + "value": "20vp" + }, + { + "name": "bar_height", + "value": "56vp" + }, + { + "name": "index_button_width_md", + "value": "448vp" }, { "name": "index_button_width_lg", @@ -50,7 +78,7 @@ }, { "name": "font_size_16", - "value": "16fp" + "value": "15fp" }, { "name": "font_size_14", @@ -70,7 +98,11 @@ }, { "name": "text_height", - "value": "21vp" + "value": "36vp" + }, + { + "name": "text_width1", + "value": "70vp" }, { "name": "text_width", @@ -84,6 +116,10 @@ "name": "width_296", "value": "296vp" }, + { + "name": "width_312", + "value": "312vp" + }, { "name": "bottom_width_2", "value": "2vp" @@ -134,7 +170,7 @@ }, { "name": "recommendation_margin_top", - "value": "22vp" + "value": "20vp" }, { "name": "recommendation_margin_bottom", diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 159a8ea..6e8e788 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -31,6 +31,10 @@ { "name": "computer", "value": "Computer" + }, + { + "name": "fullwidth", + "value": "100%" } ] } \ 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 159a8ea..6e8e788 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -31,6 +31,10 @@ { "name": "computer", "value": "Computer" + }, + { + "name": "fullwidth", + "value": "100%" } ] } \ 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 78fd1d2..6be83dd 100644 --- a/entry/src/main/resources/zh_CN/element/string.json +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -31,6 +31,10 @@ { "name": "computer", "value": "计算机" + }, + { + "name": "fullwidth", + "value": "100%" } ] } \ No newline at end of file -- Gitee From 8fc186afa957267f9e9cadce8d7287d4d48caecd Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Sat, 22 Feb 2025 12:00:01 +0800 Subject: [PATCH 3/5] =?UTF-8?q?HMOSWorld=E6=95=B4=E6=94=B91:=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/constants/CommonConstants.ets | 4 ++-- .../main/ets/pages/AdaptiveTabCenteringIndex.ets | 13 ++++++++++--- .../ets/pages/DoubleTabAdaptiveCenteringIndex.ets | 12 ++++++------ .../main/ets/pages/TableAdaptiveExtensionIndex.ets | 12 +++++++----- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/entry/src/main/ets/constants/CommonConstants.ets b/entry/src/main/ets/constants/CommonConstants.ets index cb7069c..9335221 100644 --- a/entry/src/main/ets/constants/CommonConstants.ets +++ b/entry/src/main/ets/constants/CommonConstants.ets @@ -182,10 +182,10 @@ export class CommonConstants { /** * Table list padding md. */ - static readonly TABLE_LIST_PADDING_MD: number = 95; + static readonly TABLE_LIST_PADDING_MD: number = 90; /** * Table list padding lg. */ - static readonly TABLE_LIST_PADDING_LG: number = 175; + static readonly TABLE_LIST_PADDING_LG: number = 150; } \ No newline at end of file diff --git a/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets b/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets index 1d3a4ea..2323839 100644 --- a/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets +++ b/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets @@ -46,8 +46,10 @@ export struct AdaptiveTabCenteringIndex { .font({ size: $r('app.float.bar_font_size'), weight: CommonConstants.FONT_WEIGHT_700 }) .fontColor($r('sys.color.font_primary')) } - .margin({ + .padding({ left: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), + $r('sys.float.padding_level16')).getValue(this.breakPoint), + right: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), $r('sys.float.padding_level16')).getValue(this.breakPoint) }) .width(CommonConstants.FULL_WIDTH_PERCENT) @@ -55,7 +57,10 @@ export struct AdaptiveTabCenteringIndex { .zIndex(CommonConstants.NUMBER_TWO) Row() { - List({ space: CommonConstants.TAB_PADDING_SM }) { + List({ + space: new BreakpointType(CommonConstants.TAB_PADDING_SM, CommonConstants.TAB_PADDING_MD, + CommonConstants.TAB_PADDING_LG).getValue(this.breakPoint) + }) { ForEach(ListDataConstants.RECOMMENDATION_TAB_LIST, (item: string, index: number) => { ListItem() { Button(item) @@ -84,8 +89,10 @@ export struct AdaptiveTabCenteringIndex { .scrollBar(BarState.Off) .listDirection(Axis.Horizontal) } - .margin({ + .padding({ left: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), + $r('sys.float.padding_level16')).getValue(this.breakPoint), + right: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), $r('sys.float.padding_level16')).getValue(this.breakPoint) }) .backgroundColor($r('sys.color.background_secondary')) diff --git a/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets b/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets index 0d9aabe..8ff2637 100644 --- a/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets +++ b/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets @@ -47,8 +47,10 @@ export struct DoubleTabAdaptiveCenteringIndex { .font({ size: $r('app.float.bar_font_size'), weight: CommonConstants.FONT_WEIGHT_700 }) .fontColor($r('sys.color.font_primary')) } - .margin({ + .padding({ left: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), + $r('sys.float.padding_level16')).getValue(this.breakPoint), + right: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), $r('sys.float.padding_level16')).getValue(this.breakPoint) }) .width(CommonConstants.FULL_WIDTH_PERCENT) @@ -109,15 +111,13 @@ export struct DoubleTabAdaptiveCenteringIndex { SymbolGlyph($r('sys.symbol.line_3_horizontal')) .fontColor([$r('sys.color.icon_primary')]) .fontSize($r('sys.float.Title_M')) - .margin({ - right: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), - $r('sys.float.padding_level16')).getValue(this.breakPoint) - }) } .justifyContent(FlexAlign.Start) .backgroundColor($r('sys.color.background_secondary')) - .margin({ + .padding({ left: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), + $r('sys.float.padding_level16')).getValue(this.breakPoint), + right: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), $r('sys.float.padding_level16')).getValue(this.breakPoint) }) .height($r('app.float.height_56')) diff --git a/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets b/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets index 29627e9..df88f46 100644 --- a/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets +++ b/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets @@ -61,8 +61,10 @@ export struct TableAdaptiveExtensionIndex { .font({ size: $r('app.float.bar_font_size'), weight: CommonConstants.FONT_WEIGHT_700 }) .fontColor($r('sys.color.font_primary')) } - .margin({ + .padding({ left: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), + $r('sys.float.padding_level16')).getValue(this.breakPoint), + right: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), $r('sys.float.padding_level16')).getValue(this.breakPoint) }) .width(CommonConstants.FULL_WIDTH_PERCENT) @@ -171,10 +173,10 @@ export struct TableAdaptiveExtensionIndex { CommonConstants.FIFTY_PERCENT : CommonConstants.FULL_WIDTH_PERCENT) } .padding({ - left: new BreakpointType($r('sys.float.padding_level5'), $r('sys.float.padding_level7'), - $r('app.float.index_button_padding_md_lg')).getValue(this.breakPoint), - right: new BreakpointType($r('sys.float.padding_level5'), $r('sys.float.padding_level7'), - $r('app.float.index_button_padding_md_lg')).getValue(this.breakPoint) + left: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), + $r('sys.float.padding_level16')).getValue(this.breakPoint), + right: new BreakpointType($r('sys.float.padding_level8'), $r('sys.float.padding_level12'), + $r('sys.float.padding_level16')).getValue(this.breakPoint) }) .width(CommonConstants.FULL_WIDTH_PERCENT) } -- Gitee From 299147f4c7d584ad251eb8b357b56efa4e82f24c Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Mon, 24 Feb 2025 10:37:02 +0800 Subject: [PATCH 4/5] =?UTF-8?q?HMOSWorld=E6=95=B4=E6=94=B91:=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 --- build-profile.json5 | 16 +--------------- entry/src/main/ets/constants/CommonConstants.ets | 2 +- .../main/ets/pages/AdaptiveTabCenteringIndex.ets | 5 +---- entry/src/main/ets/pages/Index.ets | 2 +- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/build-profile.json5 b/build-profile.json5 index 1f17cb1..c033ce4 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -1,20 +1,6 @@ { "app": { - "signingConfigs": [ - { - "name": "default", - "type": "HarmonyOS", - "material": { - "certpath": "C:\\Users\\wpp\\.ohos\\config\\default_multi-ticket-class_5qKw0X0SO6oV-0rbjSYozcdFhCBMcog-D5x4MYCEFoI=.cer", - "storePassword": "0000001B89D3B02FD7FCE40B290788C11070ED482325472071C7FD3A1C7197D0B40C4BD9BB91AAD513CD47", - "keyAlias": "debugKey", - "keyPassword": "0000001BC482C482231A7727CC7EE301EE5F6F7DB3548807A3F9C7902457D0E108484101DBDD6C62A56E89", - "profile": "C:\\Users\\wpp\\.ohos\\config\\default_multi-ticket-class_5qKw0X0SO6oV-0rbjSYozcdFhCBMcog-D5x4MYCEFoI=.p7b", - "signAlg": "SHA256withECDSA", - "storeFile": "C:\\Users\\wpp\\.ohos\\config\\default_multi-ticket-class_5qKw0X0SO6oV-0rbjSYozcdFhCBMcog-D5x4MYCEFoI=.p12" - } - } - ], + "signingConfigs": [], "products": [ { "name": "default", diff --git a/entry/src/main/ets/constants/CommonConstants.ets b/entry/src/main/ets/constants/CommonConstants.ets index 9335221..62d29a1 100644 --- a/entry/src/main/ets/constants/CommonConstants.ets +++ b/entry/src/main/ets/constants/CommonConstants.ets @@ -143,7 +143,7 @@ export class CommonConstants { /** * Index page padding bottom size. */ - static readonly PADDING_BOTTOM_INDEX: number = 8; + static readonly PADDING_BOTTOM_INDEX: number = 16; /** * Gray font flag. */ diff --git a/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets b/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets index 2323839..cc15ccd 100644 --- a/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets +++ b/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets @@ -57,10 +57,7 @@ export struct AdaptiveTabCenteringIndex { .zIndex(CommonConstants.NUMBER_TWO) Row() { - List({ - space: new BreakpointType(CommonConstants.TAB_PADDING_SM, CommonConstants.TAB_PADDING_MD, - CommonConstants.TAB_PADDING_LG).getValue(this.breakPoint) - }) { + List({ space: CommonConstants.TAB_PADDING_SM }) { ForEach(ListDataConstants.RECOMMENDATION_TAB_LIST, (item: string, index: number) => { ListItem() { Button(item) diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 997e60f..0e2409d 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -126,7 +126,7 @@ struct Index { .justifyContent(FlexAlign.SpaceBetween) .padding({ top: CommonConstants.PADDING_TOP_INDEX + px2vp(this.topRectHeight), - bottom: px2vp(this.bottomRectHeight) + bottom: CommonConstants.PADDING_BOTTOM_INDEX + px2vp(this.bottomRectHeight) }) } .height(CommonConstants.FULL_WIDTH_PERCENT) -- Gitee From 1dc1990e676119a0b03f8fc025b138e94a44d59f Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Fri, 14 Mar 2025 11:21:29 +0800 Subject: [PATCH 5/5] DTS2025031327285 --- .../main/ets/constants/ListDataConstants.ets | 53 ++++---- .../ets/pages/AdaptiveTabCenteringIndex.ets | 4 +- .../pages/DoubleTabAdaptiveCenteringIndex.ets | 6 +- .../ets/pages/TableAdaptiveExtensionIndex.ets | 16 +-- .../main/resources/base/element/string.json | 124 ++++++++++++++++++ .../resources/base/element/stringarray.json | 107 --------------- .../main/resources/en_US/element/string.json | 124 ++++++++++++++++++ .../resources/en_US/element/stringarray.json | 107 --------------- .../main/resources/zh_CN/element/string.json | 124 ++++++++++++++++++ .../resources/zh_CN/element/stringarray.json | 107 --------------- 10 files changed, 409 insertions(+), 363 deletions(-) delete mode 100644 entry/src/main/resources/base/element/stringarray.json delete mode 100644 entry/src/main/resources/en_US/element/stringarray.json delete mode 100644 entry/src/main/resources/zh_CN/element/stringarray.json diff --git a/entry/src/main/ets/constants/ListDataConstants.ets b/entry/src/main/ets/constants/ListDataConstants.ets index 7f80f04..ba7e702 100644 --- a/entry/src/main/ets/constants/ListDataConstants.ets +++ b/entry/src/main/ets/constants/ListDataConstants.ets @@ -21,65 +21,60 @@ export class ListDataConstants { * Tab adaptive uri. */ static readonly TAB_ADAPTIVE_URI: string = 'AdaptiveTabCenteringIndex'; - /** * Table adaptive uri. */ static readonly TABLE_ADAPTIVE_URI: string = 'TableAdaptiveExtensionIndex'; - /** * Double tab adaptive uri. */ static readonly DOUBLE_TAB_ADAPTIVE_URI: string = 'DoubleTabAdaptiveCenteringIndex'; - /** * Recommendation tab list. */ - static readonly RECOMMENDATION_TAB_LIST: string[] = - getContext(this).resourceManager.getStringArrayValueSync($r('app.strarray.recommendation_tab_list').id); - + static readonly RECOMMENDATION_TAB_LIST: Resource[] = + [$r('app.string.recommendation'), $r('app.string.all_time'), $r('app.string.focus_news'), $r('app.string.calendar'), + $r('app.string.follow'), $r('app.string.share_a')]; /** * Stock options tab list 1. */ - static readonly STOCK_OPTIONS_LIST1: string[] = - getContext(this).resourceManager.getStringArrayValueSync($r('app.strarray.stock_options_list1').id); - + static readonly STOCK_OPTIONS_LIST1: Resource[] = + [$r('app.string.share_a'), $r('app.string.global'), $r('app.string.share_b'), $r('app.string.share_c'), + $r('app.string.e_mul_f'), $r('app.string.futures')]; /** * Stock options tab list 2. */ - static readonly STOCK_OPTIONS_LIST2: string[] = - getContext(this).resourceManager.getStringArrayValueSync($r('app.strarray.stock_options_list2').id); - + static readonly STOCK_OPTIONS_LIST2: Resource[] = + [$r('app.string.large_market'), $r('app.string.plate'), $r('app.string.chinext_board'), $r('app.string.science'), + $r('app.string.beijing_stock_exchange')]; /** * Indicator name list. */ - static readonly INDICATOR_NAME_LIST: string[] = - getContext(this).resourceManager.getStringArrayValueSync($r('app.strarray.indicator_name_list').id); - + static readonly INDICATOR_NAME_LIST: Resource[] = + [$r('app.string.indicator_name'), $r('app.string.x_changhong'), $r('app.string.x_technology'), + $r('app.string.x_satellite')]; /** * Indicator name column. */ - static readonly INDICATOR_NAME_COLUMN: string[] = - getContext(this).resourceManager.getStringArrayValueSync($r('app.strarray.indicator_name_column').id); - + static readonly INDICATOR_NAME_COLUMN: Resource[] = + [$r('app.string.core_indicators'), $r('app.string.industry_affiliation'), $r('app.string.latest_stock_price'), + $r('app.string.price_fluctuation_range'), $r('app.string.earning_ratio')]; /** * Stock index data 1. */ - static readonly STOCK_INDEX_DATA1: string[] = ['', - getContext(this).resourceManager.getStringSync($r('app.string.computer').id), - '19.86', '5.15%', '171.54']; - + static readonly STOCK_INDEX_DATA1: Resource[] = + [$r('app.string.blank'), $r('app.string.computer'), $r('app.string.price'), $r('app.string.range1'), + $r('app.string.earning1')]; /** * Stock index data 2. */ - static readonly STOCK_INDEX_DATA2: string[] = ['', - getContext(this).resourceManager.getStringSync($r('app.string.computer').id), - '19.86', '10.02%', '95.58']; - + static readonly STOCK_INDEX_DATA2: Resource[] = + [$r('app.string.blank'), $r('app.string.computer'), $r('app.string.price'), $r('app.string.range2'), + $r('app.string.earning2')]; /** * Stock index data 3. */ - static readonly STOCK_INDEX_DATA3: string[] = ['', - getContext(this).resourceManager.getStringSync($r('app.string.computer').id), - '19.86', '10.02%', '95.58']; + static readonly STOCK_INDEX_DATA3: Resource[] = + [$r('app.string.blank'), $r('app.string.computer'), $r('app.string.price'), $r('app.string.range2'), + $r('app.string.earning2')]; } \ No newline at end of file diff --git a/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets b/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets index cc15ccd..dd1235d 100644 --- a/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets +++ b/entry/src/main/ets/pages/AdaptiveTabCenteringIndex.ets @@ -41,7 +41,7 @@ export struct AdaptiveTabCenteringIndex { .backgroundColor($r('sys.color.comp_background_tertiary')) .onClick(() => this.pageInfos.pop()) - Text(CommonConstants.SINGLETAB_TITLE) + Text($r('app.string.table_adaptive')) .margin({ left: $r('sys.float.padding_level4') }) .font({ size: $r('app.float.bar_font_size'), weight: CommonConstants.FONT_WEIGHT_700 }) .fontColor($r('sys.color.font_primary')) @@ -58,7 +58,7 @@ export struct AdaptiveTabCenteringIndex { Row() { List({ space: CommonConstants.TAB_PADDING_SM }) { - ForEach(ListDataConstants.RECOMMENDATION_TAB_LIST, (item: string, index: number) => { + ForEach(ListDataConstants.RECOMMENDATION_TAB_LIST, (item: Resource, index: number) => { ListItem() { Button(item) .fontSize($r('app.float.font_size_16')) diff --git a/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets b/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets index 8ff2637..a7c8923 100644 --- a/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets +++ b/entry/src/main/ets/pages/DoubleTabAdaptiveCenteringIndex.ets @@ -42,7 +42,7 @@ export struct DoubleTabAdaptiveCenteringIndex { .backgroundColor($r('sys.color.comp_background_tertiary')) .onClick(() => this.pageInfos.pop()) - Text(CommonConstants.DOUBLETAB_TITLE) + Text($r('app.string.double_tab_adaptive')) .margin({ left: $r('sys.float.padding_level4') }) .font({ size: $r('app.float.bar_font_size'), weight: CommonConstants.FONT_WEIGHT_700 }) .fontColor($r('sys.color.font_primary')) @@ -64,7 +64,7 @@ export struct DoubleTabAdaptiveCenteringIndex { space: new BreakpointType(CommonConstants.TABLE_LIST_PADDING_SM, CommonConstants.TABLE_LIST_PADDING_MD, CommonConstants.TABLE_LIST_PADDING_LG).getValue(this.breakPoint) }) { - ForEach(ListDataConstants.STOCK_OPTIONS_LIST1, (item: string, index: number) => { + ForEach(ListDataConstants.STOCK_OPTIONS_LIST1, (item: Resource, index: number) => { ListItem() { Column() { Text(item) @@ -129,7 +129,7 @@ export struct DoubleTabAdaptiveCenteringIndex { space: new BreakpointType(CommonConstants.DOUBLE_TAB_PADDING_SM, CommonConstants.DOUBLE_TAB_PADDING_MD2, CommonConstants.DOUBLE_TAB_PADDING_LG2).getValue(this.breakPoint) }) { - ForEach(ListDataConstants.STOCK_OPTIONS_LIST2, (item: string, index: number) => { + ForEach(ListDataConstants.STOCK_OPTIONS_LIST2, (item: Resource, index: number) => { ListItem() { Column() { Text(item) diff --git a/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets b/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets index df88f46..c2e8be8 100644 --- a/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets +++ b/entry/src/main/ets/pages/TableAdaptiveExtensionIndex.ets @@ -28,7 +28,7 @@ export struct TableAdaptiveExtensionIndex { topRectHeight: number = 0; @Builder - Item(item: string, index: number, color: string) { + Item(item: Resource, index: number, color: string) { Row() { Text(item) .maxLines(1) @@ -56,7 +56,7 @@ export struct TableAdaptiveExtensionIndex { .backgroundColor($r('sys.color.comp_background_tertiary')) .onClick(() => this.pageInfos.pop()) - Text(CommonConstants.TABLE_TITLE) + Text($r('app.string.table_adaptive')) .margin({ left: $r('sys.float.padding_level4') }) .font({ size: $r('app.float.bar_font_size'), weight: CommonConstants.FONT_WEIGHT_700 }) .fontColor($r('sys.color.font_primary')) @@ -88,7 +88,7 @@ export struct TableAdaptiveExtensionIndex { Row() { Column() { Row() { - ForEach(ListDataConstants.INDICATOR_NAME_LIST, (item: string, index: number) => { + ForEach(ListDataConstants.INDICATOR_NAME_LIST, (item: Resource, index: number) => { Column() { Row() { Text(item) @@ -127,7 +127,7 @@ export struct TableAdaptiveExtensionIndex { Row() { Column() { - ForEach(ListDataConstants.INDICATOR_NAME_COLUMN, (item: string, index: number) => { + ForEach(ListDataConstants.INDICATOR_NAME_COLUMN, (item: Resource, index: number) => { this.Item(item, index, CommonConstants.GRAY_FONT_FLAG) }, (item: string, index: number) => index + JSON.stringify(item)) } @@ -136,9 +136,9 @@ export struct TableAdaptiveExtensionIndex { Blank() Column() { - ForEach(ListDataConstants.STOCK_INDEX_DATA1, (item: string, index: number) => { + ForEach(ListDataConstants.STOCK_INDEX_DATA1, (item: Resource, index: number) => { this.Item(item, index, CommonConstants.RED_FONT_FLAG) - }, (item: string, index: number) => index + JSON.stringify(item)) + }, (item: Resource, index: number) => index + JSON.stringify(item)) } .width($r('app.float.stock_data_width')) .alignItems(HorizontalAlign.End) @@ -146,7 +146,7 @@ export struct TableAdaptiveExtensionIndex { Blank() Column() { - ForEach(ListDataConstants.STOCK_INDEX_DATA2, (item: string, index: number) => { + ForEach(ListDataConstants.STOCK_INDEX_DATA2, (item: Resource, index: number) => { this.Item(item, index, CommonConstants.RED_FONT_FLAG) }, (item: string, index: number) => index + JSON.stringify(item)) } @@ -156,7 +156,7 @@ export struct TableAdaptiveExtensionIndex { Blank() Column() { - ForEach(ListDataConstants.STOCK_INDEX_DATA3, (item: string, index: number) => { + ForEach(ListDataConstants.STOCK_INDEX_DATA3, (item: Resource, index: number) => { this.Item(item, index, CommonConstants.RED_FONT_FLAG) }, (item: string, index: number) => index + JSON.stringify(item)) } diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 6e8e788..8e1bedc 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -35,6 +35,130 @@ { "name": "fullwidth", "value": "100%" + }, + { + "name": "recommendation", + "value": "Recommendation" + }, + { + "name": "all_time", + "value": "7X24" + }, + { + "name": "focus_news", + "value": "Focus News" + }, + { + "name": "calendar", + "value": "Calendar" + }, + { + "name": "follow", + "value": "Follow" + }, + { + "name": "global", + "value": "Global" + }, + { + "name": "share_b", + "value": "B-shares" + }, + { + "name": "share_c", + "value": "C-shares" + }, + { + "name": "share_a", + "value": "A-shares" + }, + { + "name": "e_mul_f", + "value": "E*F" + }, + { + "name": "futures", + "value": "Futures" + }, + { + "name": "large_market", + "value": "Large market" + }, + { + "name": "plate", + "value": "Plate" + }, + { + "name": "chinext_board", + "value": "ChiNext board" + }, + { + "name": "science", + "value": "Science and Technology Innovation Board" + }, + { + "name": "beijing_stock_exchange", + "value": "Beijing Stock Exchange" + }, + { + "name": "indicator_name", + "value": "Indicator Name" + }, + { + "name": "x_changhong", + "value": "XChangeHong" + }, + { + "name": "x_satellite", + "value": "XSatellite" + }, + { + "name": "x_technology", + "value": "XTechnology" + }, + { + "name": "core_indicators", + "value": "Core indicators" + }, + { + "name": "industry_affiliation", + "value": "Industry affiliation" + }, + { + "name": "latest_stock_price", + "value": "Latest stock price" + }, + { + "name": "price_fluctuation_range", + "value": "Price fluctuation range" + }, + { + "name": "earning_ratio", + "value": "Price to earnings ratio" + }, + { + "name": "blank", + "value": " " + }, + { + "name": "price", + "value": "19.86" + }, + { + "name": "range1", + "value": "5.15%" + }, + { + "name": "range2", + "value": "10.02%" + }, + { + "name": "earning1", + "value": "171.54" + }, + { + "name": "earning2", + "value": "95.58" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/base/element/stringarray.json b/entry/src/main/resources/base/element/stringarray.json deleted file mode 100644 index a7d2e0d..0000000 --- a/entry/src/main/resources/base/element/stringarray.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "strarray": [ - { - "name": "recommendation_tab_list", - "value": [ - { - "value": "Recommendation" - }, - { - "value": "7X24" - }, - { - "value": "Focus News" - }, - { - "value": "Calendar" - }, - { - "value": "Follow" - }, - { - "value": "A-shares" - } - ] - }, - { - "name": "stock_options_list1", - "value": [ - { - "value": "A-shares" - }, - { - "value": "Global" - }, - { - "value": "B-shares" - }, - { - "value": "C-shares" - }, - { - "value": "E*F" - }, - { - "value": "Futures" - } - ] - }, - { - "name": "stock_options_list2", - "value": [ - { - "value": "Large market" - }, - { - "value": "Plate" - }, - { - "value": "ChiNext board" - }, - { - "value": "Science and Technology Innovation Board" - }, - { - "value": "Beijing Stock Exchange" - } - ] - }, - { - "name": "indicator_name_list", - "value": [ - { - "value": "Indicator Name" - }, - { - "value": "XChanghong" - }, - { - "value": "XTechnology" - }, - { - "value": "XSatellite" - } - ] - }, - { - "name": "indicator_name_column", - "value": [ - { - "value": "Core indicators" - }, - { - "value": "Industry affiliation" - }, - { - "value": "Latest stock price" - }, - { - "value": "Price fluctuation range" - }, - { - "value": "Price to earnings ratio" - } - ] - } - ] -} \ 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 6e8e788..bbaa44d 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -35,6 +35,130 @@ { "name": "fullwidth", "value": "100%" + }, + { + "name": "recommendation", + "value": "Recommendation" + }, + { + "name": "all_time", + "value": "7X24" + }, + { + "name": "focus_news", + "value": "Focus News" + }, + { + "name": "calendar", + "value": "Calendar" + }, + { + "name": "follow", + "value": "Follow" + }, + { + "name": "global", + "value": "Global" + }, + { + "name": "share_b", + "value": "B-shares" + }, + { + "name": "share_c", + "value": "C-shares" + }, + { + "name": "share_a", + "value": "A-shares" + }, + { + "name": "e_mul_f", + "value": "E*F" + }, + { + "name": "futures", + "value": "Futures" + }, + { + "name": "large_market", + "value": "Large market" + }, + { + "name": "plate", + "value": "Plate" + }, + { + "name": "chinext_board", + "value": "ChiNext board" + }, + { + "name": "science", + "value": "Science and Technology Innovation Board" + }, + { + "name": "beijing_stock_exchange", + "value": "Beijing Stock Exchange" + }, + { + "name": "indicator_name", + "value": "Indicator Name" + }, + { + "name": "x_changhong", + "value": "XChangeHong" + }, + { + "name": "x_satellite", + "value": "XSatellite" + }, + { + "name": "x_technology", + "value": "XTechnology" + }, + { + "name": "core_indicators", + "value": "Core indicators" + }, + { + "name": "industry_affiliation", + "value": "Industry affiliation" + }, + { + "name": "latest_stock_price", + "value": "Latest stock price" + }, + { + "name": "price_fluctuation_range", + "value": "Price fluctuation range" + }, + { + "name": "earning_ratio", + "value": "Price to earnings ratio" + }, + { + "name": "blank", + "value": " " + }, + { + "name": "price", + "value": "19.86" + }, + { + "name": "range1", + "value": "5.15%" + }, + { + "name": "range2", + "value": "10.02%" + }, + { + "name": "earning1", + "value": "171.54" + }, + { + "name": "earning2", + "value": "95.58" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/en_US/element/stringarray.json b/entry/src/main/resources/en_US/element/stringarray.json deleted file mode 100644 index a7d2e0d..0000000 --- a/entry/src/main/resources/en_US/element/stringarray.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "strarray": [ - { - "name": "recommendation_tab_list", - "value": [ - { - "value": "Recommendation" - }, - { - "value": "7X24" - }, - { - "value": "Focus News" - }, - { - "value": "Calendar" - }, - { - "value": "Follow" - }, - { - "value": "A-shares" - } - ] - }, - { - "name": "stock_options_list1", - "value": [ - { - "value": "A-shares" - }, - { - "value": "Global" - }, - { - "value": "B-shares" - }, - { - "value": "C-shares" - }, - { - "value": "E*F" - }, - { - "value": "Futures" - } - ] - }, - { - "name": "stock_options_list2", - "value": [ - { - "value": "Large market" - }, - { - "value": "Plate" - }, - { - "value": "ChiNext board" - }, - { - "value": "Science and Technology Innovation Board" - }, - { - "value": "Beijing Stock Exchange" - } - ] - }, - { - "name": "indicator_name_list", - "value": [ - { - "value": "Indicator Name" - }, - { - "value": "XChanghong" - }, - { - "value": "XTechnology" - }, - { - "value": "XSatellite" - } - ] - }, - { - "name": "indicator_name_column", - "value": [ - { - "value": "Core indicators" - }, - { - "value": "Industry affiliation" - }, - { - "value": "Latest stock price" - }, - { - "value": "Price fluctuation range" - }, - { - "value": "Price to earnings ratio" - } - ] - } - ] -} \ 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 6be83dd..678fc63 100644 --- a/entry/src/main/resources/zh_CN/element/string.json +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -35,6 +35,130 @@ { "name": "fullwidth", "value": "100%" + }, + { + "name": "recommendation", + "value": "推荐" + }, + { + "name": "all_time", + "value": "7X24" + }, + { + "name": "focus_news", + "value": "要闻" + }, + { + "name": "calendar", + "value": "日历" + }, + { + "name": "follow", + "value": "关注" + }, + { + "name": "global", + "value": "全球" + }, + { + "name": "share_b", + "value": "B股" + }, + { + "name": "share_c", + "value": "C股" + }, + { + "name": "share_a", + "value": "A股" + }, + { + "name": "e_mul_f", + "value": "E*F" + }, + { + "name": "futures", + "value": "期货" + }, + { + "name": "large_market", + "value": "大盘" + }, + { + "name": "plate", + "value": "板块" + }, + { + "name": "chinext_board", + "value": "创业板" + }, + { + "name": "science", + "value": "科创版" + }, + { + "name": "beijing_stock_exchange", + "value": "北交所" + }, + { + "name": "indicator_name", + "value": "指标名称" + }, + { + "name": "x_changhong", + "value": "某某长虹" + }, + { + "name": "x_satellite", + "value": "某某卫星" + }, + { + "name": "x_technology", + "value": "某某科技" + }, + { + "name": "core_indicators", + "value": "核心指标" + }, + { + "name": "industry_affiliation", + "value": "所属行业" + }, + { + "name": "latest_stock_price", + "value": "最新股价(元)" + }, + { + "name": "price_fluctuation_range", + "value": "涨跌幅" + }, + { + "name": "earning_ratio", + "value": "市盈率(TTM)" + }, + { + "name": "blank", + "value": " " + }, + { + "name": "price", + "value": "19.86" + }, + { + "name": "range1", + "value": "5.15%" + }, + { + "name": "range2", + "value": "10.02%" + }, + { + "name": "earning1", + "value": "171.54" + }, + { + "name": "earning2", + "value": "95.58" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/zh_CN/element/stringarray.json b/entry/src/main/resources/zh_CN/element/stringarray.json deleted file mode 100644 index f88e325..0000000 --- a/entry/src/main/resources/zh_CN/element/stringarray.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "strarray": [ - { - "name": "recommendation_tab_list", - "value": [ - { - "value": "推荐" - }, - { - "value": "7X24" - }, - { - "value": "要闻" - }, - { - "value": "日历" - }, - { - "value": "关注" - }, - { - "value": "A股" - } - ] - }, - { - "name": "stock_options_list1", - "value": [ - { - "value": "A股" - }, - { - "value": "全球" - }, - { - "value": "B股" - }, - { - "value": "C股" - }, - { - "value": "E*F" - }, - { - "value": "期货" - } - ] - }, - { - "name": "stock_options_list2", - "value": [ - { - "value": "大盘" - }, - { - "value": "板块" - }, - { - "value": "创业板" - }, - { - "value": "科创板" - }, - { - "value": "北交所" - } - ] - }, - { - "name": "indicator_name_list", - "value": [ - { - "value": "指标名称" - }, - { - "value": "某某长虹" - }, - { - "value": "某某科技" - }, - { - "value": "某某卫星" - } - ] - }, - { - "name": "indicator_name_column", - "value": [ - { - "value": "核心指标" - }, - { - "value": "所属行业" - }, - { - "value": "最新股价(元)" - }, - { - "value": "涨跌幅" - }, - { - "value": "市盈率(TTM)" - } - ] - } - ] -} \ No newline at end of file -- Gitee