初版,确立了鸿蒙版程序的基本框架。
这个提交包含在:
6
entry/.gitignore
vendored
普通文件
6
entry/.gitignore
vendored
普通文件
@ -0,0 +1,6 @@
|
||||
/node_modules
|
||||
/oh_modules
|
||||
/.preview
|
||||
/build
|
||||
/.cxx
|
||||
/.test
|
||||
44
entry/build-profile.json5
普通文件
44
entry/build-profile.json5
普通文件
@ -0,0 +1,44 @@
|
||||
{
|
||||
"apiType": "stageMode",
|
||||
"buildOption": {
|
||||
"resOptions": {
|
||||
"copyCodeResource": {
|
||||
"enable": false
|
||||
}
|
||||
},
|
||||
"externalNativeOptions": {
|
||||
"path": "./src/main/cpp/CMakeLists.txt",
|
||||
"arguments": "",
|
||||
"cppFlags": "",
|
||||
}
|
||||
},
|
||||
"buildOptionSet": [
|
||||
{
|
||||
"name": "release",
|
||||
"arkOptions": {
|
||||
"obfuscation": {
|
||||
"ruleOptions": {
|
||||
"enable": false,
|
||||
"files": [
|
||||
"./obfuscation-rules.txt"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"nativeLib": {
|
||||
"debugSymbol": {
|
||||
"strip": true,
|
||||
"exclude": []
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
"targets": [
|
||||
{
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"name": "ohosTest",
|
||||
}
|
||||
]
|
||||
}
|
||||
6
entry/hvigorfile.ts
普通文件
6
entry/hvigorfile.ts
普通文件
@ -0,0 +1,6 @@
|
||||
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
|
||||
|
||||
export default {
|
||||
system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
|
||||
plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
|
||||
}
|
||||
23
entry/obfuscation-rules.txt
普通文件
23
entry/obfuscation-rules.txt
普通文件
@ -0,0 +1,23 @@
|
||||
# Define project specific obfuscation rules here.
|
||||
# You can include the obfuscation configuration files in the current module's build-profile.json5.
|
||||
#
|
||||
# For more details, see
|
||||
# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
|
||||
|
||||
# Obfuscation options:
|
||||
# -disable-obfuscation: disable all obfuscations
|
||||
# -enable-property-obfuscation: obfuscate the property names
|
||||
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
|
||||
# -compact: remove unnecessary blank spaces and all line feeds
|
||||
# -remove-log: remove all console.* statements
|
||||
# -print-namecache: print the name cache that contains the mapping from the old names to new names
|
||||
# -apply-namecache: reuse the given cache file
|
||||
|
||||
# Keep options:
|
||||
# -keep-property-name: specifies property names that you want to keep
|
||||
# -keep-global-name: specifies names that you want to keep in the global scope
|
||||
|
||||
-enable-property-obfuscation
|
||||
-enable-toplevel-obfuscation
|
||||
-enable-filename-obfuscation
|
||||
-enable-export-obfuscation
|
||||
19
entry/oh-package-lock.json5
普通文件
19
entry/oh-package-lock.json5
普通文件
@ -0,0 +1,19 @@
|
||||
{
|
||||
"meta": {
|
||||
"stableOrder": true,
|
||||
"enableUnifiedLockfile": false
|
||||
},
|
||||
"lockfileVersion": 3,
|
||||
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
||||
"specifiers": {
|
||||
"libentry.so@src/main/cpp/types/libentry": "libentry.so@src/main/cpp/types/libentry"
|
||||
},
|
||||
"packages": {
|
||||
"libentry.so@src/main/cpp/types/libentry": {
|
||||
"name": "libentry.so",
|
||||
"version": "1.0.0",
|
||||
"resolved": "",
|
||||
"registryType": "local"
|
||||
}
|
||||
}
|
||||
}
|
||||
11
entry/oh-package.json5
普通文件
11
entry/oh-package.json5
普通文件
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "entry",
|
||||
"version": "1.0.0",
|
||||
"description": "Please describe the basic information.",
|
||||
"main": "",
|
||||
"author": "",
|
||||
"license": "",
|
||||
"dependencies": {
|
||||
"libentry.so": "file:./src/main/cpp/types/libentry"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
# the minimum version of CMake.
|
||||
cmake_minimum_required(VERSION 3.5.0)
|
||||
project(ZeroOne)
|
||||
|
||||
set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if(DEFINED PACKAGE_FIND_FILE)
|
||||
include(${PACKAGE_FIND_FILE})
|
||||
endif()
|
||||
|
||||
include_directories(${NATIVERENDER_ROOT_PATH}
|
||||
${NATIVERENDER_ROOT_PATH}/include)
|
||||
|
||||
add_library(entry SHARED napi_init.cpp)
|
||||
target_link_libraries(entry PUBLIC libace_napi.z.so)
|
||||
53
entry/src/main/cpp/napi_init.cpp
普通文件
53
entry/src/main/cpp/napi_init.cpp
普通文件
@ -0,0 +1,53 @@
|
||||
#include "napi/native_api.h"
|
||||
#include "dlfcn.h"
|
||||
static napi_value Add(napi_env env, napi_callback_info info)
|
||||
{
|
||||
size_t argc = 2;
|
||||
napi_value args[2] = {nullptr};
|
||||
|
||||
napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);
|
||||
|
||||
napi_valuetype valuetype0;
|
||||
napi_typeof(env, args[0], &valuetype0);
|
||||
|
||||
napi_valuetype valuetype1;
|
||||
napi_typeof(env, args[1], &valuetype1);
|
||||
|
||||
double value0;
|
||||
napi_get_value_double(env, args[0], &value0);
|
||||
|
||||
double value1;
|
||||
napi_get_value_double(env, args[1], &value1);
|
||||
|
||||
napi_value sum;
|
||||
napi_create_double(env, value0 + value1, &sum);
|
||||
|
||||
return sum;
|
||||
|
||||
}
|
||||
|
||||
EXTERN_C_START
|
||||
static napi_value Init(napi_env env, napi_value exports)
|
||||
{
|
||||
napi_property_descriptor desc[] = {
|
||||
{ "add", nullptr, Add, nullptr, nullptr, nullptr, napi_default, nullptr }
|
||||
};
|
||||
napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
|
||||
return exports;
|
||||
}
|
||||
EXTERN_C_END
|
||||
|
||||
static napi_module demoModule = {
|
||||
.nm_version = 1,
|
||||
.nm_flags = 0,
|
||||
.nm_filename = nullptr,
|
||||
.nm_register_func = Init,
|
||||
.nm_modname = "entry",
|
||||
.nm_priv = ((void*)0),
|
||||
.reserved = { 0 },
|
||||
};
|
||||
|
||||
extern "C" __attribute__((constructor)) void RegisterEntryModule(void)
|
||||
{
|
||||
napi_module_register(&demoModule);
|
||||
}
|
||||
1
entry/src/main/cpp/types/libentry/index.d.ts
vendored
普通文件
1
entry/src/main/cpp/types/libentry/index.d.ts
vendored
普通文件
@ -0,0 +1 @@
|
||||
export const add: (a: number, b: number) => number;
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "libentry.so",
|
||||
"types": "./index.d.ts",
|
||||
"version": "1.0.0",
|
||||
"description": "Please describe the basic information."
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
import { calendarMgr } from './entryability/EntryAbility';
|
||||
|
||||
import hilog from '@ohos.hilog';
|
||||
import { calendarManager } from '@kit.CalendarKit';
|
||||
|
||||
let ev:calendarManager.Event = {
|
||||
type: calendarManager.EventType.NORMAL,
|
||||
title: "测试",
|
||||
startTime: Date.now(),
|
||||
endTime: Date.now() + 1000*60
|
||||
}
|
||||
|
||||
let ZOCalendarAccount: calendarManager.CalendarAccount = {
|
||||
name: '落云日程',
|
||||
type: calendarManager.CalendarType.LOCAL,
|
||||
displayName: "凌依助手-落云日程表"
|
||||
}
|
||||
calendarMgr?.createCalendar(ZOCalendarAccount).catch(() => {
|
||||
// TODO: Implement error handling.
|
||||
}).then(()=>{
|
||||
calendarMgr?.getCalendar(ZOCalendarAccount).then((ca)=>{
|
||||
ca.setConfig({
|
||||
color: '#5DA5E9'
|
||||
})
|
||||
ca.addEvent(ev)
|
||||
}).catch(() => {
|
||||
|
||||
})
|
||||
})
|
||||
@ -0,0 +1,13 @@
|
||||
export interface UserInfo{
|
||||
uid:Number,
|
||||
username: string
|
||||
}
|
||||
|
||||
const defaultUserInfo:UserInfo = {
|
||||
uid:927980270,
|
||||
username:"岚椿桦"
|
||||
}
|
||||
|
||||
export const getUserInfo = (()=>{
|
||||
return defaultUserInfo;
|
||||
})
|
||||
@ -0,0 +1,55 @@
|
||||
@Component
|
||||
struct CalendarItem {
|
||||
private name:string = "Test"
|
||||
build() {
|
||||
Row(){
|
||||
Text(this.name)
|
||||
}.backgroundColor('#8863FF').width('100%').border({
|
||||
width:1
|
||||
}).borderRadius(5).borderColor('##63A7FF').margin(1)
|
||||
}
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct CalendarCardCard {
|
||||
readonly displayPriorityOne = 1;
|
||||
readonly displayPriorityTwo = 2;
|
||||
readonly flexGrowValue = 1;
|
||||
readonly fullPercent = '100%';
|
||||
readonly imageHeight = '58%';
|
||||
readonly actionType = 'router';
|
||||
readonly abilityName = 'ShareAbility';
|
||||
readonly message = 'add detail';
|
||||
readonly layoutWeightValue = 1;
|
||||
readonly maxLinesValue = 1;
|
||||
|
||||
build() {
|
||||
Stack({ alignContent: Alignment.TopStart }) {
|
||||
Stack({ alignContent: Alignment.BottomStart }) {}
|
||||
Flex({ direction: FlexDirection.Column }) {
|
||||
Flex({ direction: FlexDirection.Row }) {
|
||||
Column(){
|
||||
CalendarItem({"name":"1"})
|
||||
CalendarItem({"name":"2"})
|
||||
CalendarItem({"name":"3"})
|
||||
}
|
||||
}
|
||||
.backgroundColor($r('sys.color.comp_background_primary'))
|
||||
.displayPriority(this.displayPriorityTwo)
|
||||
.flexGrow(this.flexGrowValue)
|
||||
.height($r('app.float.info_column_height'))
|
||||
.padding($r('app.float.info_column_padding'))
|
||||
}
|
||||
}
|
||||
.onClick(() => {
|
||||
postCardAction(this, {
|
||||
action: this.actionType,
|
||||
abilityName: this.abilityName,
|
||||
params: {
|
||||
message: this.message
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
import { abilityAccessCtrl, AbilityConstant, ConfigurationConstant,
|
||||
PermissionRequestResult,
|
||||
Permissions,
|
||||
UIAbility, Want } from '@kit.AbilityKit';
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import calendarManager from '@ohos.calendarManager';
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import { window } from '@kit.ArkUI';
|
||||
|
||||
export let calendarMgr: calendarManager.CalendarManager | null = null;
|
||||
export let mContext: common.UIAbilityContext | null = null;
|
||||
|
||||
const DOMAIN = 0x0000;
|
||||
|
||||
export default class EntryAbility extends UIAbility {
|
||||
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
|
||||
try {
|
||||
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));
|
||||
}
|
||||
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.');
|
||||
});
|
||||
mContext = this.context;
|
||||
const permissions: Permissions[] = ['ohos.permission.READ_CALENDAR', 'ohos.permission.WRITE_CALENDAR'];
|
||||
let atManager = abilityAccessCtrl.createAtManager();
|
||||
atManager.requestPermissionsFromUser(mContext, permissions).then((result: PermissionRequestResult) => {
|
||||
console.info(`get Permission success, result: ${JSON.stringify(result)}`);
|
||||
calendarMgr = calendarManager.getCalendarManager(mContext);
|
||||
}).catch((error: BusinessError) => {
|
||||
console.error(`get Permission error, error. Code: ${error.code}, message: ${error.message}`);
|
||||
})
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
|
||||
|
||||
const DOMAIN = 0x0000;
|
||||
|
||||
export default class EntryBackupAbility extends BackupExtensionAbility {
|
||||
async onBackup() {
|
||||
hilog.info(DOMAIN, 'testTag', 'onBackup ok');
|
||||
await Promise.resolve();
|
||||
}
|
||||
|
||||
async onRestore(bundleVersion: BundleVersion) {
|
||||
hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
|
||||
await Promise.resolve();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
import { formBindingData, FormExtensionAbility, formInfo } from '@kit.FormKit';
|
||||
import { Want } from '@kit.AbilityKit';
|
||||
|
||||
export default class EntryCalendarCardAbility extends FormExtensionAbility {
|
||||
onAddForm(want: Want) {
|
||||
// Called to return a FormBindingData object.
|
||||
const formData = '';
|
||||
return formBindingData.createFormBindingData(formData);
|
||||
}
|
||||
|
||||
onCastToNormalForm(formId: string) {
|
||||
// Called when the form provider is notified that a temporary form is successfully
|
||||
// converted to a normal form.
|
||||
}
|
||||
|
||||
onUpdateForm(formId: string) {
|
||||
// Called to notify the form provider to update a specified form.
|
||||
}
|
||||
|
||||
onFormEvent(formId: string, message: string) {
|
||||
// Called when a specified message event defined by the form provider is triggered.
|
||||
}
|
||||
|
||||
onRemoveForm(formId: string) {
|
||||
// Called to notify the form provider that a specified form has been destroyed.
|
||||
}
|
||||
|
||||
onAcquireFormState(want: Want) {
|
||||
// Called to return a {@link FormState} object.
|
||||
return formInfo.FormState.READY;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
import {getUserInfo} from './../UserInfoHelper'
|
||||
|
||||
import { textToSpeech } from '@kit.CoreSpeechKit';
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
|
||||
let ttsEngine: textToSpeech.TextToSpeechEngine;
|
||||
|
||||
// 设置创建引擎参数
|
||||
let extraParam: Record<string, Object> = {"style": 'interaction-broadcast', "locate": 'CN', "name": 'EngineName'};
|
||||
let initParamsInfo: textToSpeech.CreateEngineParams = {
|
||||
language: 'zh-CN',
|
||||
person: 0,
|
||||
online: 1,
|
||||
extraParams: extraParam
|
||||
};
|
||||
|
||||
// 调用createEngine方法
|
||||
textToSpeech.createEngine(initParamsInfo, (err: BusinessError, textToSpeechEngine: textToSpeech.TextToSpeechEngine) => {
|
||||
if (!err) {
|
||||
console.info('Succeeded in creating engine');
|
||||
// 接收创建引擎的实例
|
||||
ttsEngine = textToSpeechEngine;
|
||||
// 设置回调
|
||||
ttsEngine.setListener(speakListener);
|
||||
// 调用播报方法
|
||||
// 开发者可以通过修改speakParams主动设置播报策略
|
||||
} else {
|
||||
console.error(`Failed to create engine. Code: ${err.code}, message: ${err.message}.`);
|
||||
}
|
||||
});
|
||||
|
||||
// 设置speak的回调信息
|
||||
let speakListener: textToSpeech.SpeakListener = {
|
||||
// 开始播报回调
|
||||
onStart(requestId: string, response: textToSpeech.StartResponse) {
|
||||
console.info(`onStart, requestId: ${requestId} response: ${JSON.stringify(response)}`);
|
||||
},
|
||||
// 合成完成及播报完成回调
|
||||
onComplete(requestId: string, response: textToSpeech.CompleteResponse) {
|
||||
console.info(`onComplete, requestId: ${requestId} response: ${JSON.stringify(response)}`);
|
||||
},
|
||||
// 停止播报回调
|
||||
onStop(requestId: string, response: textToSpeech.StopResponse) {
|
||||
console.info(`onStop, requestId: ${requestId} response: ${JSON.stringify(response)}`);
|
||||
},
|
||||
// 返回音频流
|
||||
onData(requestId: string, audio: ArrayBuffer, response: textToSpeech.SynthesisResponse) {
|
||||
console.info(`onData, requestId: ${requestId} sequence: ${JSON.stringify(response)} audio: ${JSON.stringify(audio)}`);
|
||||
},
|
||||
// 错误回调
|
||||
onError(requestId: string, errorCode: number, errorMessage: string) {
|
||||
console.error(`onError, requestId: ${requestId} errorCode: ${errorCode} errorMessage: ${errorMessage}`);
|
||||
}
|
||||
};
|
||||
let originalText: string = 'Hello HarmonyOS';
|
||||
// 设置播报相关参数
|
||||
let speakParams: textToSpeech.SpeakParams = {
|
||||
requestId: Date(), // requestId在同一实例内仅能用一次,请勿重复设置
|
||||
extraParams: extraParam
|
||||
};
|
||||
|
||||
let userinfo = getUserInfo()
|
||||
let SpeechPageA = new NavPathInfo('SpeechPage',null)
|
||||
let NVS = new NavPathStack()
|
||||
NVS.pushPath(SpeechPageA)
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State message: string = 'Hello World';
|
||||
@State errmsg: string = "你说得对,但是原神是一款由米哈游独立自主研发的开放世界冒险游戏。故事发生在提瓦特大陆,在这里,你将扮演旅行者的形象。"
|
||||
build() {
|
||||
Column(){
|
||||
Row(){
|
||||
Image(`https://q.qlogo.cn/headimg_dl?dst_uin=${userinfo.uid}&spec=640&img_type=jpg`).width(30).borderRadius(10)
|
||||
Text(userinfo.username).fontSize(24)
|
||||
}.width('100%').padding(15)
|
||||
Divider()
|
||||
Text(this.errmsg)
|
||||
Button('114514').onClick((ev)=>{
|
||||
try {
|
||||
ttsEngine.speak(this.errmsg, speakParams);
|
||||
} catch (error) {
|
||||
this.errmsg = error
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
@Entry
|
||||
@Component
|
||||
struct MES{
|
||||
build() {
|
||||
Text("MEShare")
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { window } from '@kit.ArkUI';
|
||||
import { systemShare } from '@kit.ShareKit';
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
|
||||
const DOMAIN = 0x0000;
|
||||
|
||||
export default class ShareAbility extends UIAbility {
|
||||
handleParam(want: Want) {
|
||||
systemShare.getSharedData(want)
|
||||
.then(( data) => {
|
||||
const records = data.getRecords();
|
||||
records.forEach((record: systemShare.SharedRecord) => {
|
||||
// 处理单条分享数据(如文件FD)
|
||||
console.log('Want FD')
|
||||
console.log(record.title)
|
||||
});
|
||||
})
|
||||
.catch((err: BusinessError) => {
|
||||
console.error('接收分享失败:', err);
|
||||
});
|
||||
}
|
||||
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
|
||||
this.handleParam(want)
|
||||
}
|
||||
|
||||
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/MEShare/MES', (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');
|
||||
}
|
||||
}
|
||||
109
entry/src/main/module.json5
普通文件
109
entry/src/main/module.json5
普通文件
@ -0,0 +1,109 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "entry",
|
||||
"type": "entry",
|
||||
"description": "$string:module_desc",
|
||||
"mainElement": "EntryAbility",
|
||||
"deviceTypes": [
|
||||
"phone"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"pages": "$profile:main_pages",
|
||||
"requestPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.READ_CALENDAR",
|
||||
"reason": "$string:read_calendar_permission",
|
||||
"usedScene": {
|
||||
"when": "always"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.WRITE_CALENDAR",
|
||||
"reason": "$string:read_calendar_permission",
|
||||
"usedScene": {
|
||||
"when": "always"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.INTERNET",
|
||||
"reason": "$string:network_connecting"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.kernel.ALLOW_EXECUTABLE_FORT_MEMORY",
|
||||
"reason": "$string:JIT"
|
||||
}
|
||||
],
|
||||
"abilities": [
|
||||
{
|
||||
"name": "EntryAbility",
|
||||
"srcEntry": "./ets/entryability/EntryAbility.ets",
|
||||
"description": "$string:EntryAbility_desc",
|
||||
"icon": "$media:layered_image",
|
||||
"label": "$string:EA_label_zhcn",
|
||||
"startWindowIcon": "$media:foreground",
|
||||
"startWindowBackground": "$color:start_window_background",
|
||||
"exported": true,
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
],
|
||||
"actions": [
|
||||
"ohos.want.action.home"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ShareAbility",
|
||||
"srcEntry": "./ets/shareability/ShareAbility.ets",
|
||||
"description": "$string:ShareAbility_desc",
|
||||
"icon": "$media:layered_image",
|
||||
"label": "$string:ShareAbility_label",
|
||||
"startWindowIcon": "$media:startIcon",
|
||||
"startWindowBackground": "$color:start_window_background",
|
||||
"exported": true,
|
||||
"skills": [{
|
||||
"actions": ["ohos.want.action.sendData"],
|
||||
"uris": [{
|
||||
"utd": "general.entity",
|
||||
"scheme": 'file',
|
||||
"maxFileSupported": 1
|
||||
},{
|
||||
"scheme": "file",
|
||||
"utd": "general.text",
|
||||
"maxFileSupported": 1
|
||||
}]
|
||||
}]
|
||||
}
|
||||
],
|
||||
"extensionAbilities": [
|
||||
{
|
||||
"name": "EntryBackupAbility",
|
||||
"srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
|
||||
"type": "backup",
|
||||
"exported": false,
|
||||
"metadata": [
|
||||
{
|
||||
"name": "ohos.extension.backup",
|
||||
"resource": "$profile:backup_config"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "EntryCalendarCardAbility",
|
||||
"srcEntry": "./ets/entrycalendarcardability/EntryCalendarCardAbility.ets",
|
||||
"label": "$string:EntryCalendarCardAbility_label",
|
||||
"description": "$string:EntryCalendarCardAbility_desc",
|
||||
"type": "form",
|
||||
"metadata": [
|
||||
{
|
||||
"name": "ohos.extension.form",
|
||||
"resource": "$profile:form_config"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
{
|
||||
"color": [
|
||||
{
|
||||
"name": "start_window_background",
|
||||
"value": "#FFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "information_title_font",
|
||||
"value": "#E6000000"
|
||||
},
|
||||
{
|
||||
"name": "title_font",
|
||||
"value": "#E5FFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "item_text_font",
|
||||
"value": "#99000000"
|
||||
},
|
||||
{
|
||||
"name": "image_info_background",
|
||||
"value": "#FFFFFF"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
{
|
||||
"float": [
|
||||
{
|
||||
"name": "page_text_font_size",
|
||||
"value": "50fp"
|
||||
},
|
||||
{
|
||||
"name": "card_title_font_size",
|
||||
"value": "14fp"
|
||||
},
|
||||
{
|
||||
"name": "item_font_size",
|
||||
"value": "12fp"
|
||||
},
|
||||
{
|
||||
"name": "maximum_padding",
|
||||
"value": "12vp"
|
||||
},
|
||||
{
|
||||
"name": "item_margin_top",
|
||||
"value": "2vp"
|
||||
},
|
||||
{
|
||||
"name": "image_margin_bottom",
|
||||
"value": "8vp"
|
||||
},
|
||||
{
|
||||
"name": "info_column_padding",
|
||||
"value": "12vp"
|
||||
},
|
||||
{
|
||||
"name": "info_column_width",
|
||||
"value": "106vp"
|
||||
},
|
||||
{
|
||||
"name": "info_column_height",
|
||||
"value": "112vp"
|
||||
},
|
||||
{
|
||||
"name": "image_border_radius",
|
||||
"value": "8vp"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "module_desc",
|
||||
"value": "本模块是凌依助手的首选启动模块。"
|
||||
},
|
||||
{
|
||||
"name": "EntryAbility_desc",
|
||||
"value": "凌依助手是星谐落云全过程人工智能辅助体系的前端组成部分。"
|
||||
},
|
||||
{
|
||||
"name": "EntryAbility_label",
|
||||
"value": "Zero One"
|
||||
},
|
||||
{
|
||||
"name": "EA_label_zhcn",
|
||||
"value": "凌依"
|
||||
},
|
||||
{
|
||||
"name": "read_calendar_permission",
|
||||
"value": "读写日历的权限,用以同步日程。"
|
||||
},
|
||||
{
|
||||
"name": "EntryCalendarCardAbility_desc",
|
||||
"value": "form_description"
|
||||
},
|
||||
{
|
||||
"name": "EntryCalendarCardAbility_label",
|
||||
"value": "落云日程表"
|
||||
},
|
||||
{
|
||||
"name": "CalendarCard_desc",
|
||||
"value": "凌依助手-落云日程表"
|
||||
},
|
||||
{
|
||||
"name": "CalendarCard_display_name",
|
||||
"value": "落云日程表卡片"
|
||||
},
|
||||
{
|
||||
"name": "card_title",
|
||||
"value": "标题"
|
||||
},
|
||||
{
|
||||
"name": "introduction",
|
||||
"value": "描述"
|
||||
},
|
||||
{
|
||||
"name": "network_connecting",
|
||||
"value": "通过网络下载资源、完成请求等。"
|
||||
},
|
||||
{
|
||||
"name": "JIT",
|
||||
"value": "在程序运行过程中动态更新代码。"
|
||||
},
|
||||
{
|
||||
"name": "ShareAbility_desc",
|
||||
"value": "芸链分享是星谐智能的一个基础多端分享能力。"
|
||||
},
|
||||
{
|
||||
"name": "ShareAbility_label",
|
||||
"value": "芸链分享"
|
||||
}
|
||||
]
|
||||
}
|
||||
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 90 KiB |
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 8.6 KiB |
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 5.7 KiB |
@ -0,0 +1,7 @@
|
||||
{
|
||||
"layered-image":
|
||||
{
|
||||
"background" : "$media:background",
|
||||
"foreground" : "$media:foreground"
|
||||
}
|
||||
}
|
||||
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 20 KiB |
@ -0,0 +1,3 @@
|
||||
{
|
||||
"allowToBackupRestore": true
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
{
|
||||
"forms": [
|
||||
{
|
||||
"name": "CalendarCard",
|
||||
"displayName": "$string:CalendarCard_display_name",
|
||||
"description": "$string:CalendarCard_desc",
|
||||
"src": "./ets/calendarcard/pages/CalendarCardCard.ets",
|
||||
"uiSyntax": "arkts",
|
||||
"window": {
|
||||
"designWidth": 720,
|
||||
"autoDesignWidth": true
|
||||
},
|
||||
"colorMode": "auto",
|
||||
"isDynamic": true,
|
||||
"isDefault": true,
|
||||
"updateEnabled": false,
|
||||
"scheduledUpdateTime": "10:30",
|
||||
"updateDuration": 1,
|
||||
"defaultDimension": "4*4",
|
||||
"supportDimensions": [
|
||||
"4*4"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"src": [
|
||||
"pages/Index",
|
||||
"pages/SpeechPage",
|
||||
"pages/MEShare/MES"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
{
|
||||
"color": [
|
||||
{
|
||||
"name": "start_window_background",
|
||||
"value": "#000000"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
{
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
|
||||
|
||||
export default function abilityTest() {
|
||||
describe('ActsAbilityTest', () => {
|
||||
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
|
||||
beforeAll(() => {
|
||||
// Presets an action, which is performed only once before all test cases of the test suite start.
|
||||
// This API supports only one parameter: preset action function.
|
||||
})
|
||||
beforeEach(() => {
|
||||
// Presets an action, which is performed before each unit test case starts.
|
||||
// The number of execution times is the same as the number of test cases defined by **it**.
|
||||
// This API supports only one parameter: preset action function.
|
||||
})
|
||||
afterEach(() => {
|
||||
// Presets a clear action, which is performed after each unit test case ends.
|
||||
// The number of execution times is the same as the number of test cases defined by **it**.
|
||||
// This API supports only one parameter: clear action function.
|
||||
})
|
||||
afterAll(() => {
|
||||
// Presets a clear action, which is performed after all test cases of the test suite end.
|
||||
// This API supports only one parameter: clear action function.
|
||||
})
|
||||
it('assertContain', 0, () => {
|
||||
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
|
||||
let a = 'abc';
|
||||
let b = 'b';
|
||||
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
|
||||
expect(a).assertContain(b);
|
||||
expect(a).assertEqual(a);
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
import abilityTest from './Ability.test';
|
||||
|
||||
export default function testsuite() {
|
||||
abilityTest();
|
||||
}
|
||||
11
entry/src/ohosTest/module.json5
普通文件
11
entry/src/ohosTest/module.json5
普通文件
@ -0,0 +1,11 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "entry_test",
|
||||
"type": "feature",
|
||||
"deviceTypes": [
|
||||
"phone"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false
|
||||
}
|
||||
}
|
||||
5
entry/src/test/List.test.ets
普通文件
5
entry/src/test/List.test.ets
普通文件
@ -0,0 +1,5 @@
|
||||
import localUnitTest from './LocalUnit.test';
|
||||
|
||||
export default function testsuite() {
|
||||
localUnitTest();
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
|
||||
|
||||
export default function localUnitTest() {
|
||||
describe('localUnitTest', () => {
|
||||
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
|
||||
beforeAll(() => {
|
||||
// Presets an action, which is performed only once before all test cases of the test suite start.
|
||||
// This API supports only one parameter: preset action function.
|
||||
});
|
||||
beforeEach(() => {
|
||||
// Presets an action, which is performed before each unit test case starts.
|
||||
// The number of execution times is the same as the number of test cases defined by **it**.
|
||||
// This API supports only one parameter: preset action function.
|
||||
});
|
||||
afterEach(() => {
|
||||
// Presets a clear action, which is performed after each unit test case ends.
|
||||
// The number of execution times is the same as the number of test cases defined by **it**.
|
||||
// This API supports only one parameter: clear action function.
|
||||
});
|
||||
afterAll(() => {
|
||||
// Presets a clear action, which is performed after all test cases of the test suite end.
|
||||
// This API supports only one parameter: clear action function.
|
||||
});
|
||||
it('assertContain', 0, () => {
|
||||
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
|
||||
let a = 'abc';
|
||||
let b = 'b';
|
||||
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
|
||||
expect(a).assertContain(b);
|
||||
expect(a).assertEqual(a);
|
||||
});
|
||||
});
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户