diff --git a/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/Index.ets b/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..42bf4161c271e1b14d42a7ab98c982acc9bc3592 --- /dev/null +++ b/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/Index.ets @@ -0,0 +1 @@ +export { MainPage } from './src/main/ets/components/MainPage'; diff --git a/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/oh-package.json5 b/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/oh-package.json5 index de407df43cdaeeead41800e98795135dd36c4a6e..2e1631d47eca3664dccfcfa0befe27432d9e5c45 100644 --- a/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/oh-package.json5 +++ b/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/oh-package.json5 @@ -2,7 +2,7 @@ "name": "customreusablepool", "version": "1.0.0", "description": "Please describe the basic information.", - "main": "Index.ets", + "main": "", "author": "", "license": "Apache-2.0", "packageType": "InterfaceHar", diff --git a/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/components/MainPage.ets b/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/components/MainPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e526db6c2ad130e8f362d893bf6df6f35bc0913 --- /dev/null +++ b/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/components/MainPage.ets @@ -0,0 +1,18 @@ +@Component +export struct MainPage { + @State message: string = 'Hello World'; + + build() { + Row() { + Column() { + Text(this.message) + .fontWeight(FontWeight.Bold) + .onClick(() => { + this.message = 'Welcome'; + }) + } + .width('100%') + } + .height('100%') + } +} diff --git a/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/entryability/EntryAbility.ets b/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c0cad413628198049a3a231e52ea40f6fa21048 --- /dev/null +++ b/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,44 @@ +import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { window } from '@kit.ArkUI'; + +const DOMAIN = 0x0000; + +export default class PrivacyAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err) => { + if (err.code) { + hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); + return; + } + hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.'); + }); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground'); + } +} \ No newline at end of file diff --git a/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/view/SecureRandom.ets b/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/view/SecureRandom.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c65942cb9ce31a3509e85b1ca417590955b7f34 --- /dev/null +++ b/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/view/SecureRandom.ets @@ -0,0 +1,11 @@ + + +export class SecureRandom { + int: number = 0 + constructor() { + this.int = 1 + } + nextInt(int: number): number { + return int + 1 + } +} \ No newline at end of file diff --git a/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/view/TabNode.ets b/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/view/TabNode.ets index bb9a2576c489a877619d94e1572aec87209b0ad2..7328979f5f082b170b0e64b98252ce203bee8909 100644 --- a/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/view/TabNode.ets +++ b/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/view/TabNode.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +import { SecureRandom } from '../view/SecureRandom' import { flowItemBuilder, FlowItemNode } from './FlowItemNode'; import { ViewItem } from '../data/ViewItem'; import { WaterFlowDataSource } from '../data/WaterFlowDataSource'; diff --git a/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/resources/base/element/string.json b/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/resources/base/element/string.json index c161518b082c5576becc6d05390c7e95a23fac36..c1422ec6078afddb9ca80ac46e75c0fc052d8113 100644 --- a/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/resources/base/element/string.json +++ b/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/resources/base/element/string.json @@ -15,6 +15,9 @@ },{ "name": "customreusablepool_water_flow_background_color", "value": "#FAEEE0" + },{ + "name": "shared_desc", + "value": "ff" } ] } \ No newline at end of file diff --git a/GlobalCustomComponentReuse/ComponentPrebuild/entry/src/main/module.json5 b/GlobalCustomComponentReuse/ComponentPrebuild/entry/src/main/module.json5 index c076329cdd9da2a0a1d33d1384304d823c48ce20..b3fc1a846de2c28688269074594136a2ce2a684d 100644 --- a/GlobalCustomComponentReuse/ComponentPrebuild/entry/src/main/module.json5 +++ b/GlobalCustomComponentReuse/ComponentPrebuild/entry/src/main/module.json5 @@ -37,7 +37,7 @@ "extensionAbilities": [ { "name": "EntryBackupAbility", - "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets", + "srcEntry": "./ets/entryability/EntryAbility.ets", "type": "backup", "exported": false, "metadata": [