Skip to content

Commit 44755d2

Browse files
author
chunle.wei
committed
新增: 第一次提交,"HelloWorld".
0 parents  commit 44755d2

35 files changed

+532
-0
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/node_modules
2+
/oh_modules
3+
/local.properties
4+
/.idea
5+
**/build
6+
/.hvigor
7+
.cxx
8+
/.clangd
9+
/.clang-format
10+
/.clang-tidy
11+
**/.test
12+
/.appanalyzer

AppScope/app.json5

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"app": {
3+
"bundleName": "com.wcl.harmonyos_demo",
4+
"vendor": "example",
5+
"versionCode": 1000000,
6+
"versionName": "1.0.0",
7+
"icon": "$media:app_icon",
8+
"label": "$string:app_name"
9+
}
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"string": [
3+
{
4+
"name": "app_name",
5+
"value": "HarmonyOS_Demo"
6+
}
7+
]
8+
}
2.71 KB
Loading

build-profile.json5

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"app": {
3+
"signingConfigs": [
4+
{
5+
"name": "default",
6+
"type": "HarmonyOS",
7+
"material": {
8+
"certpath": "C:\\Users\\Timanetworks\\.ohos\\config\\default_HarmonyOS_Demo_as_LL83CyVVkLyjla42XTRBDVRsqd24Fjy16xX_xTv8=.cer",
9+
"storePassword": "0000001A5B79C8AA127A4C57724901DB5421FC31BF851F48AA713EB5BF434182AF5E81D1A2092C1B7721",
10+
"keyAlias": "debugKey",
11+
"keyPassword": "0000001AED0761A4471A43391F3B81B2EEB4D514F4D983FC87E14B81DB2683B63E2ED36258ABC9FEBFD7",
12+
"profile": "C:\\Users\\Timanetworks\\.ohos\\config\\default_HarmonyOS_Demo_as_LL83CyVVkLyjla42XTRBDVRsqd24Fjy16xX_xTv8=.p7b",
13+
"signAlg": "SHA256withECDSA",
14+
"storeFile": "C:\\Users\\Timanetworks\\.ohos\\config\\default_HarmonyOS_Demo_as_LL83CyVVkLyjla42XTRBDVRsqd24Fjy16xX_xTv8=.p12"
15+
}
16+
}
17+
],
18+
"products": [
19+
{
20+
"name": "default",
21+
"signingConfig": "default",
22+
"compatibleSdkVersion": "5.0.0(12)",
23+
"runtimeOS": "HarmonyOS",
24+
"buildOption": {
25+
"strictMode": {
26+
"caseSensitiveCheck": true,
27+
"useNormalizedOHMUrl": true
28+
}
29+
}
30+
}
31+
],
32+
"buildModeSet": [
33+
{
34+
"name": "debug",
35+
},
36+
{
37+
"name": "release"
38+
}
39+
]
40+
},
41+
"modules": [
42+
{
43+
"name": "entry",
44+
"srcPath": "./entry",
45+
"targets": [
46+
{
47+
"name": "default",
48+
"applyToProducts": [
49+
"default"
50+
]
51+
}
52+
]
53+
}
54+
]
55+
}

code-linter.json5

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"files": [
3+
"**/*.ets"
4+
],
5+
"ignore": [
6+
"**/src/ohosTest/**/*",
7+
"**/src/test/**/*",
8+
"**/src/mock/**/*",
9+
"**/node_modules/**/*",
10+
"**/oh_modules/**/*",
11+
"**/build/**/*",
12+
"**/.preview/**/*"
13+
],
14+
"ruleSet": [
15+
"plugin:@performance/recommended",
16+
"plugin:@typescript-eslint/recommended"
17+
],
18+
"rules": {
19+
}
20+
}

entry/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/node_modules
2+
/oh_modules
3+
/.preview
4+
/build
5+
/.cxx
6+
/.test

entry/build-profile.json5

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"apiType": "stageMode",
3+
"buildOption": {
4+
},
5+
"buildOptionSet": [
6+
{
7+
"name": "release",
8+
"arkOptions": {
9+
"obfuscation": {
10+
"ruleOptions": {
11+
"enable": false,
12+
"files": [
13+
"./obfuscation-rules.txt"
14+
]
15+
}
16+
}
17+
}
18+
},
19+
],
20+
"targets": [
21+
{
22+
"name": "default"
23+
},
24+
{
25+
"name": "ohosTest",
26+
}
27+
]
28+
}

entry/hvigorfile.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
2+
3+
export default {
4+
system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
5+
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
6+
}

entry/obfuscation-rules.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Define project specific obfuscation rules here.
2+
# You can include the obfuscation configuration files in the current module's build-profile.json5.
3+
#
4+
# For more details, see
5+
# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
6+
7+
# Obfuscation options:
8+
# -disable-obfuscation: disable all obfuscations
9+
# -enable-property-obfuscation: obfuscate the property names
10+
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
11+
# -compact: remove unnecessary blank spaces and all line feeds
12+
# -remove-log: remove all console.* statements
13+
# -print-namecache: print the name cache that contains the mapping from the old names to new names
14+
# -apply-namecache: reuse the given cache file
15+
16+
# Keep options:
17+
# -keep-property-name: specifies property names that you want to keep
18+
# -keep-global-name: specifies names that you want to keep in the global scope
19+
20+
-enable-property-obfuscation
21+
-enable-toplevel-obfuscation
22+
-enable-filename-obfuscation
23+
-enable-export-obfuscation

