diff --git a/entry/src/main/ets/common/components/CellComponent.ets b/entry/src/main/ets/common/components/CellComponent.ets index c060928c654eb2e1c7818847186d7ead01b08946..3eda1e13f43313cd8c69c01bd456f5eefbef03cb 100644 --- a/entry/src/main/ets/common/components/CellComponent.ets +++ b/entry/src/main/ets/common/components/CellComponent.ets @@ -13,6 +13,7 @@ * limitations under the License. */ +import Logger from '../../utils/Logger'; import { PageConstants } from '../constants/PageConstant'; @Component @@ -22,8 +23,11 @@ export struct Cell { isLink: boolean = false; isLast: boolean = false; hasMore: boolean = false; - click: () => void = () => { - }; + click: () => void = () => {}; + + aboutToAppear(): void { + Logger.info(`Cell aboutToAppear`); + } build() { Column() { diff --git a/entry/src/main/ets/common/components/CellGroupComponent.ets b/entry/src/main/ets/common/components/CellGroupComponent.ets index 9088554280a4bf10ab11dacc799eee079aba31b5..7bc1b1bce917595b5d9213f79530722125cc5c1e 100644 --- a/entry/src/main/ets/common/components/CellGroupComponent.ets +++ b/entry/src/main/ets/common/components/CellGroupComponent.ets @@ -13,6 +13,7 @@ * limitations under the License. */ +import Logger from '../../utils/Logger'; import { PageConstants } from '../constants/PageConstant'; @Component @@ -20,6 +21,10 @@ export struct CellGroup { title?: ResourceStr; @BuilderParam closer: () => void; + aboutToAppear(): void { + Logger.info(`CellGroup aboutToAppear`); + } + build() { Column() { if (this.title) { diff --git a/entry/src/main/ets/common/components/LayoutContainer.ets b/entry/src/main/ets/common/components/LayoutContainer.ets index a32215bbff5e008ccd237bcef65f5732a5ca437c..1c690a9c4e804721ef58193ee660cad00abab52e 100644 --- a/entry/src/main/ets/common/components/LayoutContainer.ets +++ b/entry/src/main/ets/common/components/LayoutContainer.ets @@ -13,6 +13,7 @@ * limitations under the License. */ +import Logger from '../../utils/Logger'; import { PageConstants } from '../constants/PageConstant'; import { BaseContainerStyles } from '../styles/BaseContentStyles'; import { NavBar } from './NavBar'; @@ -22,6 +23,10 @@ export struct LayoutContainer { @Prop @Require title: ResourceStr; @BuilderParam child: () => void; + aboutToAppear(): void { + Logger.info(`LayoutContainer aboutToAppear`); + } + build() { Column() { NavBar({ title: this.title }); diff --git a/entry/src/main/ets/common/components/NavBar.ets b/entry/src/main/ets/common/components/NavBar.ets index 32a55cd7e1b2fb745696c40cc08934566a4cd832..d8623643fdcfe39ef06074b864eb223deaf210c8 100644 --- a/entry/src/main/ets/common/components/NavBar.ets +++ b/entry/src/main/ets/common/components/NavBar.ets @@ -14,6 +14,7 @@ */ import { HMRouterMgr } from '@hadss/hmrouter'; +import Logger from '../../utils/Logger'; import { PageConstants } from '../constants/PageConstant'; @Component @@ -22,6 +23,10 @@ export struct NavBar { private hideBackBtn: boolean = false; private backFunction?: () => void; + aboutToAppear(): void { + Logger.info(`NavBar aboutToAppear`); + } + build() { Row() { if (!this.hideBackBtn) { diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index b173c59c5da618a60e5629c4748fb5e033ee5936..29a356afbebeda540444c9482f3da062453df2dc 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -27,7 +27,6 @@ export default class EntryAbility extends UIAbility { HMRouterMgr.init({ context: this.context }); - this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); } catch (err) { hilog.error(DOMAIN, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err)); } diff --git a/entry/src/main/ets/pages/BigJsonFileDecodePage.ets b/entry/src/main/ets/pages/BigJsonFileDecodePage.ets index 1ed3607b00df1835def4743d8d166ea1c2be5a17..fe1c8a7175a6bda457c8fbba9f7060175659adc4 100644 --- a/entry/src/main/ets/pages/BigJsonFileDecodePage.ets +++ b/entry/src/main/ets/pages/BigJsonFileDecodePage.ets @@ -98,6 +98,10 @@ export default struct BigJsonFileDecodePage { @State previewText: ResourceStr = $r('app.string.wait_load_file'); // File text preview @State logContent: ResourceStr = $r('app.string.show_load_content'); // Partial parsing result + aboutToAppear(): void { + Logger.info(`BigJsonFileDecodePage aboutToAppear`); + } + // Add method to extract preview text private extractPreviewText(): void { if (!this.json || this.json.byteLength === 0) { @@ -154,7 +158,7 @@ export default struct BigJsonFileDecodePage { } this.isParsing = true; - this.result = $r('app.string.file_analyze_ing'); + let result: ResourceStr = $r('app.string.file_analyze_ing'); try { if (!this.context) { @@ -165,7 +169,7 @@ export default struct BigJsonFileDecodePage { new taskpool.Task(analyzerBigFile, this.json.buffer, sendableContextManager.convertFromContext(this.context)); const analyzerResult = await taskpool.execute(task) as BigJsonFileDecodingResult; - this.result = analyzerResult.resultContent; + result = analyzerResult.resultContent; this.duration = analyzerResult.milliTimeCost; this.success = analyzerResult.isSuccess; this.logContent = analyzerResult.logContent; @@ -175,13 +179,14 @@ export default struct BigJsonFileDecodePage { }); } catch (e) { this.success = false; - this.result = $r('app.string.file_analyze_fail', e.message); + result = $r('app.string.file_analyze_fail', e.message); this.logContent = $r('app.string.file_analyze_fail', e.message); this.promptAction.showToast({ message: $r('app.string.file_analyze_fail_toast') }); } finally { this.isParsing = false; + this.result = result; } } @@ -199,7 +204,7 @@ export default struct BigJsonFileDecodePage { Span(' | ') .fontColor($r('app.color.text_secondary')); } - }); + }, (item: string) => item); } .width(PageConstants.FULL_WIDTH) .wordBreak(WordBreak.BREAK_ALL) diff --git a/entry/src/main/ets/pages/LazyLoadJsonNodePage.ets b/entry/src/main/ets/pages/LazyLoadJsonNodePage.ets index 4cedbf5a20d07bfabc5d5bb69dcd5bf0db2aab57..15dc3f90d5eae56e888277a9a33d338734d8b9fc 100644 --- a/entry/src/main/ets/pages/LazyLoadJsonNodePage.ets +++ b/entry/src/main/ets/pages/LazyLoadJsonNodePage.ets @@ -79,7 +79,7 @@ export default struct LazyLoadJsonNodePage { Span(' | ') .fontColor($r('app.color.text_secondary')); } - }); + }, (option: JsonTypeOption) => option.label); } .width(PageConstants.FULL_WIDTH) .wordBreak(WordBreak.BREAK_ALL) diff --git a/entry/src/main/ets/pages/MainPage.ets b/entry/src/main/ets/pages/MainPage.ets index 10a90d1e615edac0541e12109547095ad9d3b317..b7756242b787226972fa6da68981fd1ba819bf2f 100644 --- a/entry/src/main/ets/pages/MainPage.ets +++ b/entry/src/main/ets/pages/MainPage.ets @@ -17,6 +17,7 @@ import { HMRouter, HMRouterMgr } from '@hadss/hmrouter'; import { BaseContainerStyles, Cell, CellGroup, MainPageListItem } from '../common'; import { PageRouteConstants } from '../common/constants/PageRouteConstants'; import { MenuConstants } from '../common/constants/MenuConstants'; +import Logger from '../utils/Logger'; @HMRouter({ pageUrl: PageRouteConstants.MAIN_PAGE }) @@ -24,6 +25,10 @@ import { MenuConstants } from '../common/constants/MenuConstants'; export default struct MainPage { private highLevelUsePageList: MainPageListItem[] = MenuConstants.HIGH_LEVEL_USE_PAGE_LIST; + aboutToAppear(): void { + Logger.info(`MainPage aboutToAppear`); + } + build() { Column() { Text($r('app.string.main_title')) diff --git a/entry/src/main/ets/pages/WithSendablePage.ets b/entry/src/main/ets/pages/WithSendablePage.ets index 7edca9a2cb34ff8dee3d2a49a0f1c7f184c22099..0d8f3af583e0e28088a9a615b7cf4b4647f5bcd7 100644 --- a/entry/src/main/ets/pages/WithSendablePage.ets +++ b/entry/src/main/ets/pages/WithSendablePage.ets @@ -21,6 +21,7 @@ import type { ITSerializable } from '@hadss/turbo-trans-json'; import { ButtonStyles, CardContainer, CardType, CodeExample, LayoutContainer } from '../common'; import { PageRouteConstants } from '../common/constants/PageRouteConstants'; import { PersonWithSendable } from '../model/PersonWithSendable'; +import Logger from '../utils/Logger'; // [Start definedChildTask] // The buf parameter is only used to demonstrate TJSON's serialization and deserialization capabilities for ArrayBuffer type @@ -38,6 +39,10 @@ export default struct WithSendablePage { @State person: PersonWithSendable | null = null; @State personStr: string = ''; + aboutToAppear(): void { + Logger.info(`WithSendablePage aboutToAppear`); + } + async execSerialize(): Promise { // [Start execChildTaskWithSendable] const scores = TJSON.toBuffer([10, 20, 30], { classKey: 'Array', genericTypes: ['number']});