From 4bbb8dc7f9def1c6d21c361367415f32faaa3e86 Mon Sep 17 00:00:00 2001 From: skrobagleb Date: Fri, 19 Apr 2024 11:46:39 +0300 Subject: [PATCH] [HOS-2424] adapt to API changes --- .../entry/src/main/ets/entryability/EntryAbility.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/theme/GlobalThemeDemo/entry/src/main/ets/entryability/EntryAbility.ts b/theme/GlobalThemeDemo/entry/src/main/ets/entryability/EntryAbility.ts index d6f584f..8cb37bf 100644 --- a/theme/GlobalThemeDemo/entry/src/main/ets/entryability/EntryAbility.ts +++ b/theme/GlobalThemeDemo/entry/src/main/ets/entryability/EntryAbility.ts @@ -3,15 +3,16 @@ import hilog from '@ohos.hilog'; import UIAbility from '@ohos.app.ability.UIAbility'; import Want from '@ohos.app.ability.Want'; import window from '@ohos.window'; +import { CustomColors, ThemeControl } from '@ohos.arkui.theme' -import { CustomColors } from '@ohos.arkui.styles' class RedColors implements CustomColors { fontEmphasize = 0xFFD53032 iconEmphasize = 0xFFD53032 backgroundEmphasize = 0xFFD53032 } const abilityThemeColors = new RedColors(); -ThemeControl.setDefaultTheme({colors: abilityThemeColors}) +// the invoking here does not have effect +// ThemeControl.setDefaultTheme({ colors: abilityThemeColors }) export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { @@ -32,6 +33,9 @@ export default class EntryAbility extends UIAbility { return; } hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + // invoking here works good + ThemeControl.setDefaultTheme({ colors: abilityThemeColors }) + hilog.info(0x0000, 'testTag', '%{public}s', 'ThemeControl.setDefaultTheme done'); }); } -- Gitee