Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
dcf94a51
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
dcf94a51
编写于
10月 21, 2022
作者:
H
hekun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ARKUI add interfac test
Signed-off-by:
N
hekun
<
hekun18@huawei.com
>
上级
b334eb7d
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
728 addition
and
170 deletion
+728
-170
arkui/ace_ets_component_attrlack/entry/src/main/config.json
arkui/ace_ets_component_attrlack/entry/src/main/config.json
+2
-1
arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets
..._attrlack/entry/src/main/ets/MainAbility/pages/common.ets
+49
-1
arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/enums.ets
...t_attrlack/entry/src/main/ets/MainAbility/pages/enums.ets
+7
-0
arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/featureAbility.ets
...k/entry/src/main/ets/MainAbility/pages/featureAbility.ets
+234
-164
arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/loadingProgress.ets
.../entry/src/main/ets/MainAbility/pages/loadingProgress.ets
+3
-0
arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/navigation_lack.ets
.../entry/src/main/ets/MainAbility/pages/navigation_lack.ets
+172
-0
arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/slider.ets
..._attrlack/entry/src/main/ets/MainAbility/pages/slider.ets
+2
-1
arkui/ace_ets_component_two/entry/src/main/config.json
arkui/ace_ets_component_two/entry/src/main/config.json
+3
-2
arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/WaterFlowDataSource.ets
...ry/src/main/ets/MainAbility/pages/WaterFlowDataSource.ets
+115
-0
arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/WaterflowDemo.ets
...wo/entry/src/main/ets/MainAbility/pages/WaterflowDemo.ets
+71
-0
arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/navigation.ets
...t_two/entry/src/main/ets/MainAbility/pages/navigation.ets
+1
-1
arkui/ace_ets_component_two/entry/src/main/ets/test/List.test.ets
...e_ets_component_two/entry/src/main/ets/test/List.test.ets
+3
-0
arkui/ace_ets_component_two/entry/src/main/ets/test/waterFlowDemo.test.ets
...ponent_two/entry/src/main/ets/test/waterFlowDemo.test.ets
+66
-0
未找到文件。
arkui/ace_ets_component_attrlack/entry/src/main/config.json
浏览文件 @
dcf94a51
...
...
@@ -115,7 +115,8 @@
"pages/responseType"
,
"pages/hoverEffect"
,
"pages/hitTestMode"
,
"pages/color"
"pages/color"
,
"pages/navigation_lack"
],
"name"
:
".MainAbility"
,
"window"
:
{
...
...
arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets
浏览文件 @
dcf94a51
...
...
@@ -20,6 +20,13 @@ const TAG = 'ets_apiLack_add';
@Entry
@Component
export default struct CommonColorMode {
// popup构造器定义弹框内容
@Builder popupBuilder() {
Row({ space: 2 }) {
Text('Custom Popup').fontSize(10)
}.width(100).height(50).padding(5)
}
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear CommonColorMode start`)
}
...
...
@@ -27,10 +34,44 @@ export default struct CommonColorMode {
aboutToDisappear() {
Log.showInfo(TAG, `aboutToDisAppear CommonColorMode end`)
}
onLayout(children, constraint) {
Log.showInfo(TAG, `onLayout start` + JSON.stringify(children));
children[0].borderInfo = {
borderWidth: 20,
margin: 30,
padding: 20
}
children[0].constraint = {
maxWidth: 200
}
children[0].layout({
position: {
x:20,
y:20
},
constraint: {
maxWidth: 200
}
})
}
onMeasure(children, constraint) {
Log.showInfo(TAG, `onMeasurestart`)
}
@Styles normalStyles() {
.backgroundColor("#0A59F7")
}
// add
configuration : Configuration = {
colorMode: "$000",
fontScale: 23
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
...
@@ -48,6 +89,10 @@ export default struct CommonColorMode {
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("fontScaleText")
.bindPopup(true,{
message:"23",
showInSubWindow:true
}).
Text("common-OnFinish")
.width(320)
...
...
@@ -66,7 +111,10 @@ export default struct CommonColorMode {
onFinish: () => {
Log.showInfo(TAG, 'animation onFinish success')
}
})
}).bindPopup(true,{
builder:this.popupBuilder,
showInSubWindow:true
})
Text("common-MotionPath")
.width(320)
...
...
arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/enums.ets
浏览文件 @
dcf94a51
...
...
@@ -36,6 +36,13 @@ struct EnumsCancel {
@State mouseText: string = 'MouseText'
@State fit:RelateType = RelateType.FIT;
@State fill:RelateType = RelateType.FILL;
@State mainonly:TitleHeight = TitleHeight.MainOnly;
@State MainWithSub:TitleHeight = TitleHeight.MainWithSub;
@State Block:HitTestMode = HitTestMode.Block;
@Styles pressedStyles() {
.backgroundColor('red')
.opacity(1)
...
...
arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/featureAbility.ets
浏览文件 @
dcf94a51
...
...
@@ -19,21 +19,21 @@ const TAG = 'ets_apiLack_add';
@Entry
@Component
export default struct FeatureAbility
AbilityName
{
export default struct FeatureAbility
StartAbility
{
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear FeatureAbility
AbilityName
start`)
Log.showInfo(TAG, `aboutToAppear FeatureAbility
StartAbility
start`)
}
aboutToDisappear() {
Log.showInfo(TAG, `aboutToDisAppear FeatureAbility
AbilityName
end`)
Log.showInfo(TAG, `aboutToDisAppear FeatureAbility
StartAbility
end`)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text("featureAbility-S
ubscribeMessageResponse-DeviceId
")
Text("featureAbility-S
tartAbility
")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -43,21 +43,17 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("s
ubscribeMessageResponseDeviceId
Text")
.key("s
tartAbility
Text")
.onClick(() => {
FeatureAbility.subscribeMsg({
success: (data) => {
console.log(`deviceId: ${data.deviceId}`)
},
fail: (data, code) => {
console.log(`data: ${data} code: ${code}`)
}
FeatureAbility.startAbility({
bundleName: "com.example.testapp",
abilityName: "com.example.testApp.MainAbility"
})
})
Text("featureAbility-S
ubscribeMessageResponse-AbilityName
")
Text("featureAbility-S
tartAbilityForResult
")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -67,21 +63,16 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("s
ubscribeMessageResponseAbilityName
Text")
.key("s
tartAbilityForResult
Text")
.onClick(() => {
FeatureAbility.subscribeMsg({
success: (data) => {
console.log(`deviceId: ${data.abilityName}`)
},
fail: (data, code) => {
console.log(`data: ${data} code: ${code}`)
}
})
FeatureAbility.startAbilityForResult({
bundleName: "com.example.testapp",
abilityName: "com.example.testApp.MainAbility" })
})
Text("featureAbility-
CallAbilityParam-AbilityName
")
Text("featureAbility-
FinishWithResult
")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -91,24 +82,14 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("
callAbilityParamAbilityName
Text")
.key("
finishWithResult
Text")
.onClick(() => {
FeatureAbility.callAbility({
bundleName: 'com.example.hiaceservice',
abilityName: 'com.example.hiaceservice.ComputeServiceAbility',
messageCode: 1001,
data: {
firstNum: 1024,
secondNum: 2048
},
abilityType: 0,
syncOption: 0
})
FeatureAbility.finishWithResult({ code: 200, result: null })
})
Text("featureAbility-
CallAbilityParam-MessageCode
")
Text("featureAbility-
GetDeviceList
")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -118,24 +99,14 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("
callAbilityParamMessageCode
Text")
.key("
getDeviceList
Text")
.onClick(() => {
FeatureAbility.callAbility({
bundleName: 'com.example.hiaceservice',
abilityName: 'com.example.hiaceservice.ComputeServiceAbility',
messageCode: 1001,
data: {
firstNum: 1024,
secondNum: 2048
},
abilityType: 0,
syncOption: 0
})
FeatureAbility.getDeviceList(1)
})
Text("featureAbility-CallAbility
Param-AbilityType
")
Text("featureAbility-CallAbility")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -145,24 +116,19 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("callAbility
ParamAbilityType
Text")
.key("callAbilityText")
.onClick(() => {
FeatureAbility.callAbility({
bundleName: 'com.example.hiaceservice',
abilityName: 'com.example.hiaceservice.ComputeServiceAbility',
messageCode: 1001,
data: {
firstNum: 1024,
secondNum: 2048
},
abilityType: 0,
syncOption: 0
bundleName: "com.example.testapp",
abilityName: "com.example.testApp.MainAbility",
messageCode: 200,
abilityType: 1
})
})
Text("featureAbility-C
allAbilityParam-SyncOption
")
Text("featureAbility-C
ontinueAbility
")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -172,24 +138,14 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("c
allAbilityParamSyncOption
Text")
.key("c
ontinueAbility
Text")
.onClick(() => {
FeatureAbility.callAbility({
bundleName: 'com.example.hiaceservice',
abilityName: 'com.example.hiaceservice.ComputeServiceAbility',
messageCode: 1001,
data: {
firstNum: 1024,
secondNum: 2048
},
abilityType: 0,
syncOption: 0
})
FeatureAbility.continueAbility()
})
Text("featureAbility-SubscribeAbilityEvent
Param-AbilityName
")
Text("featureAbility-SubscribeAbilityEvent")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -199,23 +155,20 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("subscribeAbilityEvent
ParamAbilityName
Text")
.key("subscribeAbilityEventText")
.onClick(() => {
FeatureAbility.subscribeAbilityEvent({
bundleName: 'com.example.hiaceservice',
abilityName: 'com.example.hiaceservice.ComputeServiceAbility',
messageCode: 1005,
abilityType: 0,
syncOption: 0
}, (callbackData) => {
var callbackJson = JSON.parse(callbackData);
console.info('eventData is: ' + JSON.stringify(callbackJson.data));
bundleName: "com.example.testapp",
abilityName: "com.example.testApp.MainAbility",
messageCode: 200,
abilityType: 1
}, () => {
})
})
Text("featureAbility-
SubscribeAbilityEventParam-MessageCode
")
Text("featureAbility-
UnsubscribeAbilityEvent
")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -225,23 +178,19 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("
subscribeAbilityEventParammessageCode
Text")
.key("
unsubscribeAbilityEvent
Text")
.onClick(() => {
FeatureAbility.subscribeAbilityEvent({
bundleName: 'com.example.hiaceservice',
abilityName: 'com.example.hiaceservice.ComputeServiceAbility',
messageCode: 1005,
abilityType: 0,
syncOption: 0
}, (callbackData) => {
var callbackJson = JSON.parse(callbackData);
console.info('eventData is: ' + JSON.stringify(callbackJson.data));
FeatureAbility.unsubscribeAbilityEvent({
bundleName: "com.example.testapp",
abilityName: "com.example.testApp.MainAbility",
messageCode: 200,
abilityType: 1
})
})
Text("featureAbility-S
ubscribeAbilityEventParam-AbilityType
")
Text("featureAbility-S
endMsg
")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -251,23 +200,28 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("s
ubscribeAbilityEventParamAbilityType
Text")
.key("s
endMsg
Text")
.onClick(() => {
FeatureAbility.subscribeAbilityEvent({
bundleName: 'com.example.hiaceservice',
abilityName: 'com.example.hiaceservice.ComputeServiceAbility',
messageCode: 1005,
abilityType: 0,
syncOption: 0
}, (callbackData) => {
var callbackJson = JSON.parse(callbackData);
console.info('eventData is: ' + JSON.stringify(callbackJson.data));
FeatureAbility.sendMsg({
deviceId: '1001',
bundleName: "com.example.testapp",
abilityName: "com.example.testApp.MainAbility",
message: 'success',
success: () => {
Log.showInfo(TAG, `FeatureAbility.sendMsg success`)
},
fail: (data, code) => {
Log.showInfo(TAG, `FeatureAbility.sendMsg fail: data: ${data},code: ${code}`)
},
complete: () => {
Log.showInfo(TAG, `FeatureAbility.sendMsg complete`)
}
})
})
Text("featureAbility-Subscribe
AbilityEventParam-SyncOption
")
Text("featureAbility-Subscribe
Msg
")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -277,24 +231,38 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("subscribe
AbilityEventParamSyncOption
Text")
.key("subscribe
Msg
Text")
.onClick(() => {
FeatureAbility.subscribeAbilityEvent({
bundleName: 'com.example.hiaceservice',
abilityName: 'com.example.hiaceservice.ComputeServiceAbility',
messageCode: 1005,
abilityType: 0,
syncOption: 0
}, (callbackData) => {
var callbackJson = JSON.parse(callbackData);
console.info('eventData is: ' + JSON.stringify(callbackJson.data));
FeatureAbility.subscribeMsg({
success: (data) => {
Log.showInfo(TAG, `FeatureAbility.subscribeMsg success: data: ${JSON.stringify(data)}`)
},
fail: (data, code) => {
Log.showInfo(TAG, `FeatureAbility.subscribeMsg fail: data: ${data},code: ${code}`)
}
})
})
Text("featureAbility-UnsubscribeMsg")
.width(320)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("unsubscribeMsgText")
.onClick(() => {
FeatureAbility.unsubscribeMsg()
})
Text("featureAbility-S
endMessageOptions-DeviceId
")
Text("featureAbility-S
tartAbility
")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -304,18 +272,24 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("
sendMessageOptionsDeviceIdText
")
.key("
featureAbility-StartAbility
")
.onClick(() => {
FeatureAbility.sendMsg({
deviceId: '1001',
bundleName: 'com.example.hiaceservice',
abilityName: 'com.example.hiaceservice.ComputeServiceAbility'
})
FeatureAbility.startAbility(
{
bundleName :"com.example.myapplication",
abilityName : "com.example.entry.secondAbility",
entities:['a','b'],
url:""
}
).then((data) => {
console.info("==========================>startAbility=======================>");
});
})
Text("featureAbility-
SendMessageOptions-AbilityName
")
Text("featureAbility-
startAbilityForResult
")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -325,18 +299,23 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("
sendMessageOptionsAbilityNameTex
t")
.key("
featureAbility-startAbilityForResul
t")
.onClick(() => {
FeatureAbility.sendMsg({
deviceId: '1001',
bundleName: 'com.example.hiaceservice',
abilityName: 'com.example.hiaceservice.ComputeServiceAbility'
})
FeatureAbility.startAbilityForResult(
{
bundleName :"com.example.myapplication",
abilityName : "com.example.entry.secondAbility",
entities:['a','b'],
url:""
},
).then((data) => {
console.info("==========================>startAbilityForResult=======================>");
});
})
Text("featureAbility-
RequestParams-AbilityName
")
Text("featureAbility-
finishWithResult
")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -346,17 +325,19 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("
requestParamsAbilityNameTex
t")
.key("
featureAbility-finishWithResul
t")
.onClick(() => {
FeatureAbility.startAbility({
bundleName: 'com.example.hiaceservice',
abilityName: 'com.example.hiaceservice.ComputeServiceAbility'
})
FeatureAbility.finishWithResult({
code:20002,
result:{}
}).then((data) => {
console.info("==========================>startAbilityForResult=======================>");
});
})
Text("featureAbility-
Entities
")
Text("featureAbility-
getDeviceList
")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -366,18 +347,16 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("
entitiesTex
t")
.key("
featureAbility-finishWithResul
t")
.onClick(() => {
FeatureAbility.startAbility({
bundleName: 'com.example.hiaceservice',
abilityName: 'com.example.hiaceservice.ComputeServiceAbility',
entities: ["this is a test"]
})
FeatureAbility.getDeviceList(23).then((data) => {
console.info("==========================>startAbilityForResult=======================>");
});
})
Text("featureAbility-
DeviceType
")
Text("featureAbility-
getDeviceList
")
.width(320)
.height(
5
0)
.height(
7
0)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
...
...
@@ -387,13 +366,104 @@ export default struct FeatureAbilityAbilityName {
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("
deviceTypeTex
t")
.key("
featureAbility-finishWithResul
t")
.onClick(() => {
FeatureAbility.startAbility({
bundleName: 'com.example.hiaceservice',
abilityName: 'com.example.hiaceservice.ComputeServiceAbility',
deviceType: 1001
})
FeatureAbility.getDeviceList(23).then((data) => {
console.info("==========================>startAbilityForResult=======================>");
});
})
Text("featureAbility-callAbility")
.width(320)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("featureAbility-callAbility")
.onClick(() => {
FeatureAbility.callAbility({
bundleName: "com.example.myapplication",
abilityName: "com.example.entry.secondAbility",
messageCode: 50,
abilityType: 12
}).then((data) => {
console.info("==========================>startAbilityForResult=======================>");
});
})
Text("featureAbility-continueAbility")
.width(320)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("featureAbility-continueAbility")
.onClick(() => {
FeatureAbility.continueAbility().then((data) => {
console.info("==========================>startAbilityForResult=======================>");
});
})
Text("featureAbility-subscribeAbilityEvent")
.width(320)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("featureAbility-subscribeAbilityEvent")
.onClick(() => {
FeatureAbility.subscribeAbilityEvent({
bundleName: "ss",
abilityName: "d",
messageCode: 50,
abilityType: 60,
syncOption:20
},() => {
console.info("hello subscribeAbilityEvent")
}).then((data) => {
console.info("==========================>startAbilityForResult=======================>");
});
})
Text("featureAbility-unsubscribeAbilityEvent")
.width(320)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("featureAbility-unsubscribeAbilityEvent")
.onClick(() => {
FeatureAbility.unsubscribeAbilityEvent({
bundleName: "d",
abilityName: "s",
messageCode: 20,
abilityType: 30,
syncOption: 40
}).then((data) => {
console.info("==========================>startAbilityForResult=======================>");
});
})
}.width("100%").height("100%")
...
...
arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/loadingProgress.ets
浏览文件 @
dcf94a51
...
...
@@ -21,6 +21,8 @@ const TAG = 'ets_apiLack_add';
@Component
export default
struct LoadingProgressCircular {
@State circular:LoadingProgressStyle = LoadingProgressStyle.Circular;
@State orbital:LoadingProgressStyle = LoadingProgressStyle.Orbital;
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear LoadingProgressCircular start`)
}
...
...
@@ -63,6 +65,7 @@ struct LoadingProgressCircular {
Text('Orbital LoadingProgress ').fontSize(9).fontColor(0xCCCCCC).width('100%')
LoadingProgress()
.color(Color.Blue)
}.width("100%").height("100%")
}
}
...
...
arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/navigation_lack.ets
0 → 100644
浏览文件 @
dcf94a51
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import events_emitter from '@ohos.events.emitter';
@Entry
@Component
struct NavigationExample {
private arr: number[] = [0, 1, 2, 3, 4, 5]
@State hideBar: boolean = true
@State toolBar: boolean = true
@State hideToolBar: boolean = false
@State hideTitleBar: boolean = false
@State hideBackButton: boolean = false
@State onActionCalled: boolean = false
@State titleMode: NavigationTitleMode = NavigationTitleMode.Free
@State navagationmode: NavigationMode = NavigationMode.Stack
@State navagationmode2: NavigationMode = NavigationMode.Split
@state commonTile :NavigationCommonTitle = {
main:"main",
sub: "sub"
}
@State navTile:NavDestinationCommonTitle = {
main:"main_nav",
sub: "sub_nav"
}
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("tabs page state change called:" + JSON.stringify(eventData));
if (eventData.data.vertical != null) {
this.titleMode = eventData.data.titleMode;
}
if (eventData.data.hideToolBar != null) {
this.hideToolBar = parseInt(eventData.data.hideToolBar);
}
if (eventData.data.hideTitleBar != null) {
this.hideTitleBar = parseInt(eventData.data.hideTitleBar);
}
if (eventData.data.hideBackButton != null) {
this.hideBackButton = parseInt(eventData.data.hideBackButton);
}
}
}
onPageShow() {
console.info('progress page show called');
var stateChangeEvent = {
eventId: 135,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack)
}
@Builder NavigationTitle() {
Column() {
Text('title')
.width(80)
.height(60)
.fontColor(Color.Blue)
.fontSize(30)
}
.onClick(() => {
console.log("title")
})
}
@Builder NavigationMenus() {
Row() {
Image('images/add.png')
.width(25)
.height(25)
Image('comment/more.png')
.width(25)
.height(25)
.margin({ left: 30 })
}.width(100)
}
build() {
Column() {
Navigation() {
Search({ value: '', placeholder: "" }).width('85%').margin(26)
List({ space: 5, initialIndex: 0 }) {
ForEach(this.arr, (item) => {
ListItem() {
Text('' + item)
.width('90%')
.height(80)
.backgroundColor('#3366CC')
.borderRadius(15)
.fontSize(16)
.textAlign(TextAlign.Center)
}.editable(true)
}, item => item)
}
.listDirection(Axis.Vertical)
.key('Navigation')
.height(300)
.margin({ top: 10, left: 18 })
.width('100%')
Button(this.hideBar ? "tool bar" : "hide bar")
.backgroundColor(0x2788D9).width(200).height(100).fontSize(20)
.key('NavigationContent1')
.onClick(() => {
this.hideBar = !this.hideBar;
console.info('navigationContent1 current action state is: ' + this.hideBar);
try {
var backData = {
data: {
"ACTION": this.hideBar,
}
}
var backEvent = {
eventId: 1366,
priority: events_emitter.EventPriority.LOW
}
console.info("navigationContent1 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("navigationContent1 emit action state err: " + JSON.stringify(err.message))
}
})
.margin({ left: 135, top: 60 })
}
.title(this.NavigationTitle)
.subTitle('subtitle')
.menus(this.NavigationMenus)
.titleMode(NavigationTitleMode.Free)
.hideTitleBar(false)
.hideBackButton(false)
.navBarWidth(30)
.navBarPosition(NavBarPosition.start)
.backButtonIcon('images/grid.svg')
.hideNavBar(true)
.onNavBarStateChange((isVisible: boolean) => {
console.info("isvisible")
})
.onTitleModeChange((titleModel: NavigationTitleMode) => {
console.log('titleMode')
})
.toolBar({ items: [
{ value: 'app', icon: 'images/grid.svg', action: () => {
console.log("app")
} },
{ value: 'add', icon: 'images/add.svg', action: () => {
console.log("add")
} },
{ value: 'collect', icon: 'images/collect.svg', action: () => {
console.log("collect")
} }] })
.hideToolBar(this.hideBar)
}
}
}
\ No newline at end of file
arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/slider.ets
浏览文件 @
dcf94a51
...
...
@@ -22,7 +22,8 @@ const TAG = 'ets_apiLack_add';
@Entry
@Component
export default struct SliderMoving {
@State outSetValue: number = 40
@State outSetValue: number = 40;
@State move:SliderChangeMode = SliderChangeMode.Moving;
slide() {
var rect = Utils.getComponentRect("Slider")
Utils.drag(rect["left"],rect["top"],rect["right"],rect["bottom"],20)
...
...
arkui/ace_ets_component_two/entry/src/main/config.json
浏览文件 @
dcf94a51
...
...
@@ -18,7 +18,7 @@
"name"
:
".MyApplication"
,
"mainAbility"
:
"com.open.harmony.acetesttwo.MainAbility"
,
"deviceType"
:
[
"default"
,
"default"
,
"phone"
],
"distro"
:
{
...
...
@@ -100,7 +100,8 @@
"pages/search"
,
"pages/scrollBar"
,
"pages/ohosRouterA"
,
"pages/ohosRouterB"
"pages/ohosRouterB"
,
"pages/WaterflowDemo"
],
"name"
:
".MainAbility"
,
"window"
:
{
...
...
arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/WaterFlowDataSource.ets
0 → 100644
浏览文件 @
dcf94a51
// 实现IDataSource接口的对象,用于瀑布流组件加载数据
export class WaterFlowDataSource implements IDataSource {
private dataArray: number[] = []
private listeners: DataChangeListener[] = []
constructor() {
for (let i = 0; i <= 100; i++) {
this.dataArray.push(i);
}
}
// 获取索引对应的数据
public getData(index: number): any {
return this.dataArray[index]
}
// 通知控制器数据重新加载
notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded()
})
}
// 通知控制器数据增加
notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
listener.onDataAdded(index)
})
}
// 通知控制器数据变化
notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChanged(index)
})
}
// 通知控制器数据删除
notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDeleted(index)
})
}
// 通知控制器数据位置变化
notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMoved(from, to)
})
}
// 获取数据总数
public totalCount(): number {
return this.dataArray.length
}
// 注册改变数据的控制器
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener)
}
}
// 注销改变数据的控制器
unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1)
}
}
// 增加数据
public Add1stItem(): void {
this.dataArray.splice(0, 0, this.dataArray.length)
this.notifyDataAdd(0)
}
// 在数据尾部增加一个元素
public AddLastItem(): void {
this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length)
this.notifyDataAdd(this.dataArray.length-1)
}
// 在指定索引位置增加一个元素
public AddItem(index: number): void {
this.dataArray.splice(index, 0, this.dataArray.length)
this.notifyDataAdd(index)
}
// 删除第一个元素
public Delete1stItem(): void {
this.dataArray.splice(0, 1)
this.notifyDataDelete(0)
}
// 删除第二个元素
public Delete2ndItem(): void {
this.dataArray.splice(1, 1)
this.notifyDataDelete(1)
}
// 删除最后一个元素
public DeleteLastItem(): void {
this.dataArray.splice(-1, 1)
this.notifyDataDelete(this.dataArray.length)
}
// 重新加载数据
public Reload(): void {
this.dataArray.splice(1, 1);
this.dataArray.splice(3, 2);
this.notifyDataReload();
}
}
\ No newline at end of file
arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/WaterflowDemo.ets
0 → 100644
浏览文件 @
dcf94a51
// WaterflowDemo.ets
import { WaterFlowDataSource } from './WaterFlowDataSource'
@Entry
@Component
struct WaterflowDemo {
@State minSize: number = 50
@State maxSize: number = 100
@State fontSize: number = 24
@State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]
scroller: Scroller = new Scroller();
datasource: WaterFlowDataSource = new WaterFlowDataSource();
// 计算flow item宽/高
getSize() {
let ret = Math.floor(Math.random() * this.maxSize)
return (ret > this.minSize ? ret : this.minSize)
}
@Builder itemFoot() {
Column() {
Text(`Footer`)
.fontSize(10)
.backgroundColor(Color.Red)
.width(50)
.height(50)
.align(Alignment.Center)
.margin({ top: 2 })
}
}
build() {
Column({ space: 2 }) {
WaterFlow({ footer: this.itemFoot, scroller: this.scroller }) {
LazyForEach(this.datasource, (item: number) => {
FlowItem() {
Column() {
Text("N" + item).fontSize(12).height('16')
Image('res/waterFlowTest(' + item % 5 + ').jpg')
.objectFit(ImageFit.Fill)
}
}
.width(this.getSize())
.height(this.getSize())
.backgroundColor(this.colors[item % 5])
}, item => item)
}
.columnsTemplate("1fr 1fr 1fr 1fr")
.itemConstraintSize({
minWidth: 0,
maxWidth: '100%',
minHeight: 0,
maxHeight: '100%'
})
.key('waterFlow')
.columnsGap(10)
.rowsGap(5)
.onReachStart(() => {
console.info("onReachStart")
})
.onReachEnd(() => {
console.info("onReachEnd")
})
.backgroundColor(0xFAEEE0)
.width('100%')
.height('80%')
.layoutDirection(FlexDirection.Column)
}
}
}
arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/navigation.ets
浏览文件 @
dcf94a51
...
...
@@ -132,7 +132,7 @@ struct NavigationExample {
.titleMode(NavigationTitleMode.Free)
.hideTitleBar(false)
.hideBackButton(false)
.onTitleModeChange
d
((titleModel: NavigationTitleMode) => {
.onTitleModeChange((titleModel: NavigationTitleMode) => {
console.log('titleMode')
})
.toolBar({ items: [
...
...
arkui/ace_ets_component_two/entry/src/main/ets/test/List.test.ets
浏览文件 @
dcf94a51
...
...
@@ -39,6 +39,8 @@ import flexDirectionJsunit from './FlexDirectionJsunit.test.ets';
import flexWrapJsunit from './FlexWrapJsunit.test.ets';
import datePickerJsunit from './DatePickerJsunit.test.ets';
import direction2Jsunit from './Direction2Jsunit.test.ets';
import waterFlowDemoJsunit from './waterFlowDemo.test.ets';
export default function testsuite() {
navigationJsunit();
...
...
@@ -68,4 +70,5 @@ export default function testsuite() {
rowJsunit();
systempromptJsunit();
sourceTypeJsunit();
waterFlowDemoJsunit();
}
\ No newline at end of file
arkui/ace_ets_component_two/entry/src/main/ets/test/waterFlowDemo.test.ets
0 → 100644
浏览文件 @
dcf94a51
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
import events_emitter from '@ohos.events.emitter';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets'
export default function waterFlowDemoJsunit() {
describe('waterFlowDemoTest', function () {
beforeAll(async function (done) {
console.info("waterFlow beforeEach start");
let options = {
uri: 'pages/WaterflowDemo',
}
try {
router.clear();
let pages = router.getState();
console.info("get waterflowDemo state success " + JSON.stringify(pages));
if (!("waterflowDemo" == pages.name)) {
console.info("get waterflowDemo state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push waterflowDemo page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push waterflowDemo page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("waterflowDemo after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name waterflowTest0001
* @tc.desic 'waterflowTest0001
*/
it('waterflowTest0001', 0, async function (done) {
console.info('waterflowDemo testalphabetIndexerWidth0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('waterFlow');
console.info("[waterflowTest0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('WaterFlow');
done();
});
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录