diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 4e6abb5742c56d83ab9de969f14701598d2390c7..d899a932e18724401219b91ccd6a9d77c3e9189b 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -23,18 +23,22 @@ export default class EntryAbility extends UIAbility { 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); + try { + 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); + } + } catch (error) { + hilog.error(0X0000, 'testTag', 'updateBreakpoint catch err:', JSON.stringify(error) ?? ''); } } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 15da35a2871c680f4fb3656fc276d8c8c517579a..f5a4d05b7d5c3eaa17275d1c0af1150ab7aa518b 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -15,6 +15,7 @@ import { common } from '@kit.AbilityKit'; import { display } from '@kit.ArkUI'; +import { hilog } from '@kit.PerformanceAnalysisKit'; import { DataSource, PhotoData } from '../util/DataSource'; import { BreakpointType, CommonConstants } from '../common//CommonConstants'; @@ -38,24 +39,28 @@ struct Index { scroller: Scroller = new Scroller(); aboutToAppear(): void { - this.isFoldable = display.isFoldable(); - let foldStatus: display.FoldStatus = display.getFoldStatus(); - if (this.isFoldable) { - this.foldStatus = foldStatus; - let callback: Callback = () => { - let data: display.FoldStatus = display.getFoldStatus(); - this.foldStatus = data; + try { + this.isFoldable = display.isFoldable(); + let foldStatus: display.FoldStatus = display.getFoldStatus(); + if (this.isFoldable) { + this.foldStatus = foldStatus; + let callback: Callback = () => { + let data: display.FoldStatus = display.getFoldStatus(); + this.foldStatus = data; + } + display.on('change', callback); } - display.on('change', callback); - } - let list: PhotoData[] = []; - for (let i = 1; i <= 4; i++) { - let newPhotoData = new PhotoData(); - newPhotoData.id = i; - list.push(newPhotoData); + let list: PhotoData[] = []; + for (let i = 1; i <= 4; i++) { + let newPhotoData = new PhotoData(); + newPhotoData.id = i; + list.push(newPhotoData); + } + this.progressData = list; + this.data = new DataSource(list); + } catch (error) { + hilog.error(0X0000, 'Display catch err:', JSON.stringify(error) ?? ''); } - this.progressData = list; - this.data = new DataSource(list); } @Builder diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index a1cea8b6a4560cee7bda7a2db52f310c035ab6c8..925e3ef4a987f3be348992c63eaa4348e19471b8 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -21,7 +21,7 @@ "label": "$string:EntryAbility_label", "startWindowIcon": "$media:startIcon", "startWindowBackground": "$color:start_window_background", - "exported": true, + "exported": false, "skills": [ { "entities": [ diff --git a/entry/src/main/resources/base/element/float.json b/entry/src/main/resources/base/element/float.json index 9e5865214ae9241ba0e824df650227509e216279..64dcf82b4990ada7aa66b5612a24368c47c3f873 100644 --- a/entry/src/main/resources/base/element/float.json +++ b/entry/src/main/resources/base/element/float.json @@ -12,10 +12,6 @@ "name": "image_width", "value": "40vp" }, - { - "name": "image_margin_top", - "value": "72vp" - }, { "name": "image_height", "value": "40vp" @@ -24,54 +20,14 @@ "name": "image_borderRadius", "value": "40vp" }, - { - "name": "image_width_inside", - "value": "29vp" - }, - { - "name": "image_height_inside", - "value": "25vp" - }, { "name": "column_image_margin_top", "value": "80vp" }, - { - "name": "row_image_height", - "value": "56vp" - }, - { - "name": "padding_left", - "value": "16vp" - }, - { - "name": "column_padding_left", - "value": "12vp" - }, - { - "name": "column_padding_right", - "value": "12vp" - }, - { - "name": "padding_right", - "value": "16vp" - }, - { - "name": "padding_bottom", - "value": "32vp" - }, { "name": "text_font_size", "value": "12vp" }, - { - "name": "column_width", - "value": "60vp" - }, - { - "name": "column_height", - "value": "52vp" - }, { "name": "text_margin_left", "value": "6vp" @@ -87,14 +43,6 @@ { "name": "description_column_height", "value": "200vp" - }, - { - "name": "stack_height", - "value": "640vp" - }, - { - "name": "stack_margin_top", - "value": "120vp" } ] } \ No newline at end of file