entry/oh-package.json5

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "entry",
3+
"version": "1.0.0",
4+
"description": "Please describe the basic information.",
5+
"main": "",
6+
"author": "",
7+
"license": "",
8+
"dependencies": {}
9+
}
10+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
2+
import { hilog } from '@kit.PerformanceAnalysisKit';
3+
import { window } from '@kit.ArkUI';
4+
5+
export default class EntryAbility extends UIAbility {
6+
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
7+
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
8+
}
9+
10+
onDestroy(): void {
11+
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
12+
}
13+
14+
onWindowStageCreate(windowStage: window.WindowStage): void {
15+
// Main window is created, set main page for this ability
16+
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
17+
18+
windowStage.loadContent('pages/Index', (err) => {
19+
if (err.code) {
20+
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
21+
return;
22+
}
23+
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
24+
});
25+
}
26+
27+
onWindowStageDestroy(): void {
28+
// Main window is destroyed, release UI related resources
29+
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
30+
}
31+
32+
onForeground(): void {
33+
// Ability has brought to foreground
34+
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
35+
}
36+
37+
onBackground(): void {
38+
// Ability has back to background
39+
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
40+
}
41+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { hilog } from '@kit.PerformanceAnalysisKit';
2+
import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
3+
4+
export default class EntryBackupAbility extends BackupExtensionAbility {
5+
async onBackup() {
6+
hilog.info(0x0000, 'testTag', 'onBackup ok');
7+
}
8+
9+
async onRestore(bundleVersion: BundleVersion) {
10+
hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
11+
}
12+
}

entry/src/main/ets/pages/Index.ets

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@Entry
2+
@Component
3+
struct Index {
4+
@State message: string = 'Hello World';
5+
6+
build() {
7+
RelativeContainer() {
8+
Text(this.message)
9+
.id('HelloWorld')
10+
.fontSize(50)
11+
.fontWeight(FontWeight.Bold)
12+
.alignRules({
13+
center: { anchor: '__container__', align: VerticalAlign.Center },
14+
middle: { anchor: '__container__', align: HorizontalAlign.Center }
15+
})
16+
}
17+
.height('100%')
18+
.width('100%')
19+
}
20+
}

entry/src/main/module.json5

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"module": {
3+
"name": "entry",
4+
"type": "entry",
5+
"description": "$string:module_desc",
6+
"mainElement": "EntryAbility",
7+
"deviceTypes": [
8+
"phone",
9+
"tablet",
10+
"2in1"
11+
],
12+
"deliveryWithInstall": true,
13+
"installationFree": false,
14+
"pages": "$profile:main_pages",
15+
"abilities": [
16+
{
17+
"name": "EntryAbility",
18+
"srcEntry": "./ets/entryability/EntryAbility.ets",
19+
"description": "$string:EntryAbility_desc",
20+
"icon": "$media:layered_image",
21+
"label": "$string:EntryAbility_label",
22+
"startWindowIcon": "$media:startIcon",
23+
"startWindowBackground": "$color:start_window_background",
24+
"exported": true,
25+
"skills": [
26+
{
27+
"entities": [
28+
"entity.system.home"
29+
],
30+
"actions": [
31+
"action.system.home"
32+
]
33+
}
34+
]
35+
}
36+
],
37+
"extensionAbilities": [
38+
{
39+
"name": "EntryBackupAbility",
40+
"srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
41+
"type": "backup",
42+
"exported": false,
43+
"metadata": [
44+
{
45+
"name": "ohos.extension.backup",
46+
"resource": "$profile:backup_config"
47+
}
48+
],
49+
}
50+
]
51+
}
52+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"color": [
3+
{
4+
"name": "start_window_background",
5+
"value": "#FFFFFF"
6+
}
7+
]
8+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"string": [
3+
{
4+
"name": "module_desc",
5+
"value": "module description"
6+
},
7+
{
8+
"name": "EntryAbility_desc",
9+
"value": "description"
10+
},
11+
{
12+
"name": "EntryAbility_label",
13+
"value": "label"
14+
}
15+
]
16+
}
Loading
Loading
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"layered-image":
3+
{
4+
"background" : "$media:background",
5+
"foreground" : "$media:foreground"
6+
}
7+
}
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"allowToBackupRestore": true
3+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"src": [
3+
"pages/Index"
4+
]
5+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"string": [
3+
{
4+
"name": "module_desc",
5+
"value": "module description"
6+
},
7+
{
8+
"name": "EntryAbility_desc",
9+
"value": "description"
10+
},
11+
{
12+
"name": "EntryAbility_label",
13+
"value": "label"
14+
}
15+
]
16+
}

0 commit comments

Comments
 (0)