未验证 提交 6eb73f09 编写于 作者: O openharmony_ci 提交者: Gitee

!2610 add ace component

Merge pull request !2610 from 张绕/OpenHarmony-3.1-Release
......@@ -9,13 +9,16 @@
# 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.
# limitations under the License.
group("ace") {
testonly = true
deps = [
"ace_ets_component:AceEtsComponentTest",
"ace_ets_component:AceEtsComponentTest",
"ace_ets_component_five:AceEtsComponentFiveTest",
"ace_ets_component_four:AceEtsComponentFourTest",
"ace_ets_component_three:AceEtsComponentThreeTest",
"ace_ets_component_two:AceEtsComponentTwoTest",
"ace_ets_standard:ActsAceEtsStTest",
"ace_ets_test:ActsAceEtsTest",
"ace_ets_third_test:ActsAceEtsThirdTest",
......
......@@ -9,7 +9,7 @@
# 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.
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
......
......@@ -59,149 +59,27 @@
},
"pages": [
"pages/index",
"pages/toggle",
"pages/actionSheet",
"pages/gauge",
"pages/appear",
"pages/areaChange",
"pages/ellipse",
"pages/systemRouterA",
"pages/systemRouterB",
"pages/marquee",
"pages/stepper",
"pages/list",
"pages/general-properties/sizeSetting",
"pages/general-properties/positionSetting",
"pages/general-properties/shapeClipping",
"pages/general-properties/opacitySetting",
"pages/swiper",
"pages/enable",
"pages/general-properties/clickEvent",
"pages/general-properties/layoutConstraints",
"pages/general-properties/colorGradient",
"pages/areaChange",
"pages/general-properties/textStyle",
"pages/appear",
"pages/flex",
"pages/gauge",
"pages/global",
"pages/gridContainer",
"pages/gridSettings",
"pages/imageEffects",
"pages/layoutConstraints",
"pages/list",
"pages/marquee",
"pages/overlay",
"pages/general-properties/visibility",
"pages/zIndex",
"pages/general-properties/touchAble",
"pages/general-properties/imageEffects",
"pages/general-properties/transForm",
"pages/general-properties/touchAble",
"pages/general-properties/gridSettings",
"pages/general-properties/touch",
"pages/general-properties/border",
"pages/general-properties/flex",
"pages/swiper",
"pages/gridPage",
"pages/span",
"pages/text",
"pages/badge",
"pages/canvas",
"pages/longPressGesture",
"pages/badge",
"pages/button",
"pages/gridPage",
"pages/general-properties/touchAble",
"pages/stepper",
"pages/swiper",
"pages/general-properties/visibility",
"pages/general-properties/ResponseRegion",
"pages/general-properties/PanGesture",
"pages/QrCode",
"pages/tabs",
"pages/tapGesture",
"pages/progress",
"pages/animate",
"pages/column",
"pages/rating",
"pages/canvas2",
"pages/shape",
"pages/motionPath",
"pages/scrollCode",
"pages/transition",
"pages/priorityGesture",
"pages/parallelGesture",
"pages/alertDialog",
"pages/blank",
"pages/sharedTransition",
"pages/sharedTransition2",
"pages/alphabetIndexer",
"pages/line",
"pages/circle",
"pages/aboutToDisappear",
"pages/timeStamp",
"pages/bindMenu",
"pages/bindPopup",
"pages/gridContainer",
"pages/direction",
"pages/divider",
"pages/listItem",
"pages/systemPrompt",
"pages/configuration",
"pages/sourceType",
"pages/NavigatorBackCode",
"pages/NavigatorCode",
"pages/NavigatorDetailCode",
"pages/PieceCode",
"pages/sourceType",
"pages/pageTransition",
"pages/pageTransition2",
"pages/scrollBar",
"pages/search",
"pages/pageTransition2",
"pages/lifecycle",
"pages/pageTransition2",
"pages/navigation",
"pages/stateStyle",
"pages/focus",
"pages/placement",
"pages/imageAnimator",
"pages/animationStatus",
"pages/sourceType",
"pages/curves",
"pages/gradientDirection",
"pages/enumsFlexAlign",
"pages/ohosRouterA",
"pages/ohosRouterB",
"pages/flexDirection",
"pages/flexWrap",
"pages/geometryTransition",
"pages/keyEvent",
"pages/enumsHorizontalAlign",
"pages/enumsVerticalAlign",
"pages/datePicker",
"pages/dragEvent",
"pages/direction2",
"pages/barState",
"pages/patternLock",
"pages/enumsImage",
"pages/slider",
"pages/edgeEffect",
"pages/appStorage",
"pages/checkbox",
"pages/checkboxGroup",
"pages/customDialogController",
"pages/select",
"pages/ohosMatrix4",
"pages/ohosPrompt",
"pages/select",
"pages/video",
"pages/refresh",
"pages/richText",
"pages/row",
"pages/textTimer",
"pages/textPickerDialog",
"pages/path",
"pages/edgeEffect",
"pages/enumsLineCapStyle",
"pages/pinchGestureInterface",
"pages/rotationGestureInterface",
"pages/gestureGroupInterface",
"pages/enumsItemAlign",
"pages/fillMode",
"pages/playMode",
"pages/swipeDirection",
"pages/gestureMode",
"pages/panDirection"
"pages/textStyle",
"pages/touchAble",
"pages/touch",
"pages/visibility",
"pages/zIndex"
],
"name": ".MainAbility",
"window": {
......
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......
// @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.
*/
@Entry
@Component
struct ActionSheetTest {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Button('Click to Show ActionSheet')
.fontSize(20)
.key("actionSheet")
.onClick(() => {
ActionSheet.show({
title: 'ActionSheet title',
message: 'message',
confirm: {
value: 'Confirm button',
action: () => {
console.log('Get Alert Dialog handled')
}
},
sheets: [
{
title: 'apples',
action: () => {
console.log('apples')
}
},
{
title: 'bananas',
action: () => {
console.log('bananas')
}
},
{
title: 'pears',
action: () => {
console.log('pears')
}
}
]
})
})
}.width('100%')
.height('100%')
}
}
// @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.
*/
@Entry
@Component
struct AlertDialogExample {
build() {
Column({ space: 5 }) {
Button('one button dialog')
.onClick(() => {
AlertDialog.show(
{
title: 'title',
message: 'text',
alignment: DialogAlignment.Center,
offset: {
dx: 100,
dy: 100
},
confirm: {
value: 'button',
action: () => {
console.info('Button-clicking callback')
}
},
cancel: () => {
console.info('Closed callbacks')
}
}
)
})
.backgroundColor(0x317aff)
Button('two button dialog')
.onClick(() => {
AlertDialog.show(
{
title: 'title',
message: 'text',
primaryButton: {
value: 'cancel',
action: () => {
console.info('Callback when the first button is clicked')
}
},
secondaryButton: {
value: 'ok',
action: () => {
console.info('Callback when the second button is clicked')
}
},
cancel: () => {
console.info('Closed callbacks')
}
}
)
}).backgroundColor(0x317aff)
}.width('100%').margin({ top: 5 })
}
}
// @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 AlphabetIndexerSample {
private value: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
@State color: Color = Color.Red;
@State fontSize: string = 20;
@State fontWeight: FontWeight = FontWeight.Bolder;
@State fontFamily: string = 'sans-serif';
@State fontStyle: FontStyle = FontStyle.Italic;
@State offSetX: number = 10
@State offSetY: number = 10
build() {
AlphabetIndexer({ arrayValue: this.value, selected: 0 })
.selectedColor(0xffffff)
.selectedIndex(0)
.popupColor(0xFFFAF0)
.selectedBackgroundColor(0xCCCCCC)
.popupBackground(0xD2B48C)
.usingPopup(true)
.selectedFont({ size: 16, weight: FontWeight.Bolder })
.popupFont({ size: 30, weight: FontWeight.Bolder })
.itemSize(28)
.alignStyle(IndexerAlign.Left)
.popupPosition({offsetX: this.offSetX,offsetY: this.offSetY})
.onPopupSelected((index: number) =>{
console.info('index on action')
})
.onSelected((index: number) => {
console.info(this.value[index] + 'is choosen');
})
.onRequestPopupData((index: number) =>{
return this.value
})
.margin({ left: 50 })
.font({size: this.fontSize, weight: this.fontWeight, family: this.fontFamily, style: this.fontStyle })
.color(this.color)
.key('alphabetIndexer')
}
onPageShow() {
console.info('alphabetIndexer page show called');
var stateChangeEvent = {
eventId: 71,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("alphabetIndexer page state change called:" + JSON.stringify(eventData));
let font = JSON.parse(eventData.data.font);
if(font) {
this.fontSize = font.size;
this.fontWeight = font.weight;
this.fontFamily = font.family;
this.fontStyle = font.style;
}
}
}
}
// @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 AppStorageExp {
@State countDownStartValue: number = 10 // 10 Nuggets default start value in a Game
build() {
Column() {
Text(`Grant ${this.countDownStartValue} nuggets to play.`)
Button() {
Text('+1 - Nuggets in New Game')
}.onClick(() => {
this.countDownStartValue += 1
})
Button() {
Text('-1 - Nuggets in New Game')
}.onClick(() => {
this.countDownStartValue -= 1
})
// 创建子组件时,必须在构造函数参数中提供其@Prop变量的初始值,同时初始化常规变量CostOfOneAttump(非Prop)
CountDownComponent({ count: this.countDownStartValue, costOfOneAttempt: 2 })
}
}
}
@Component
struct CountDownComponent {
@Prop count: number
private costOfOneAttempt: number
build() {
Column() {
if (this.count > 0) {
Text(`You have ${this.count} Nuggets left`)
} else {
Text('Game over!')
}
Button() {
Text('Try again')
}.onClick(() => {
this.count -= this.costOfOneAttempt
})
}
}
}
\ No newline at end of file
// @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'
import prompt from '@system.prompt'
@Entry
@Preview
@Component
struct AppearExample {
@State isShow: boolean = true
@State appearFlag: boolean = false
@State disAppearFlag: boolean = false
private changeAppear: string = 'Hide Text'
private myText: string = 'Text for onAppear'
onPageShow() {
console.info('[appear] page show called');
var stateChangeEvent = {
eventId: 15,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
private stateChangCallBack = (eventData) => {
console.info("[appear] page stateChangCallBack");
if (eventData != null) {
console.info("[appear] page state change called:" + JSON.stringify(eventData));
if(eventData.data.isShow != null) {
this.isShow = eventData.data.isShow;
}
}
}
build() {
Column() {
Button(this.changeAppear)
.key('appear')
.onClick(() => {
this.isShow = !this.isShow
}).margin(3).backgroundColor(0x2788D9)
if (this.isShow) {
Text(this.myText)
.onAppear(() => {
this.appearFlag = true
this.changeAppear = 'Show Text'
console.info('appearFlag current action state is: ' + this.appearFlag);
prompt.showToast({ message: 'The text is shown', duration: 2000 })
try{
var backData = {
data: {
"ACTION": this.appearFlag,
}
}
var backEvent = {
eventId: 15,
priority: events_emitter.EventPriority.LOW
}
console.info("appearFlag start to emit action state")
events_emitter.emit(backEvent, backData)
}catch{
console.info("appearFlag emit action state err: " + JSON.stringify(err.message))
}
})
.onDisAppear(() => {
this.disAppearFlag = true
this.changeAppear = 'Hide Text'
console.info('disAppearFlag current action state is: ' + this.disAppearFlag);
prompt.showToast({ message: 'The text is hidden', duration: 2000 })
try{
var backData = {
data: {
"ACTION": this.disAppearFlag,
}
}
var backEvent = {
eventId: 16,
priority: events_emitter.EventPriority.LOW
}
console.info("disAppearFlag start to emit action state")
events_emitter.emit(backEvent, backData)
}catch{
console.info("disAppearFlag emit action state err: " + JSON.stringify(err.message))
}
})
}
}.padding(30).width('100%')
}
// @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.emitter'
import prompt from '@system.prompt'
@Entry
@Preview
@Component
struct AppearExample {
@State isShow: boolean = true
@State appearFlag: boolean = false
@State disAppearFlag: boolean = false
private changeAppear: string = 'Hide Text'
private myText: string = 'Text for onAppear'
onPageShow() {
console.info('[appear] page show called');
var stateChangeEvent = {
eventId: 58,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
private stateChangCallBack = (eventData) => {
console.info("[appear] page stateChangCallBack");
if (eventData != null) {
console.info("[appear] page state change called:" + JSON.stringify(eventData));
if(eventData.data.isShow != null) {
this.isShow = eventData.data.isShow;
}
}
}
build() {
Column() {
Button(this.changeAppear)
.key('appear')
.onClick(() => {
this.isShow = !this.isShow
}).margin(3).backgroundColor(0x2788D9)
if (this.isShow) {
Text(this.myText)
.onAppear(() => {
this.appearFlag = true
this.changeAppear = 'Show Text'
console.info('appearFlag current action state is: ' + this.appearFlag);
prompt.showToast({ message: 'The text is shown', duration: 2000 })
try{
var backData = {
data: {
"ACTION": this.appearFlag,
}
}
var backEvent = {
eventId: 59,
priority: events_emitter.EventPriority.LOW
}
console.info("appearFlag start to emit action state")
events_emitter.emit(backEvent, backData)
}catch{
console.info("appearFlag emit action state err: " + JSON.stringify(err.message))
}
})
.onDisAppear(() => {
this.disAppearFlag = true
this.changeAppear = 'Hide Text'
console.info('disAppearFlag current action state is: ' + this.disAppearFlag);
prompt.showToast({ message: 'The text is hidden', duration: 2000 })
try{
var backData = {
data: {
"ACTION": this.disAppearFlag,
}
}
var backEvent = {
eventId: 60,
priority: events_emitter.EventPriority.LOW
}
console.info("disAppearFlag start to emit action state")
events_emitter.emit(backEvent, backData)
}catch{
console.info("disAppearFlag emit action state err: " + JSON.stringify(err.message))
}
})
}
}.padding(30).width('100%')
}
}
\ No newline at end of file
// @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 AreaExample {
@State value: string = 'Text';
@State size: string = '';
@State onActionCalled: boolean = false;
build() {
Column() {
Text(this.value)
.key('text1')
.backgroundColor(Color.Green)
.margin(30)
.fontSize(20)
.onClick(() => {
this.value = this.value + 'Text'
try {
var backData = {
data: {
"value": this.value,
}
}
var backEvent = {
eventId: 21,
priority: events_emitter.EventPriority.LOW
}
console.info("onClick start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("onClick emit action state err: " + JSON.stringify(err.message))
}
})
.onAreaChange((oldValue: Area, newValue: Area) => {
console.info(`Ace: on area change, oldValue is ${JSON.stringify(oldValue)} newvalue is ${JSON.stringify(newValue)}`)
this.size = JSON.stringify(newValue)
this.onActionCalled = true;
console.info('onAreaChange current action state is: ' + this.onActionCalled);
try {
var backData = {
data: {
"ACTION": this.onActionCalled,
}
}
var backEvent = {
eventId: 22,
priority: events_emitter.EventPriority.LOW
}
console.info("onAreaChange start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("onAreaChange emit action state err: " + JSON.stringify(err.message))
}
})
Text('new area is: \n' + this.size)
.key('text2')
.margin({ right: 30, left: 30 })
}
.width('100%').height('100%').margin({ top: 30 })
}
// @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.emitter';
@Entry
@Component
struct AreaExample {
@State value: string = 'Text';
@State size: string = '';
@State onActionCalled: boolean = false;
build() {
Column() {
Text(this.value)
.key('text1')
.backgroundColor(Color.Green)
.margin(30)
.fontSize(20)
.onClick(() => {
this.value = this.value + 'Text'
try {
var backData = {
data: {
"value": this.value,
}
}
var backEvent = {
eventId: 61,
priority: events_emitter.EventPriority.LOW
}
console.info("onClick start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("onClick emit action state err: " + JSON.stringify(err.message))
}
})
.onAreaChange((oldValue: Area, newValue: Area) => {
console.info(`Ace: on area change, oldValue is ${JSON.stringify(oldValue)} newvalue is ${JSON.stringify(newValue)}`)
this.size = JSON.stringify(newValue)
this.onActionCalled = true;
console.info('onAreaChange current action state is: ' + this.onActionCalled);
try {
var backData = {
data: {
"ACTION": this.onActionCalled,
}
}
var backEvent = {
eventId: 62,
priority: events_emitter.EventPriority.LOW
}
console.info("onAreaChange start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("onAreaChange emit action state err: " + JSON.stringify(err.message))
}
})
Text('new area is: \n' + this.size)
.key('text2')
.margin({ right: 30, left: 30 })
}
.width('100%').height('100%').margin({ top: 30 })
}
}
\ No newline at end of file
// @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 ScrollBarExample {
private scroller: Scroller = new Scroller()
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
build() {
Column() {
Stack({ alignContent: Alignment.End }) {
Scroll(this.scroller) {
Flex({ direction: FlexDirection.Column }) {
ForEach(this.arr, (item) => {
Row() {
Text(item.toString())
.width('90%')
.height(100)
.backgroundColor('#3366CC')
.borderRadius(15)
.fontSize(16)
.textAlign(TextAlign.Center)
.margin({ top: 5 })
}
}, item => item)
}.margin({ left: 52 })
}
.scrollBar(BarState.On)
.scrollable(ScrollDirection.Vertical)
ScrollBar({ scroller: this.scroller, direction: ScrollBarDirection.Vertical,state: BarState.Auto }) {
Text()
.width(30)
.height(100)
.borderRadius(10)
.backgroundColor('#C0C0C0')
}.width(30).backgroundColor('#ededed')
}
}
}
}
\ No newline at end of file
// @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.
*/
@Entry
@Component
struct ColumnExample {
build() {
Column({ space: 5 }) {
Text('space').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column({ space: 5 }) {
Column().width('100%').height(50).backgroundColor(0xAFEEEE)
Column().width('100%').height(50).backgroundColor(0x00FFFF).key('column')
}.width('90%').height(107).border({ width: 1 })
Text('alignItems(Start)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column() {
Column().width('50%').height(50).backgroundColor(0xAFEEEE)
Column().width('50%').height(50).backgroundColor(0x00FFFF)
}.alignItems(HorizontalAlign.Start).width('90%').border({ width: 1 })
Text('alignItems(End)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column() {
Column().width('50%').height(50).backgroundColor(0xAFEEEE)
Column().width('50%').height(50).backgroundColor(0x00FFFF)
}.alignItems(HorizontalAlign.End).width('90%').border({ width: 1 })
}.width('100%').padding({ top: 5 })
}
}
\ No newline at end of file
// @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 EllipseExample {
@State width: string = "200px";
@State height: string = "200px";
onPageShow() {
console.info('[ellipse] page show called');
var stateChangeEvent = {
eventId: 5,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
private stateChangCallBack = (eventData) => {
console.info("[ellipse] page stateChangCallBack");
if (eventData != null) {
console.info("[ellipse] page state change called:" + JSON.stringify(eventData));
if(eventData.data.width != null) {
this.width = eventData.data.width;
}
if(eventData.data.height != null) {
this.height = eventData.data.height;
}
}
}
build() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center,justifyContent: FlexAlign.Center}) {
Ellipse().width(`${this.width}`).height(`${this.height}`).key('ellipse')
}.width('100%').height('100%')
}
// @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.emitter';
@Entry
@Component
struct EllipseExample {
@State width: string = "200px";
@State height: string = "200px";
onPageShow() {
console.info('[ellipse] page show called');
var stateChangeEvent = {
eventId: 92,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
private stateChangCallBack = (eventData) => {
console.info("[ellipse] page stateChangCallBack");
if (eventData != null) {
console.info("[ellipse] page state change called:" + JSON.stringify(eventData));
if(eventData.data.width != null) {
this.width = eventData.data.width;
}
if(eventData.data.height != null) {
this.height = eventData.data.height;
}
}
}
build() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center,justifyContent: FlexAlign.Center}) {
Ellipse().width(`${this.width}`).height(`${this.height}`).key('ellipse')
}.width('100%').height('100%')
}
}
\ No newline at end of file
/**
* 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 EnabledExample {
@State enabled: boolean = true;
@State text: string = "enable";
onPageShow() {
console.info('[enabled] page show called ');
var stateChangeEvent = {
eventId: 82,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
private stateChangCallBack = (eventData) => {
console.info("[stateChangCallBack] stateChangCallBack ");
if (eventData != null) {
console.info("[stateChangCallBack] state change called: " + JSON.stringify(eventData));
if (eventData.data.enabled != null) {
this.enabled = eventData.data.enabled
}
if (eventData.data.text != null) {
this.text = eventData.data.text
}
}
}
build() {
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button('disable')
.enabled(false)
.backgroundColor(0x317aff)
.opacity(0.4)
Button(this.text)
.key('enabled')
.backgroundColor(0x317aff)
.enabled(this.enabled)
}
.width('100%')
.padding({ top: 5 })
}
// @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.emitter'
@Entry
@Component
struct EnabledExample {
@State enabled: boolean = true;
@State text: string = "enable";
onPageShow() {
console.info('[enabled] page show called ');
var stateChangeEvent = {
eventId: 93,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
private stateChangCallBack = (eventData) => {
console.info("[stateChangCallBack] stateChangCallBack ");
if (eventData != null) {
console.info("[stateChangCallBack] state change called: " + JSON.stringify(eventData));
if (eventData.data.enabled != null) {
this.enabled = eventData.data.enabled
}
if (eventData.data.text != null) {
this.text = eventData.data.text
}
}
}
build() {
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button('disable')
.enabled(false)
.backgroundColor(0x317aff)
.opacity(0.4)
Button(this.text)
.key('enabled')
.backgroundColor(0x317aff)
.enabled(this.enabled)
}
.width('100%')
.padding({ top: 5 })
}
}
\ No newline at end of file
// @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 FlexExample {
@State direction: FlexDirection = FlexDirection.Row
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("Flex page state change called:" + JSON.stringify(eventData));
if(eventData.data.flexBasis != null) {
this.flexBasis = eventData.data.flexBasis;
}
if(eventData.data.flexGrow != null) {
this.flexGrow = eventData.data.flexGrow;
}
if(eventData.data.flexShrink != null) {
this.flexShrink = eventData.data.flexShrink;
}
if(eventData.data.alignSelf != null) {
this.alignSelf = eventData.data.alignSelf;
}
}
}
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("Flex page state change called:" + JSON.stringify(eventData));
switch(eventData.data.alignSelf) {
case 'Auto':
this.alignSelf = ItemAlign.Auto;
break;
case 'Start':
this.alignSelf = ItemAlign.Start;
break;
case 'Center':
this.alignSelf = ItemAlign.Center;
break;
case 'End':
this.alignSelf = ItemAlign.End;
break;
case 'Stretch':
this.alignSelf = ItemAlign.Stretch;
break;
case 'Baseline':
this.alignSelf = ItemAlign.Baseline;
break;
default:
this.alignSelf = ItemAlign.Auto;
}
}
}
onPageShow() {
console.info('flex page show called');
var stateChangeEvent = {
eventId: 27,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
build() {
Column({ space: 5 }) {
Text('flexBasis').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex() {
Text('flexBasis("auto")')
.flexBasis('auto').key("flexBasis").width('60%').height(100).lineHeight(70)
.backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('flexBasis(100)')
.flexBasis('100').height(100).lineHeight(70)
.backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
}.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE)
Text('flexGrow').key("flexGrow").fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex() {
Text('flexGrow(2)')
.flexGrow(2).height(100).lineHeight(70)
.backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('flexGrow(1)')
.flexGrow(1).height(100).lineHeight(70)
.backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
}.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE)
Text('flexShrink').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ direction: FlexDirection.Row }) {
Text('flexShrink(0)')
.flexShrink(0).key("flexShrink").width('50%').height(100).lineHeight(70)
.backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('no flexShrink')
.width('40%').height(100).lineHeight(70).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('flexShrink(2)')
.flexShrink(2).width('40%').height(100) .lineHeight(70)
.backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
}.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE)
Text('alignSelf').key("alignSelf").fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Text('no alignSelf,height:80').width('33%').height(80)
.backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('alignSelf stretch')
.alignSelf(ItemAlign.Stretch).width('33%').height(80).lineHeight(70)
.backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('no alignSelf,height:100').width('34%').height(100)
.backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
}.key('flex').width('90%').height(120).padding(10).backgroundColor(0xAFEEEE)
}.width('100%').margin({ top: 5 })
}
// @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.emitter'
@Entry
@Component
struct FlexExample {
@State direction: FlexDirection = FlexDirection.Row
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("Flex page state change called:" + JSON.stringify(eventData));
if(eventData.data.flexBasis != null) {
this.flexBasis = eventData.data.flexBasis;
}
if(eventData.data.flexGrow != null) {
this.flexGrow = eventData.data.flexGrow;
}
if(eventData.data.flexShrink != null) {
this.flexShrink = eventData.data.flexShrink;
}
if(eventData.data.alignSelf != null) {
this.alignSelf = eventData.data.alignSelf;
}
}
}
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("Flex page state change called:" + JSON.stringify(eventData));
switch(eventData.data.alignSelf) {
case 'Auto':
this.alignSelf = ItemAlign.Auto;
break;
case 'Start':
this.alignSelf = ItemAlign.Start;
break;
case 'Center':
this.alignSelf = ItemAlign.Center;
break;
case 'End':
this.alignSelf = ItemAlign.End;
break;
case 'Stretch':
this.alignSelf = ItemAlign.Stretch;
break;
case 'Baseline':
this.alignSelf = ItemAlign.Baseline;
break;
default:
this.alignSelf = ItemAlign.Auto;
}
}
}
onPageShow() {
console.info('flex page show called');
var stateChangeEvent = {
eventId: 8,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
build() {
Column({ space: 5 }) {
Text('flexBasis').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex() {
Text('flexBasis("auto")')
.flexBasis('auto').key("flexBasis").width('60%').height(100).lineHeight(70)
.backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('flexBasis(100)')
.flexBasis('100').height(100).lineHeight(70)
.backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
}.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE)
Text('flexGrow').key("flexGrow").fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex() {
Text('flexGrow(2)')
.flexGrow(2).height(100).lineHeight(70)
.backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('flexGrow(1)')
.flexGrow(1).height(100).lineHeight(70)
.backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
}.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE)
Text('flexShrink').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ direction: FlexDirection.Row }) {
Text('flexShrink(0)')
.flexShrink(0).key("flexShrink").width('50%').height(100).lineHeight(70)
.backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('no flexShrink')
.width('40%').height(100).lineHeight(70).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('flexShrink(2)')
.flexShrink(2).width('40%').height(100) .lineHeight(70)
.backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
}.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE)
Text('alignSelf').key("alignSelf").fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Text('no alignSelf,height:80').width('33%').height(80)
.backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('alignSelf stretch')
.alignSelf(ItemAlign.Stretch).width('33%').height(80).lineHeight(70)
.backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('no alignSelf,height:100').width('34%').height(100)
.backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
}.key('flex').width('90%').height(120).padding(10).backgroundColor(0xAFEEEE)
}.width('100%').margin({ top: 5 })
}
}
\ No newline at end of file
// @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 GaugeExample {
@State gaugeValue: string = 50;
@State strokeWidthValue: string = 20;
@State startAngleValue: string = 210;
@State endAngleValue: string = 150;
@State colorValues: Array = [[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1], [0x9C554B, 1], [0xD94838, 1]];
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("gauge page state change called:" + JSON.stringify(eventData));
if(eventData.data.gaugeValue != null) {
this.gaugeValue = eventData.data.gaugeValue;
}
if(eventData.data.strokeWidthValue != null) {
this.strokeWidthValue = eventData.data.strokeWidthValue;
}
if(eventData.data.startAngleValue != null) {
this.startAngleValue = eventData.data.startAngleValue;
}
if(eventData.data.endAngleValue != null) {
this.endAngleValue = eventData.data.endAngleValue;
}
if(eventData.data.colorValues != null) {
this.colorValues = JSON.parse(eventData.data.colorValues);
}
}
}
onPageShow() {
console.info('gauge page show called');
var stateChangeEvent = {
eventId: 1,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
var stateChangeEventTwo = {
eventId: 2,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventTwo, this.stateChangCallBack);
}
build() {
Column() {
Gauge({ value: 0, min: 0, max: 100 })
.key("gauge")
.value(`${this.gaugeValue}`)
.startAngle(`${this.startAngleValue}`)
.endAngle(`${this.endAngleValue}`)
.colors(this.colorValues)
.strokeWidth(`${this.strokeWidthValue}`)
.width(200).height(200)
}.width('100%').margin({ top: 300 })
}
}
// @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.emitter';
@Entry
@Component
struct GaugeExample {
@State gaugeValue: string = 50;
@State strokeWidthValue: string = 20;
@State startAngleValue: string = 210;
@State endAngleValue: string = 150;
@State colorValues: Array = [[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1], [0x9C554B, 1], [0xD94838, 1]];
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("gauge page state change called:" + JSON.stringify(eventData));
if(eventData.data.gaugeValue != null) {
this.gaugeValue = eventData.data.gaugeValue;
}
if(eventData.data.strokeWidthValue != null) {
this.strokeWidthValue = eventData.data.strokeWidthValue;
}
if(eventData.data.startAngleValue != null) {
this.startAngleValue = eventData.data.startAngleValue;
}
if(eventData.data.endAngleValue != null) {
this.endAngleValue = eventData.data.endAngleValue;
}
if(eventData.data.colorValues != null) {
this.colorValues = JSON.parse(eventData.data.colorValues);
}
}
}
onPageShow() {
console.info('gauge page show called');
var stateChangeEvent = {
eventId: 102,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
var stateChangeEventTwo = {
eventId: 103,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventTwo, this.stateChangCallBack);
}
build() {
Column() {
Gauge({ value: 0, min: 0, max: 100 })
.key("gauge")
.value(`${this.gaugeValue}`)
.startAngle(`${this.startAngleValue}`)
.endAngle(`${this.endAngleValue}`)
.colors(this.colorValues)
.strokeWidth(`${this.strokeWidthValue}`)
.width(200).height(200)
}.width('100%').margin({ top: 300 })
}
}
// @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 ClickExample {
@State text: string = '';
@State onClickValue: boolean = false;
build() {
Column() {
Button('Click').backgroundColor(0x2788D9).width(200).height(100).fontSize(20)
.onClick((event: ClickEvent) => {
console.info(this.text = 'Click Point:' + '\n screenX:' + event.screenX + '\n screenY:' + event.screenY
+ '\n x :' + event.x + '\n y:' + event.y + '\ntarget:' + '\n component globalPos:('
+ event.target.area.globalPos.x + ',' + event.target.area.globalPos.y + ')\n width:'
+ event.target.area.width + '\n height:' + event.target.area.height);
this.onClickValue = true;
try {
var backData = {
data: {
"ACTION": this.onClickValue,
"event": JSON.stringify(event)
}
}
var backEvent = {
eventId: 30,
priority: events_emitter.EventPriority.LOW
}
console.info("click to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("click action state err: " + JSON.stringify(err.message))
}
}).key('button')
Text(this.text).padding(15).fontSize(20).key('text')
}.height(350).width('100%').padding(10)
}
}
\ No newline at end of file
// @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.
*/
@Entry
@Component
struct GestureGroupExample {
@State count: number = 0
@State offsetX: number = 0
@State offsetY: number = 0
@State borderStyle: BorderStyle = BorderStyle.Solid
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('sequence gesture\n' + 'LongPress onAction:' + this.count + '\nPanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY)
}.translate({ x: this.offsetX, y: this.offsetY, z: 5 })
.key('gestureGroup')
.height(100).width(200).padding(10).margin(80).border({ width: 1, style: this.borderStyle })
.gesture(
GestureGroup(GestureMode.Sequence,
LongPressGesture({ repeat: true })
.onAction((event: GestureEvent) => {
if (event.repeat) {this.count++}
console.log('LongPress onAction')
})
.onActionEnd(() => {
console.log('LongPress end')
}),
PanGesture({})
.onActionStart(() => {
this.borderStyle = BorderStyle.Dashed
console.log('pan start')
})
.onActionUpdate((event: GestureEvent) => {
this.offsetX = event.offsetX
this.offsetY = event.offsetY
console.log('pan update')
})
)
.onCancel(() => {
console.log('sequence gesture canceled')
})
)
}
}
\ No newline at end of file
// @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.
*/
@Entry
@Component
struct GlobalExample {
onPageShow() {
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Canvas(this.context)
.width('100%').height('40%').backgroundColor('#00ffff')
.onReady(() => {
this.context.imageSmoothingEnabled = false
this.testImageBitmapSize();
this.testOffscreenCanvas();
this.testImageData();
this.testImage();
})
}.width('100%').height('100%')
}
testImageBitmapSize() {
let img = new ImageBitmap("/images/bg.jpg");
let width = img.width;
let height = img.height;
this.context.imageSmoothingEnabled = false;
this.context.drawImage( img, 30, 950, 160, 100);
console.log("imagebitmap_width="+width);
console.log("imagebitmap_height="+height);
}
testOffscreenCanvas() {
var offscreen = new OffscreenCanvas(300, 300);
var offCanvas2 = offscreen.getContext("2d");
var img = new Image();
img.src = "/images/bg.jpg";
offCanvas2.drawImage(img, 0, 0, 100, 100);
var bitmap = offscreen.transferToImageBitmap();
this.ctx.transferFromImageBitmap(bitmap);
}
testImageData() {
var offscreen = new OffscreenCanvas(300, 300);
var offCanvas2 = offscreen.getContext("2d");
var imageData = offCanvas2.createImageData(100,100);
var imgData = imageData.data;
console.log("imageData_width="+imageData.width);
console.log("imageData_height="+imageData.height);
}
testImage(){
var img = new Image("/images/bg.jpg",100,100)
.onload(()=>{})
.onerror(()=>{});
console.log("img_width="+img.width);
console.log("img_height="+img.height);
}
}
\ No newline at end of file
// @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 GridContainerExample {
@State sizeType: SizeType = SizeType.XS;
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("gridContainer page state change called:" + JSON.stringify(eventData));
switch (eventData.data.sizeType) {
case 'Auto':
this.sizeType = SizeType.Auto;
break;
case 'XS':
this.sizeType = SizeType.XS;
break;
case 'SM':
this.sizeType = SizeType.SM;
break;
case 'MD':
this.sizeType = SizeType.MD;
break;
case 'LG':
this.sizeType = SizeType.LG;
break;
default:
this.sizeType = SizeType.Auto;
}
}
}
onPageShow() {
console.info('gridContainer page show called');
var stateChangeEvent = {
eventId: 7,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
build() {
Column({ space: 5 }) {
GridContainer({ columns: 12, sizeType: this.sizeType, gutter: 10, margin: 20 }) {
Row() {
Text('1')
.fontSize(20)
.useSizeType({
xs: { span: 6, offset: 0 },
sm: { span: 2, offset: 0 },
md: { span: 2, offset: 0 },
lg: { span: 2, offset: 0 }
})
.height(50)
.backgroundColor(0x4582B4)
.textAlign(TextAlign.Center)
Text('2')
.fontSize(20)
.useSizeType({
xs: { span: 2, offset: 6 },
sm: { span: 6, offset: 2 },
md: { span: 2, offset: 2 },
lg: { span: 2, offset: 2 }
})
.height(50)
.backgroundColor(0x00BFFF)
.textAlign(TextAlign.Center)
Text('3')
.fontSize(20)
.useSizeType({
xs: { span: 2, offset: 8 },
sm: { span: 2, offset: 8 },
md: { span: 6, offset: 4 },
lg: { span: 2, offset: 4 }
})
.height(50)
.backgroundColor(0x4682B4)
.textAlign(TextAlign.Center)
Text('4')
.fontSize(20)
.useSizeType({
xs: { span: 2, offset: 10 },
sm: { span: 2, offset: 10 },
md: { span: 2, offset: 10 },
lg: { span: 6, offset: 6 }
})
.height(50)
.backgroundColor(0x00BFFF)
.textAlign(TextAlign.Center)
}
}.width('90%').key('gridContainer').margin({ top: 300 })
}
}
// @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.emitter'
@Entry
@Component
struct GridContainerExample {
@State sizeType: SizeType = SizeType.XS;
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("gridContainer page state change called:" + JSON.stringify(eventData));
switch (eventData.data.sizeType) {
case 'Auto':
this.sizeType = SizeType.Auto;
break;
case 'XS':
this.sizeType = SizeType.XS;
break;
case 'SM':
this.sizeType = SizeType.SM;
break;
case 'MD':
this.sizeType = SizeType.MD;
break;
case 'LG':
this.sizeType = SizeType.LG;
break;
default:
this.sizeType = SizeType.Auto;
}
}
}
onPageShow() {
console.info('gridContainer page show called');
var stateChangeEvent = {
eventId: 109,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
build() {
Column({ space: 5 }) {
GridContainer({ columns: 12, sizeType: this.sizeType, gutter: 10, margin: 20 }) {
Row() {
Text('1')
.fontSize(20)
.useSizeType({
xs: { span: 6, offset: 0 },
sm: { span: 2, offset: 0 },
md: { span: 2, offset: 0 },
lg: { span: 2, offset: 0 }
})
.height(50)
.backgroundColor(0x4582B4)
.textAlign(TextAlign.Center)
Text('2')
.fontSize(20)
.useSizeType({
xs: { span: 2, offset: 6 },
sm: { span: 6, offset: 2 },
md: { span: 2, offset: 2 },
lg: { span: 2, offset: 2 }
})
.height(50)
.backgroundColor(0x00BFFF)
.textAlign(TextAlign.Center)
Text('3')
.fontSize(20)
.useSizeType({
xs: { span: 2, offset: 8 },
sm: { span: 2, offset: 8 },
md: { span: 6, offset: 4 },
lg: { span: 2, offset: 4 }
})
.height(50)
.backgroundColor(0x4682B4)
.textAlign(TextAlign.Center)
Text('4')
.fontSize(20)
.useSizeType({
xs: { span: 2, offset: 10 },
sm: { span: 2, offset: 10 },
md: { span: 2, offset: 10 },
lg: { span: 6, offset: 6 }
})
.height(50)
.backgroundColor(0x00BFFF)
.textAlign(TextAlign.Center)
}
}.width('90%').key('gridContainer').margin({ top: 300 })
}
}
}
\ No newline at end of file
// @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 GridSetting {
@State smSpan: number = 2;
@State smOffset: number = 1;
@State gridSpan: number = 1;
@State gridOffset: number = 0;
build(){
GridContainer({sizeType: SizeType.SM}) {
Row({}) {
Row() {
Text('Left').fontSize(25)
}
.gridOffset(this.gridOffset)
.height("100%")
.backgroundColor(0x66bbb2cb)
.key('gridOffset')
Row() {
Text('Center').fontSize(25)
}
.useSizeType({
xs: { span: 1, offset: 0 }, sm: { span: this.smSpan, offset: this.smOffset },
md: { span: 5, offset: 1 }, lg: { span: 7, offset: 2 }
})
.height("100%")
.backgroundColor(0x66b6c5d1)
.key('gridRow')
Row() {
Text('Right').fontSize(25)
}
.gridSpan(this.gridSpan)
.height("100%")
.backgroundColor(0x66bbb2cb)
.key('gridSpan')
}
.height(200)
}
.backgroundColor(0xf1f3f5)
.margin({ top: 10 })
.key('gridContainer')
}
onPageShow() {
let smChangeEvent = {
eventId: 45,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(smChangeEvent, this.stateChangCallBack);
let offsetChangeEvent = {
eventId: 46,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(offsetChangeEvent, this.stateChangCallBack);
let spanChangeEvent = {
eventId: 47,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(spanChangeEvent, this.stateChangCallBack);
}
stateChangCallBack = (eventData) => {
console.info("GridSetting page stateChangCallBack" + JSON.stringify(eventData));
if (eventData && eventData.data) {
if (eventData.data.span) {
this.smSpan = eventData.data.span;
this.smOffset = eventData.data.offset;
} else if (eventData.data.gridOffset) {
this.gridOffset = eventData.data.gridOffset;
} else if (eventData.data.gridSpan) {
this.gridSpan = eventData.data.gridSpan;
}
}
}
// @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.emitter'
@Entry
@Component
struct GridSetting {
@State smSpan: number = 2;
@State smOffset: number = 1;
@State gridSpan: number = 1;
@State gridOffset: number = 0;
build(){
GridContainer({sizeType: SizeType.SM}) {
Row({}) {
Row() {
Text('Left').fontSize(25)
}
.gridOffset(this.gridOffset)
.height("100%")
.backgroundColor(0x66bbb2cb)
.key('gridOffset')
Row() {
Text('Center').fontSize(25)
}
.useSizeType({
xs: { span: 1, offset: 0 }, sm: { span: this.smSpan, offset: this.smOffset },
md: { span: 5, offset: 1 }, lg: { span: 7, offset: 2 }
})
.height("100%")
.backgroundColor(0x66b6c5d1)
.key('gridRow')
Row() {
Text('Right').fontSize(25)
}
.gridSpan(this.gridSpan)
.height("100%")
.backgroundColor(0x66bbb2cb)
.key('gridSpan')
}
.height(200)
}
.backgroundColor(0xf1f3f5)
.margin({ top: 10 })
.key('gridContainer')
}
onPageShow() {
let smChangeEvent = {
eventId: 9,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(smChangeEvent, this.stateChangCallBack);
let offsetChangeEvent = {
eventId: 10,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(offsetChangeEvent, this.stateChangCallBack);
let spanChangeEvent = {
eventId: 11,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(spanChangeEvent, this.stateChangCallBack);
}
stateChangCallBack = (eventData) => {
console.info("GridSetting page stateChangCallBack" + JSON.stringify(eventData));
if (eventData && eventData.data) {
if (eventData.data.span) {
this.smSpan = eventData.data.span;
this.smOffset = eventData.data.offset;
} else if (eventData.data.gridOffset) {
this.gridOffset = eventData.data.gridOffset;
} else if (eventData.data.gridSpan) {
this.gridSpan = eventData.data.gridSpan;
}
}
}
}
\ No newline at end of file
// @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.
*/
@Entry
@Component
struct HoverExample {
@State isHoverVal: boolean = false
@State hoverEffect1: HoverEffect = HoverEffect.Auto
@State hoverEffect2: HoverEffect = HoverEffect.Board
@State hoverEffect3: HoverEffect = HoverEffect.None
build() {
Column({ space: 5 }) {
Column({ space: 5 }) {
Text('Scale').fontSize(20).fontColor(Color.Gray).width('90%').position({ x: 0, y: 80 })
Column()
.width('80%').height(200).backgroundColor(Color.Gray)
.position({ x: 40, y: 120 })
.hoverEffect(this.hoverEffect1)
.key('bindContextMenu')
.onHover((isHover: boolean) => {
console.info('Scale' + isHover)
this.isHoverVal = isHover
})
Text('Board').fontSize(20).fontColor(Color.Gray).width('90%').position({ x: 0, y: 380 })
Column()
.width('80%').height(200).backgroundColor(Color.Gray)
.hoverEffect(this.hoverEffect2)
.position({ x: 40, y: 420 })
.onHover((isHover: boolean) => {
console.info('HoverEffect.Board')
this.isHoverVal = isHover
})
}
.hoverEffect(this.hoverEffect3)
.width('100%').height('100%').border({ width: 1 })
.onHover((isHover: boolean) => {
console.info('HoverEffect.None')
this.isHoverVal = isHover
})
}
}
}
\ No newline at end of file
// @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 ImageEffectsExample {
@State blurValue: string = 100;
@State backdropBlueValue: string= 30;
@State shadowValue: object= { radius: 10, color: Color.Gray, offsetX: 5, offsetY: 5 }
@State grayscaleValue: string= 10;
@State brightnessValue: string= 20;
@State saturateValue: string= 50;
@State contrastValue: string= 20;
@State invertValue: string= 10;
@State hueRotateValue: string= 10
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("imageEffects page state change called:" + JSON.stringify(eventData));
if (eventData.data.blurValue != null) {
this.blurValue = eventData.data.blurValue;
}
if (eventData.data.shadowValue != null) {
this.shadowValue = JSON.parse(eventData.data.shadowValue);
}
if (eventData.data.grayscaleValue != null) {
this.grayscaleValue = eventData.data.grayscaleValue;
}
if (eventData.data.brightnessValue != null) {
this.brightnessValue = eventData.data.brightnessValue;
}
if (eventData.data.saturateValue != null) {
this.saturateValue = eventData.data.saturateValue;
}
if (eventData.data.contrastValue != null) {
this.contrastValue = eventData.data.contrastValue;
}
if (eventData.data.invertValue != null) {
this.invertValue = eventData.data.invertValue;
}
if (eventData.data.hueRotateValue != null) {
this.hueRotateValue = eventData.data.hueRotateValue;
}
}
}
onPageShow() {
console.info('imageEffects page show called');
var stateChangeEvent = {
eventId: 40,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
var stateChangeEvent2 = {
eventId: 41,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent2, this.stateChangCallBack);
var stateChangeEvent3 = {
eventId: 42,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent3, this.stateChangCallBack);
var stateChangeEvent4 = {
eventId: 43,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent4, this.stateChangCallBack);
var stateChangeEvent5 = {
eventId: 44,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent5, this.stateChangCallBack);
var stateChangeEvent6 = {
eventId: 45,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent6, this.stateChangCallBack);
var stateChangeEvent7 = {
eventId: 46,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent7, this.stateChangCallBack);
var stateChangeEvent8 = {
eventId: 47,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent8, this.stateChangCallBack);
}
build() {
Column({ space: 10 }) {
Text('font blur').fontSize(15).fontColor(0xCCCCCC).width('90%')
Text('text')
.blur(this.blurValue)
.width('90%')
.height(40)
.fontSize(16)
.backgroundColor(0xF9CF93)
.padding({ left: 5 })
.key('centerRow')
Text('backdropBlur').fontSize(15).fontColor(0xCCCCCC).width('90%')
Text()
.width('90%')
.height(40)
.fontSize(16)
.backdropBlur(this.backdropBlueValue)
.backgroundImage('/images/download.png')
.backgroundImageSize({ width: 1200, height: 160 })
.key('centerRow2')
Text('shadow').fontSize(15).fontColor(0xCCCCCC).width('90%')
Image('/images/download.png')
.width('90%')
.height(40)
.shadow(this.shadowValue)
.key('centerRow3')
Text('grayscale').fontSize(15).fontColor(0xCCCCCC).width('90%')
Image('/images/download.png')
.width('90%')
.height(40)
.grayscale(`${this.grayscaleValue}`)
.key('centerRow4')
Text('brightness').fontSize(15).fontColor(0xCCCCCC).width('90%')
Image('/images/download.png').width('90%').height(40).brightness(this.brightnessValue).key('centerRow5')
Text('saturate').fontSize(15).fontColor(0xCCCCCC).width('90%')
Image('/images/download.png').width('90%').height(40).saturate(this.saturateValue).key('centerRow6')
Text('contrast').fontSize(15).fontColor(0xCCCCCC).width('90%')
Image('/images/download.png').width('90%').height(40).contrast(this.contrastValue).key('centerRow7')
Text('invert').fontSize(15).fontColor(0xCCCCCC).width('90%')
Image('/images/download.png').width('90%').height(40).invert(`${this.invertValue}`).key('centerRow8')
Text('hueRotate').fontSize(15).fontColor(0xCCCCCC).width('90%')
Image('/images/download.png').width('90%').height(40).hueRotate(`${this.hueRotateValue}`).key('centerRow9')
}.width('100%').margin({ top: 5 })
}
}
// @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.emitter'
@Entry
@Component
struct ImageEffectsExample {
@State blurValue: string = 100;
@State backdropBlueValue: string= 30;
@State shadowValue: object= { radius: 10, color: Color.Gray, offsetX: 5, offsetY: 5 }
@State grayscaleValue: string= 10;
@State brightnessValue: string= 20;
@State saturateValue: string= 50;
@State contrastValue: string= 20;
@State invertValue: string= 10;
@State hueRotateValue: string= 10
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("imageEffects page state change called:" + JSON.stringify(eventData));
if (eventData.data.blurValue != null) {
this.blurValue = eventData.data.blurValue;
}
if (eventData.data.shadowValue != null) {
this.shadowValue = JSON.parse(eventData.data.shadowValue);
}
if (eventData.data.grayscaleValue != null) {
this.grayscaleValue = eventData.data.grayscaleValue;
}
if (eventData.data.brightnessValue != null) {
this.brightnessValue = eventData.data.brightnessValue;
}
if (eventData.data.saturateValue != null) {
this.saturateValue = eventData.data.saturateValue;
}
if (eventData.data.contrastValue != null) {
this.contrastValue = eventData.data.contrastValue;
}
if (eventData.data.invertValue != null) {
this.invertValue = eventData.data.invertValue;
}
if (eventData.data.hueRotateValue != null) {
this.hueRotateValue = eventData.data.hueRotateValue;
}
}
}
onPageShow() {
console.info('imageEffects page show called');
var stateChangeEvent = {
eventId: 12,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
var stateChangeEvent2 = {
eventId: 13,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent2, this.stateChangCallBack);
var stateChangeEvent3 = {
eventId: 14,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent3, this.stateChangCallBack);
var stateChangeEvent4 = {
eventId: 15,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent4, this.stateChangCallBack);
var stateChangeEvent5 = {
eventId: 16,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent5, this.stateChangCallBack);
var stateChangeEvent6 = {
eventId: 17,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent6, this.stateChangCallBack);
var stateChangeEvent7 = {
eventId: 18,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent7, this.stateChangCallBack);
var stateChangeEvent8 = {
eventId: 19,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent8, this.stateChangCallBack);
}
build() {
Column({ space: 10 }) {
Text('font blur').fontSize(15).fontColor(0xCCCCCC).width('90%')
Text('text')
.blur(this.blurValue)
.width('90%')
.height(40)
.fontSize(16)
.backgroundColor(0xF9CF93)
.padding({ left: 5 })
.key('centerRow')
Text('backdropBlur').fontSize(15).fontColor(0xCCCCCC).width('90%')
Text()
.width('90%')
.height(40)
.fontSize(16)
.backdropBlur(this.backdropBlueValue)
.backgroundImage('/images/download.png')
.backgroundImageSize({ width: 1200, height: 160 })
.key('centerRow2')
Text('shadow').fontSize(15).fontColor(0xCCCCCC).width('90%')
Image('/images/download.png')
.width('90%')
.height(40)
.shadow(this.shadowValue)
.key('centerRow3')
Text('grayscale').fontSize(15).fontColor(0xCCCCCC).width('90%')
Image('/images/download.png')
.width('90%')
.height(40)
.grayscale(`${this.grayscaleValue}`)
.key('centerRow4')
Text('brightness').fontSize(15).fontColor(0xCCCCCC).width('90%')
Image('/images/download.png').width('90%').height(40).brightness(this.brightnessValue).key('centerRow5')
Text('saturate').fontSize(15).fontColor(0xCCCCCC).width('90%')
Image('/images/download.png').width('90%').height(40).saturate(this.saturateValue).key('centerRow6')
Text('contrast').fontSize(15).fontColor(0xCCCCCC).width('90%')
Image('/images/download.png').width('90%').height(40).contrast(this.contrastValue).key('centerRow7')
Text('invert').fontSize(15).fontColor(0xCCCCCC).width('90%')
Image('/images/download.png').width('90%').height(40).invert(`${this.invertValue}`).key('centerRow8')
Text('hueRotate').fontSize(15).fontColor(0xCCCCCC).width('90%')
Image('/images/download.png').width('90%').height(40).hueRotate(`${this.hueRotateValue}`).key('centerRow9')
}.width('100%').margin({ top: 5 })
}
}
// @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 file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets";
import testsuite from "../test/List.test.ets";
import featureAbility from "@ohos.ability.featureAbility";
@Entry
@Component
struct MyComponent {
aboutToAppear() {
console.info("start run testcase!!!!")
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
const reportExtend = new ReportExtend(file);
core.addService('report', reportExtend);
core.init();
core.subscribeEvent('task', reportExtend);
const configService = core.getDefaultService('config');
console.info('parameters---->' + JSON.stringify(Want.parameters));
configService.setConfig(Want.parameters);
testsuite();
core.execute();
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('ACE ETS TEST')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
// @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 file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets";
import testsuite from "../test/List.test.ets";
import featureAbility from "@ohos.ability.featureAbility";
@Entry
@Component
struct MyComponent {
aboutToAppear() {
console.info("start run testcase!!!!")
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
const reportExtend = new ReportExtend(file);
core.addService('report', reportExtend);
core.init();
core.subscribeEvent('task', reportExtend);
const configService = core.getDefaultService('config');
console.info('parameters---->' + JSON.stringify(Want.parameters));
configService.setConfig(Want.parameters);
testsuite();
core.execute();
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('ACE ETS TEST')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
// @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 KeyEventExample {
@State text: string = ''
@State textOne: string = ''
@State textTwo: string = ''
@State textThree: string = ''
@State eventType: string = ''
build() {
Column() {
Button('KeyEvent').backgroundColor(0x2788D9)
.onKeyEvent((event: KeyEvent) => {
if (event.type === KeyType.Down) {
this.eventType = 'Down'
}
if (event.type === KeyType.Up) {
this.eventType = 'Up'
}
if (event.type === keySource.Unknown) {
this.eventType = 'Unknown'
}
if (event.type === keySource.Keyboard) {
this.eventType = 'Keyboard'
}
console.info(this.text = 'KeyType:' + this.eventType + '\nkeyCode:' + event.keyCode + '\nkeyText:' + event.keyText)
console.info(this.textOne = 'KeySource:' + event.keySource + '\ndeviceId:' + event.deviceId + '\nmetaKey:' + event.metaKey + '\ntimeStamp:' + event.timestamp)
console.info(this.textTwo = 'KeyType:' + this.keySource + '\nkeyCode:' + event.keyCode + '\nkeyText:' + event.keyText)
console.info(this.textThree = 'KeyType:' + this.keySource + '\nkeyCode:' + event.keyCode + '\nkeyText:' + event.keyText)
stopPropagation: () => {
console.info('stopPropagation')
}
})
Text(this.text).padding(15)
}.height(300).width('100%').padding(35)
}
}
\ No newline at end of file
// @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';
class ContainerInfo {
label : string = ''
size : string = ''
};
class ChildInfo {
text : string = ''
priority : number = 0
};
@Entry
@Component
struct LayoutConstraints {
private children : string[] = ['1', '2', '3', '4', '5', '6'];
@State aspectRatio: number = 1.5;
private container: ContainerInfo[] = [
{label: 'Big container', size: '97%'},
{label: 'Small container', size: '30%'}];
@State priorityChildren: any[] = [
{text: '1\n(priority:1)', priority: 1},
{text: '2\n(priority:2)', priority: 2},
{text: '3\n(priority:3)', priority: 3},
{text: '4\n(priority:4)', priority: 4}];
@State currentIndex : number = 0;
build() {
Column({ space: 20 }) {
Text('using container: row').fontSize(20).fontColor(Color.Black).width('100%')
Row({space: 10}) {
ForEach(this.children, (item) => {
Text(item)
.backgroundColor(0xbbb2cb)
.fontSize(20)
.aspectRatio(this.aspectRatio)
.height(60)
Text(item)
.backgroundColor(0xbbb2cb)
.fontSize(20)
.aspectRatio(this.aspectRatio)
.width(60)
.key('aspectRatio')
}, item=>item)
}
.size({width: "100%", height: 100})
.backgroundColor(0xd2cab3)
.clip(true)
Text('using container: grid').fontSize(20).fontColor(Color.Black).width('100%')
Grid() {
ForEach(this.children, (item) => {
GridItem() {
Text(item)
.backgroundColor(0xbbb2cb)
.fontSize(40)
.aspectRatio(this.aspectRatio)
}
}, item=>item)
}
.columnsTemplate('1fr 1fr 1fr')
.columnsGap(10)
.rowsGap(10)
.size({width: "100%", height: 165})
.backgroundColor(0xd2cab3)
Text('displayPriority 4').fontSize(20).fontColor(Color.Black).width('100%')
Flex({justifyContent: FlexAlign.SpaceBetween}) {
ForEach(this.priorityChildren, (item)=>{
if (item.priority === 1 || item.priority === 5) {
Text(`1\n(priority:${item.priority})`)
.width(135)
.height(60)
.fontSize(18)
.textAlign(TextAlign.Center)
.backgroundColor(0xbbb2cb)
.displayPriority(item.priority)
.key('displayPriority')
} else {
Text(item.text)
.width(135)
.height(60)
.fontSize(18)
.textAlign(TextAlign.Center)
.backgroundColor(0xbbb2cb)
.displayPriority(item.priority)
}
}, item=>item.text)
}
.width(this.container[this.currentIndex].size)
.backgroundColor(0xd2cab3)
}.padding(10)
}
onPageShow() {
let aspectRatioChangeEvent = {
eventId: 26,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(aspectRatioChangeEvent, this.stateChangCallBack);
let priorityChangeEvent = {
eventId: 27,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(priorityChangeEvent, this.stateChangCallBack);
}
stateChangCallBack = (eventData) => {
console.info("LayoutConstraints page stateChangCallBack" + JSON.stringify(eventData));
if (eventData) {
if (eventData.data.aspectRatio) {
this.aspectRatio = eventData.data.aspectRatio;
} else if (eventData.data.displayPriority) {
let priority = JSON.parse(JSON.stringify(this.priorityChildren));
priority[0].priority = eventData.data.displayPriority;
this.priorityChildren = [];
this.priorityChildren = priority;
}
}
}
// @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.emitter';
class ContainerInfo {
label : string = ''
size : string = ''
};
class ChildInfo {
text : string = ''
priority : number = 0
};
@Entry
@Component
struct LayoutConstraints {
private children : string[] = ['1', '2', '3', '4', '5', '6'];
@State aspectRatio: number = 1.5;
private container: ContainerInfo[] = [
{label: 'Big container', size: '97%'},
{label: 'Small container', size: '30%'}];
@State priorityChildren: any[] = [
{text: '1\n(priority:1)', priority: 1},
{text: '2\n(priority:2)', priority: 2},
{text: '3\n(priority:3)', priority: 3},
{text: '4\n(priority:4)', priority: 4}];
@State currentIndex : number = 0;
build() {
Column({ space: 20 }) {
Text('using container: row').fontSize(20).fontColor(Color.Black).width('100%')
Row({space: 10}) {
ForEach(this.children, (item) => {
Text(item)
.backgroundColor(0xbbb2cb)
.fontSize(20)
.aspectRatio(this.aspectRatio)
.height(60)
Text(item)
.backgroundColor(0xbbb2cb)
.fontSize(20)
.aspectRatio(this.aspectRatio)
.width(60)
.key('aspectRatio')
}, item=>item)
}
.size({width: "100%", height: 100})
.backgroundColor(0xd2cab3)
.clip(true)
Text('using container: grid').fontSize(20).fontColor(Color.Black).width('100%')
Grid() {
ForEach(this.children, (item) => {
GridItem() {
Text(item)
.backgroundColor(0xbbb2cb)
.fontSize(40)
.aspectRatio(this.aspectRatio)
}
}, item=>item)
}
.columnsTemplate('1fr 1fr 1fr')
.columnsGap(10)
.rowsGap(10)
.size({width: "100%", height: 165})
.backgroundColor(0xd2cab3)
Text('displayPriority 4').fontSize(20).fontColor(Color.Black).width('100%')
Flex({justifyContent: FlexAlign.SpaceBetween}) {
ForEach(this.priorityChildren, (item)=>{
if (item.priority === 1 || item.priority === 5) {
Text(`1\n(priority:${item.priority})`)
.width(135)
.height(60)
.fontSize(18)
.textAlign(TextAlign.Center)
.backgroundColor(0xbbb2cb)
.displayPriority(item.priority)
.key('displayPriority')
} else {
Text(item.text)
.width(135)
.height(60)
.fontSize(18)
.textAlign(TextAlign.Center)
.backgroundColor(0xbbb2cb)
.displayPriority(item.priority)
}
}, item=>item.text)
}
.width(this.container[this.currentIndex].size)
.backgroundColor(0xd2cab3)
}.padding(10)
}
onPageShow() {
let aspectRatioChangeEvent = {
eventId: 20,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(aspectRatioChangeEvent, this.stateChangCallBack);
let priorityChangeEvent = {
eventId: 21,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(priorityChangeEvent, this.stateChangCallBack);
}
stateChangCallBack = (eventData) => {
console.info("LayoutConstraints page stateChangCallBack" + JSON.stringify(eventData));
if (eventData) {
if (eventData.data.aspectRatio) {
this.aspectRatio = eventData.data.aspectRatio;
} else if (eventData.data.displayPriority) {
let priority = JSON.parse(JSON.stringify(this.priorityChildren));
priority[0].priority = eventData.data.displayPriority;
this.priorityChildren = [];
this.priorityChildren = priority;
}
}
}
}
\ No newline at end of file
// @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 EllipseExample {
onActive(){
console.log("lifecycle-->onActive")
}
onInactive(){
console.log("lifecycle-->onInactive")
}
onShow(){
console.log("lifecycle-->onShow")
}
onCastTempToNormal(){
console.log("lifecycle-->onCastTempToNormal")
}
onVisibilityChanged(){
console.log("lifecycle-->onVisibilityChanged")
}
onTriggerEvent(){
console.log("lifecycle-->onTriggerEvent")
}
onDelete(){
console.log("lifecycle-->onDelete")
}
onAcquireFormState(){
console.log("lifecycle-->onAcquireFormState")
}
onHide(){
console.log("lifecycle-->onHide")
}
onWindowDisplayModeChanged(){
console.log("lifecycle-->onWindowDisplayModeChanged")
}
onStartContinuation(){
console.log("lifecycle-->onStartContinuation")
}
onSaveData(){
console.log("lifecycle-->onSaveData")
}
onCompleteContinuation(){
console.log("lifecycle-->onCompleteContinuation")
}
onRestoreData(){
console.log("lifecycle-->onRestoreData")
}
onRemoteTerminated(){
console.log("lifecycle-->onRemoteTerminated")
}
onSaveAbilityState(){
console.log("lifecycle-->onSaveAbilityState")
}
onRestoreAbilityState(){
console.log("lifecycle-->onRestoreAbilityState")
}
onInactive(){
console.log("lifecycle-->onInactive")
}
onActive(){
console.log("lifecycle-->onActive")
}
onNewWant(){
console.log("lifecycle-->onNewWant")
}
onMemoryLevel(){
console.log("lifecycle-->onMemoryLevel")
}
onCommand(){
console.log("lifecycle-->onCommand")
}
onStop(){
console.log("lifecycle-->onStop")
}
onConnect(){
console.log("lifecycle-->onConnect")
}
onDisconnect(){
console.log("lifecycle-->onDisconnect")
}
onReconnect(){
console.log("lifecycle-->onReconnect")
}
update(){
console.log("lifecycle-->update")
}
normalizeUri(){
console.log("lifecycle-->normalizeUri")
}
batchInsert(){
console.log("lifecycle-->batchInsert")
}
denormalizeUri(){
console.log("lifecycle-->denormalizeUri")
}
openFile(){
console.log("lifecycle-->openFile")
}
getFileTypes(){
console.log("lifecycle-->getFileTypes")
}
onInitialized(){
console.log("lifecycle-->onInitialized")
}
getType(){
console.log("lifecycle-->getType")
}
build(){
Column(){
Button('click')
.key('button')
.backgroundColor('#FF0B8FE2')
.fontSize(20)
.margin({top: 20})
}
}
}
\ No newline at end of file
// @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 ListExample {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
@State listDirection: Axis = Axis.Vertical;
@State editMode: boolean = false;
@State edgeEffect: EdgeEffect = EdgeEffect.None;
@State chainAnimation: boolean = false;
@State strokeWidth: number = 2.000000;
@State color: string = 0xFFFFFF;
@State startMargin: number = 20.000000;
@State endMargin: number = 20.000000;
onPageShow() {
console.info('[list] page show called');
var stateChangeEvent = {
eventId: 80,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
var stateChangeEventTwo = {
eventId: 81,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventTwo, this.stateChangCallBackTwo);
}
private stateChangCallBack = (eventData) => {
console.info("[stateChangCallBack] stateChangCallBack");
if (eventData != null) {
console.info("[stateChangCallBack] state change called:" + JSON.stringify(eventData));
if(eventData.data.listDirection != null) {
this.listDirection = eventData.data.listDirection;
}
if(eventData.data.editMode != null) {
this.editMode = eventData.data.editMode;
}
if(eventData.data.edgeEffect != null) {
this.edgeEffect = eventData.data.edgeEffect;
}
if(eventData.data.chainAnimation != null) {
this.chainAnimation = eventData.data.chainAnimation;
}
}
}
private stateChangCallBackTwo = (eventData) => {
console.info("[stateChangCallBackTwo] stateChangCallBack");
if (eventData != null) {
console.info("[stateChangCallBackTwo] state change called:" + JSON.stringify(eventData));
if(eventData.data.strokeWidth != null) {
this.strokeWidth = eventData.data.strokeWidth;
}
if(eventData.data.color != null) {
this.color = eventData.data.color;
}
if(eventData.data.startMargin != null) {
this.startMargin = eventData.data.startMargin;
}
if(eventData.data.endMargin != null) {
this.endMargin = eventData.data.endMargin;
}
}
}
build() {
Stack({ alignContent: Alignment.TopStart }) {
Column() {
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item) => {
ListItem() {
Text('' + item)
.width('100%').height(100).fontSize(16)
.textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF)
}.editable(true)
}, item => item)
}
.key('list')
.listDirection(this.listDirection)
.divider({ strokeWidth: this.strokeWidth, color: this.color, startMargin: this.startMargin, endMargin: this.endMargin })
.edgeEffect(this.edgeEffect)
.chainAnimation(this.chainAnimation)
.multiSelectable(true)
.onScrollIndex((firstIndex: number, lastIndex: number) => {
console.info('first' + firstIndex)
console.info('last' + lastIndex)
})
.onScroll((scrollOffset: number, scrollState: ScrollState) => {
console.info('scrollOffset:' + scrollOffset)
console.info('scrollState:' + scrollState)
})
.editMode(this.editMode)
.onItemDelete((index: number) => {
console.info(this.arr[index] + 'Delete')
this.arr.splice(index, 1)
console.info(JSON.stringify(this.arr))
this.editFlag = false
return true
}).width('90%')
}.width('100%')
Button('edit list')
.onClick(() => {
this.editMode = !this.editMode
}).margin({ top: 5, left: 20 })
}.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 })
}
// @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.emitter';
@Entry
@Component
struct ListExample {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
@State listDirection: Axis = Axis.Vertical;
@State editMode: boolean = false;
@State edgeEffect: EdgeEffect = EdgeEffect.None;
@State chainAnimation: boolean = false;
@State strokeWidth: number = 2.000000;
@State color: string = 0xFFFFFF;
@State startMargin: number = 20.000000;
@State endMargin: number = 20.000000;
onPageShow() {
console.info('[list] page show called');
var stateChangeEvent = {
eventId: 124,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
var stateChangeEventTwo = {
eventId: 125,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventTwo, this.stateChangCallBackTwo);
}
private stateChangCallBack = (eventData) => {
console.info("[stateChangCallBack] stateChangCallBack");
if (eventData != null) {
console.info("[stateChangCallBack] state change called:" + JSON.stringify(eventData));
if(eventData.data.listDirection != null) {
this.listDirection = eventData.data.listDirection;
}
if(eventData.data.editMode != null) {
this.editMode = eventData.data.editMode;
}
if(eventData.data.edgeEffect != null) {
this.edgeEffect = eventData.data.edgeEffect;
}
if(eventData.data.chainAnimation != null) {
this.chainAnimation = eventData.data.chainAnimation;
}
}
}
private stateChangCallBackTwo = (eventData) => {
console.info("[stateChangCallBackTwo] stateChangCallBack");
if (eventData != null) {
console.info("[stateChangCallBackTwo] state change called:" + JSON.stringify(eventData));
if(eventData.data.strokeWidth != null) {
this.strokeWidth = eventData.data.strokeWidth;
}
if(eventData.data.color != null) {
this.color = eventData.data.color;
}
if(eventData.data.startMargin != null) {
this.startMargin = eventData.data.startMargin;
}
if(eventData.data.endMargin != null) {
this.endMargin = eventData.data.endMargin;
}
}
}
build() {
Stack({ alignContent: Alignment.TopStart }) {
Column() {
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item) => {
ListItem() {
Text('' + item)
.width('100%').height(100).fontSize(16)
.textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF)
}.editable(true)
}, item => item)
}
.key('list')
.listDirection(this.listDirection)
.divider({ strokeWidth: this.strokeWidth, color: this.color, startMargin: this.startMargin, endMargin: this.endMargin })
.edgeEffect(this.edgeEffect)
.chainAnimation(this.chainAnimation)
.multiSelectable(true)
.onScrollIndex((firstIndex: number, lastIndex: number) => {
console.info('first' + firstIndex)
console.info('last' + lastIndex)
})
.onScroll((scrollOffset: number, scrollState: ScrollState) => {
console.info('scrollOffset:' + scrollOffset)
console.info('scrollState:' + scrollState)
})
.editMode(this.editMode)
.onItemDelete((index: number) => {
console.info(this.arr[index] + 'Delete')
this.arr.splice(index, 1)
console.info(JSON.stringify(this.arr))
this.editFlag = false
return true
}).width('90%')
}.width('100%')
Button('edit list')
.onClick(() => {
this.editMode = !this.editMode
}).margin({ top: 5, left: 20 })
}.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 })
}
}
\ No newline at end of file
/**
* 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 MarqueeExample {
@State start: boolean = false
@State fromStart: boolean = true
@State step: number = 50
@State loop: number = 3
@State src: string = "Running Marquee starts rolling"
@State fontColor: Color = Color.Blue;
@State fontSize: number = 50;
@State onActionCalledThree: boolean = false;
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Marquee({
start: this.start,
step: this.step,
loop: this.loop,
fromStart: this.fromStart,
src: this.src
})
.key('marquee')
.fontColor(this.fontColor)
.colorBlend(Color.Green)
.fontSize(this.fontSize)
.allowScale(false)
.fontWeight(FontWeight.Bold)
.backgroundColor(Color.Black)
.margin({bottom:40})
.onStart(() => {
console.log('Marquee animation complete onStart')
console.info('Onstart current action state is: ' + this.fontColor);
try {
var backData = {
data: {
"fontColor": this.fontColor,
}
}
var backEvent = {
eventId: 11,
priority: events_emitter.EventPriority.LOW
}
console.info("Onstart start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("Onstart emit action state err: " + JSON.stringify(err.message))
}
})
.onBounce(() => {
console.log('Marquee animation complete onBounce')
console.info('Onbounce current action state is: ' + this.fontSize);
try {
var backData = {
data: {
"fontSize": this.fontSize,
}
}
var backEvent = {
eventId: 15,
priority: events_emitter.EventPriority.LOW
}
console.info("Onbounce start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("Onbounce emit action state err: " + JSON.stringify(err.message))
}
})
.onFinish(() => {
console.log('Marquee animation complete onFinish')
this.onActionCalledThree = true;
console.info('Onfinish current action state is: ' + this.onActionCalledThree);
try {
var backData = {
data: {
"ACTION": this.onActionCalledThree,
}
}
var backEvent = {
eventId: 16,
priority: events_emitter.EventPriority.LOW
}
console.info("Onfinish start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("Onfinish emit action state err: " + JSON.stringify(err.message))
}
})
Button('start')
.key('button')
.onClick(() => {
this.start = true
try {
var backData = {
data: {
"start": this.start,
}
}
var backEvent = {
eventId: 10,
priority: events_emitter.EventPriority.LOW
}
console.info("start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("emit action state err: " + JSON.stringify(err.message))
}
})
.width(200)
.height(60)
.margin({bottom:20})
}
.width('100%')
.height('100%')
}
// @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.emitter'
@Entry
@Component
struct MarqueeExample {
@State start: boolean = false
@State fromStart: boolean = true
@State step: number = 50
@State loop: number = 3
@State src: string = "Running Marquee starts rolling"
@State fontColor: Color = Color.Blue;
@State fontSize: number = 50;
@State onActionCalledThree: boolean = false;
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Marquee({
start: this.start,
step: this.step,
loop: this.loop,
fromStart: this.fromStart,
src: this.src
})
.key('marquee')
.fontColor(this.fontColor)
.colorBlend(Color.Green)
.fontSize(this.fontSize)
.allowScale(false)
.fontWeight(FontWeight.Bold)
.backgroundColor(Color.Black)
.margin({bottom:40})
.onStart(() => {
console.log('Marquee animation complete onStart')
console.info('Onstart current action state is: ' + this.fontColor);
try {
var backData = {
data: {
"fontColor": this.fontColor,
}
}
var backEvent = {
eventId: 127,
priority: events_emitter.EventPriority.LOW
}
console.info("Onstart start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("Onstart emit action state err: " + JSON.stringify(err.message))
}
})
.onBounce(() => {
console.log('Marquee animation complete onBounce')
console.info('Onbounce current action state is: ' + this.fontSize);
try {
var backData = {
data: {
"fontSize": this.fontSize,
}
}
var backEvent = {
eventId: 128,
priority: events_emitter.EventPriority.LOW
}
console.info("Onbounce start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("Onbounce emit action state err: " + JSON.stringify(err.message))
}
})
.onFinish(() => {
console.log('Marquee animation complete onFinish')
this.onActionCalledThree = true;
console.info('Onfinish current action state is: ' + this.onActionCalledThree);
try {
var backData = {
data: {
"ACTION": this.onActionCalledThree,
}
}
var backEvent = {
eventId: 129,
priority: events_emitter.EventPriority.LOW
}
console.info("Onfinish start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("Onfinish emit action state err: " + JSON.stringify(err.message))
}
})
Button('start')
.key('button')
.onClick(() => {
this.start = true
try {
var backData = {
data: {
"start": this.start,
}
}
var backEvent = {
eventId: 130,
priority: events_emitter.EventPriority.LOW
}
console.info("start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("emit action state err: " + JSON.stringify(err.message))
}
})
.width(200)
.height(60)
.margin({bottom:20})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
/**
* 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 OverlayExample {
@State title: string = 'old title'
@State x: number = 0
@State y: number = -15
@State Alignment: Alignment = Alignment.Bottom
onPageShow() {
console.info('[overlay] page show called ');
var stateChangeEvent = {
eventId: 83,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
private stateChangCallBack = (eventData) => {
console.info("[stateChangCallBack] stateChangCallBack ");
if (eventData != null) {
console.info("[stateChangCallBack] state change called: " + JSON.stringify(eventData));
if (eventData.data.title != null) {
this.title = eventData.data.title
}
if (eventData.data.x != null) {
this.x = eventData.data.x
}
if (eventData.data.y != null) {
this.y = eventData.data.y
}
if (eventData.data.align != null) {
this.Alignment = eventData.data.align
}
}
}
build() {
Column() {
Column() {
Text('floating layer')
.fontSize(12).fontColor(0xCCCCCC).maxLines(1)
Column() {
Image('/images/img.jpeg')
.width(340).height(240)
.key('overlay')
.overlay(this.title,
{ align: this.Alignment, offset: { x: this.x, y: this.y } })
}.border({ color: Color.Black, width: 2 })
}.width('100%')
}.padding({ top: 20 })
}
// @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.emitter'
@Entry
@Component
struct OverlayExample {
@State title: string = 'old title'
@State x: number = 0
@State y: number = -15
@State alignment: Alignment = Alignment.Bottom
onPageShow() {
console.info('[overlay] page show called ');
var stateChangeEvent = {
eventId: 143,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
private stateChangCallBack = (eventData) => {
console.info("[stateChangCallBack] stateChangCallBack ");
if (eventData != null) {
console.info("[stateChangCallBack] state change called: " + JSON.stringify(eventData));
if (eventData.data.align != null) {
this.alignment = eventData.data.align
}
if (eventData.data.title != null) {
this.title = eventData.data.title
}
if (eventData.data.x != null) {
this.x = eventData.data.x
}
if (eventData.data.y != null) {
this.y = eventData.data.y
}
}
}
build() {
Column() {
Column() {
Text('floating layer')
.fontSize(12).fontColor(0xCCCCCC).maxLines(1)
Column() {
Image('/images/img.jpeg')
.width(340).height(240)
.key('overlay')
.overlay(this.title,
{ align: this.alignment, offset: { x: this.x, y: this.y } })
}.border({ color: Color.Black, width: 2 })
}.width('100%')
}.padding({ top: 20 })
}
}
\ No newline at end of file
// @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.
*/
@Entry
@Component
struct PinchGestureExample {
@State scale: number = 1
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('PinchGesture scale:' + this.scale)
}
.key('pinchGesture')
.height(100).width(200).padding(20).border({ width: 1 }).margin(80)
.scale({ x: this.scale, y: this.scale, z: this.scale })
.gesture(
PinchGesture()
.onActionStart((event: GestureEvent) => {
console.info('Pinch start')
})
.onActionUpdate((event: GestureEvent) => {
this.scale = event.scale
})
.onActionEnd(() => {
console.info('Pinch end')
})
)
}
}
\ No newline at end of file
// @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.
*/
@Entry
@Component
struct RotationGestureExample {
@State angle: number = 0
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('RotationGesture angle:' + this.angle)
}
.key('rotationGesture')
.height(100).width(200).padding(20).border({ width:1 })
.margin(80).rotate({ x:1, y:2, z:3, angle: this.angle })
.gesture(
RotationGesture()
.onActionStart((event: GestureEvent) => {
console.log('Rotation start')
})
.onActionUpdate((event: GestureEvent) => {
this.angle = event.angle
})
.onActionEnd(() => {
console.log('Rotation end')
})
)
}
}
\ No newline at end of file
// @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 StyleExample {
@State isEnable: boolean = true
@Styles pressedStyles() {
.backgroundColor("#ED6F21")
.borderRadius(10)
.borderStyle(BorderStyle.Dashed)
.borderWidth(2)
.borderColor("#33000000")
.width(120)
.height(30)
.opacity(1)
}
@Styles disabledStyles() {
.backgroundColor("#E5E5E5")
.borderRadius(10)
.borderStyle(BorderStyle.Solid)
.borderWidth(2)
.borderColor("#2a4c1919")
.width(90)
.height(25)
.opacity(1)
}
@Styles normalStyles() {
.backgroundColor("#0A59F7")
.borderRadius(10)
.borderStyle(BorderStyle.Solid)
.borderWidth(2)
.borderColor("#33000000")
.width(100)
.height(25)
.opacity(1)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) {
Text("normal")
.fontSize(14)
.fontColor(Color.White)
.opacity(0.5)
.stateStyles({
normal: this.normalStyles,
})
.margin({ bottom: 20 })
.textAlign(TextAlign.Center)
Text("pressed")
.backgroundColor("#0A59F7")
.borderRadius(20)
.borderStyle(BorderStyle.Dotted)
.borderWidth(2)
.borderColor(Color.Red)
.width(100)
.height(25)
.opacity(1)
.fontSize(14)
.fontColor(Color.White)
.stateStyles({
pressed: this.pressedStyles,
})
.margin({ bottom: 20 })
.textAlign(TextAlign.Center)
Text(this.isEnable == true ? "effective" : "disabled")
.backgroundColor("#0A59F7")
.borderRadius(20)
.borderStyle(BorderStyle.Solid)
.borderWidth(2)
.borderColor(Color.Gray)
.width(100)
.height(25)
.opacity(1)
.fontSize(14)
.fontColor(Color.White)
.enabled(this.isEnable)
.stateStyles({
disabled: this.disabledStyles,
})
.textAlign(TextAlign.Center)
Text("control disabled")
.onClick(() => {
this.isEnable = !this.isEnable
console.log(`${this.isEnable}`)
})
}
.width(350).height(300)
}
}
\ No newline at end of file
/**
* 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 StepperExample {
@State currentIndex: number = 0
@State firstState: ItemState = ItemState.Normal
@State secondState: ItemState = ItemState.Normal
@State disabled: ItemState = ItemState.Normal
build() {
Stepper({
index: this.currentIndex
}) {
StepperItem() {
Text('Page One')
.fontSize(35)
.fontColor(Color.Blue)
.width(200)
.lineHeight(50)
.margin({top:250})
}
.nextLabel('')
.position({x: '35%', y: 0})
.key('stepperItem1')
StepperItem() {
Text('Page Two')
.fontSize(35)
.fontColor(Color.Blue)
.width(200)
.lineHeight(50)
.margin({top:250})
.key('text1')
.onClick(()=>{
this.firstState = this.firstState === ItemState.Skip ? ItemState.Normal : ItemState.Skip
})
}
.nextLabel('Next')
.prevLabel('Previous')
.status(this.firstState)
.position({x: '35%', y: 0})
.key('stepperItem2')
StepperItem() {
Text('Page Three')
.fontSize(35)
.fontColor(Color.Blue)
.width(200)
.lineHeight(50)
.margin({top:250})
.key('text2')
.onClick(()=>{
this.secondState = this.secondState === ItemState.Waiting ? ItemState.Normal : ItemState.Waiting
})
}
.position({x: '35%', y: 0})
.status(this.secondState)
.key('stepperItem3')
StepperItem() {
Text('Page four')
.fontSize(35)
.fontColor(Color.Blue)
.width(200)
.lineHeight(50)
.margin({top:250})
}
.position({x: '35%', y: 0})
.nextLabel('Finish')
.key('stepperItem4')
}
.onFinish(() => {
console.log('onFinish')
})
.onSkip(() => {
console.log('onSkip')
})
.onChange((prevIndex: number, index: number) => {
this.currentIndex = index
})
.align(Alignment.Center)
.key('stepper')
}
onPageShow() {
console.info('stepper page show called');
var stateChangeEvent = {
eventId: 12,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack)
}
private stateChangCallBack = (eventData) => {
console.info("stepper page stateChangCallBack" + JSON.stringify(eventData));
if (eventData != null) {
console.info("stepper page state change called:" + JSON.stringify(eventData));
if(eventData.data.currentIndex != null) {
this.currentIndex = parseInt(eventData.data.currentIndex);
}
if(eventData.data.disabled != null) {
this.disabled = eventData.data.disabled;
}
}
}
// @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.emitter'
@Entry
@Component
struct StepperExample {
@State currentIndex: number = 0
@State firstState: ItemState = ItemState.Normal
@State secondState: ItemState = ItemState.Normal
@State disabled: ItemState = ItemState.Normal
build() {
Stepper({
index: this.currentIndex
}) {
StepperItem() {
Text('Page One')
.fontSize(35)
.fontColor(Color.Blue)
.width(200)
.lineHeight(50)
.margin({top:250})
}
.nextLabel('')
.position({x: '35%', y: 0})
.key('stepperItem1')
StepperItem() {
Text('Page Two')
.fontSize(35)
.fontColor(Color.Blue)
.width(200)
.lineHeight(50)
.margin({top:250})
.key('text1')
.onClick(()=>{
this.firstState = this.firstState === ItemState.Skip ? ItemState.Normal : ItemState.Skip
})
}
.nextLabel('Next')
.prevLabel('Previous')
.status(this.firstState)
.position({x: '35%', y: 0})
.key('stepperItem2')
StepperItem() {
Text('Page Three')
.fontSize(35)
.fontColor(Color.Blue)
.width(200)
.lineHeight(50)
.margin({top:250})
.key('text2')
.onClick(()=>{
this.secondState = this.secondState === ItemState.Waiting ? ItemState.Normal : ItemState.Waiting
})
}
.position({x: '35%', y: 0})
.status(this.secondState)
.key('stepperItem3')
StepperItem() {
Text('Page four')
.fontSize(35)
.fontColor(Color.Blue)
.width(200)
.lineHeight(50)
.margin({top:250})
}
.position({x: '35%', y: 0})
.nextLabel('Finish')
.key('stepperItem4')
}
.onFinish(() => {
console.log('onFinish')
})
.onSkip(() => {
console.log('onSkip')
})
.onChange((prevIndex: number, index: number) => {
this.currentIndex = index
})
.align(Alignment.Center)
.key('stepper')
}
onPageShow() {
console.info('stepper page show called');
var stateChangeEvent = {
eventId: 202,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack)
}
private stateChangCallBack = (eventData) => {
console.info("stepper page stateChangCallBack" + JSON.stringify(eventData));
if (eventData != null) {
console.info("stepper page state change called:" + JSON.stringify(eventData));
if(eventData.data.currentIndex != null) {
this.currentIndex = parseInt(eventData.data.currentIndex);
}
if(eventData.data.disabled != null) {
this.disabled = eventData.data.disabled;
}
}
}
}
\ No newline at end of file
// @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 PanGestureExample {
@State offsetX: number = 0
@State offsetY: number = 0
@State direction: PanDirection = All
build() {
Flex({ direction: FlexDirection.Column, direction:this.direction, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('PanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY)
}
.key('swipeDirection')
.height(100).width(200).padding(20).border({ width: 1 }).margin(80)
.translate({ x: this.offsetX, y: this.offsetY, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: PanGestureEvent) => {
console.info('Pan start')
})
.onActionUpdate((event: PanGestureEvent) => {
this.offsetX = event.offsetX
this.offsetY = event.offsetY
})
.onActionEnd(() => {
console.info('Pan end')
})
)
}
onPageShow() {
console.info('panDirection page show called');
var stateChangeEvent = {
eventId: 167,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack)
}
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("panDirection page state change called:" + JSON.stringify(eventData));
if (eventData.data.direction != null) {
this.direction = eventData.data.direction;
}
}
}
}
\ No newline at end of file
// @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'
class MyDataSource implements IDataSource {
private list: number[] = []
private listener: DataChangeListener
constructor(list: number[]) {
this.list = list
}
totalCount(): number {
return this.list.length
}
getData(index: number): any {
return this.list[index]
}
registerDataChangeListener(listener: DataChangeListener): void {
this.listener = listener
}
unregisterDataChangeListener() {
}
}
@Entry
@Component
struct SwiperExample {
private swiperController: SwiperController = new SwiperController()
private data: MyDataSource = new MyDataSource([])
@State index: number = 1
@State autoPlay: boolean = true
@State interval: number = 4000
@State indicator: boolean = true
@State loop: boolean = false
@State duration: number = 1000
@State vertical: boolean = false
@State itemSpace: number = 0
@State onActionCalledOne: boolean = false;
@State onActionCalledTwo: boolean = false;
@State onActionCalledThree: boolean = false;
private aboutToAppear(): void {
let list = []
for (var i = 1; i <= 10; i++) {
list.push(i.toString());
}
this.data = new MyDataSource(list)
}
build() {
Column({ space: 5 }) {
Swiper(this.swiperController) {
LazyForEach(this.data, (item: string) => {
Text(item)
.width('90%')
.height(160)
.backgroundColor(0xAFEEEE)
.textAlign(TextAlign.Center)
.fontSize(20)
}, item => item)
}
.cachedCount(2)
.index(this.index)
.autoPlay(this.autoPlay)
.interval(this.interval)
.indicator(this.indicator)
.loop(this.loop)
.duration(this.duration)
.vertical(this.vertical)
.itemSpace(this.itemSpace)
.key('swiper')
.onChange((index: number) => {
console.info(index.toString())
this.onActionCalledThree = true;
console.info('onChange current action state is: ' + this.onActionCalledThree);
try {
var backData = {
data: {
"ACTION": this.onActionCalledThree,
}
}
var backEvent = {
eventId: 20,
priority: events_emitter.EventPriority.LOW
}
console.info("onChange start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("onChange emit action state err: " + JSON.stringify(err.message))
}
})
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button('next')
.key('button1')
.onClick(() => {
this.swiperController.showNext();
this.onActionCalledOne = true;
console.info('button1 current action state is: ' + this.onActionCalledOne);
try {
var backData = {
data: {
"ACTION": this.onActionCalledOne,
}
}
var backEvent = {
eventId: 18,
priority: events_emitter.EventPriority.LOW
}
console.info("button1 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("button1 emit action state err: " + JSON.stringify(err.message))
}
})
Button('preview')
.key('button2')
.onClick(() => {
this.swiperController.showPrevious()
this.onActionCalledTwo = true;
console.info('button2 current action state is: ' + this.onActionCalledTwo);
try {
var backData = {
data: {
"ACTION": this.onActionCalledTwo,
}
}
var backEvent = {
eventId: 19,
priority: events_emitter.EventPriority.LOW
}
console.info("button2 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("button2 emit action state err: " + JSON.stringify(err.message))
}
})
}
}.margin({ top: 5 })
}
onPageShow() {
console.info('swiper page show called');
var stateChangeEvent = {
eventId: 17,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack)
var stateChangeEventOne = {
eventId: 55,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventOne, this.stateChangCallBack)
var stateChangeEventTwo = {
eventId: 56,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventTwo, this.stateChangCallBack)
var stateChangeEventTwo = {
eventId: 57,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventTwo, this.stateChangCallBack)
}
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("swiper page state change called:" + JSON.stringify(eventData));
if (eventData.data.index != null) {
this.index = parseInt(eventData.data.index);
}
if (eventData.data.autoPlay != null) {
this.autoPlay = eventData.data.autoPlay;
}
if (eventData.data.interval != null) {
this.interval = parseInt(eventData.data.interval);
}
if (eventData.data.indicator != null) {
this.indicator = eventData.data.indicator;
}
if (eventData.data.loop != null) {
this.loop = eventData.data.loop;
}
if (eventData.data.duration != null) {
this.duration = parseInt(eventData.data.duration);
}
if (eventData.data.vertical != null) {
this.vertical = eventData.data.vertical;
}
if (eventData.data.itemSpace != null) {
this.itemSpace = parseInt(eventData.data.itemSpace);
}
}
}
// @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.emitter'
class MyDataSource implements IDataSource {
private list: number[] = []
private listener: DataChangeListener
constructor(list: number[]) {
this.list = list
}
totalCount(): number {
return this.list.length
}
getData(index: number): any {
return this.list[index]
}
registerDataChangeListener(listener: DataChangeListener): void {
this.listener = listener
}
unregisterDataChangeListener() {
}
}
@Entry
@Component
struct SwiperExample {
private swiperController: SwiperController = new SwiperController()
private data: MyDataSource = new MyDataSource([])
@State index: number = 1
@State displayCount: number = 3
@State displayMode: number = SwiperDisplayMode.AutoLinear
@State edgeEffect: number = EdgeEffect.None
@State autoPlay: boolean = true
@State interval: number = 4000
@State indicator: boolean = true
@State loop: boolean = false
@State duration: number = 1000
@State vertical: boolean = false
@State itemSpace: number = 0
@State onActionCalledOne: boolean = false;
@State onActionCalledTwo: boolean = false;
@State onActionCalledThree: boolean = false;
private aboutToAppear(): void {
let list = []
for (var i = 1; i <= 10; i++) {
list.push(i.toString());
}
this.data = new MyDataSource(list)
}
build() {
Column({ space: 5 }) {
Swiper(this.swiperController) {
LazyForEach(this.data, (item: string) => {
Text(item)
.width('90%')
.height(160)
.backgroundColor(0xAFEEEE)
.textAlign(TextAlign.Center)
.fontSize(20)
}, item => item)
}
.cachedCount(2)
.index(this.index)
.autoPlay(this.autoPlay)
.interval(this.interval)
.indicator(this.indicator)
.loop(this.loop)
.duration(this.duration)
.vertical(this.vertical)
.itemSpace(this.itemSpace)
.displayMode(this.displayMode)
.displayCount(this.displayCount)
.effectMode(this.edgeEffect)
.indicatorStyle({ top: 20, right: 20,size:2,color: Color.Blue})
.key('swiper')
.onChange((index: number) => {
console.info(index.toString())
this.onActionCalledThree = true;
console.info('onChange current action state is: ' + this.onActionCalledThree);
try {
var backData = {
data: {
"ACTION": this.onActionCalledThree,
}
}
var backEvent = {
eventId: 204,
priority: events_emitter.EventPriority.LOW
}
console.info("onChange start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("onChange emit action state err: " + JSON.stringify(err.message))
}
})
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button('next')
.key('button1')
.onClick(() => {
this.swiperController.showNext();
this.onActionCalledOne = true;
console.info('button1 current action state is: ' + this.onActionCalledOne);
try {
var backData = {
data: {
"ACTION": this.onActionCalledOne,
}
}
var backEvent = {
eventId: 205,
priority: events_emitter.EventPriority.LOW
}
console.info("button1 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("button1 emit action state err: " + JSON.stringify(err.message))
}
})
Button('preview')
.key('button2')
.onClick(() => {
this.swiperController.showPrevious()
this.onActionCalledTwo = true;
console.info('button2 current action state is: ' + this.onActionCalledTwo);
try {
var backData = {
data: {
"ACTION": this.onActionCalledTwo,
}
}
var backEvent = {
eventId: 206,
priority: events_emitter.EventPriority.LOW
}
console.info("button2 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("button2 emit action state err: " + JSON.stringify(err.message))
}
})
}
}.margin({ top: 5 })
}
onPageShow() {
console.info('swiper page show called');
var stateChangeEvent = {
eventId: 207,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack)
var stateChangeEventOne = {
eventId: 208,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventOne, this.stateChangCallBack)
var stateChangeEventTwo = {
eventId: 209,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventTwo, this.stateChangCallBack)
var stateChangeEventTwo = {
eventId: 210,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventTwo, this.stateChangCallBack)
}
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("swiper page state change called:" + JSON.stringify(eventData));
if (eventData.data.index != null) {
this.index = parseInt(eventData.data.index);
}
if (eventData.data.autoPlay != null) {
this.autoPlay = eventData.data.autoPlay;
}
if (eventData.data.interval != null) {
this.interval = parseInt(eventData.data.interval);
}
if (eventData.data.indicator != null) {
this.indicator = eventData.data.indicator;
}
if (eventData.data.loop != null) {
this.loop = eventData.data.loop;
}
if (eventData.data.duration != null) {
this.duration = parseInt(eventData.data.duration);
}
if (eventData.data.vertical != null) {
this.vertical = eventData.data.vertical;
}
if (eventData.data.itemSpace != null) {
this.itemSpace = parseInt(eventData.data.itemSpace);
}
}
}
}
\ No newline at end of file
// @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 TextStyle {
@State fontColor: Color = Color.Red;
@State fontSize: string = 20;
@State fontStyle: FontStyle = FontStyle.Italic;
@State fontWeight: string = 700;
@State fontFamily: string = 'sans-serif';
build() {
Column({ space: 20 }) {
Text('default text').fontSize(20)
Text(`text font color ${this.fontColor}`)
.fontColor(this.fontColor)
.fontSize(20)
.key('fontColor')
Text(`text font size ${this.fontSize}`)
.fontSize(this.fontSize)
.key('fontSize')
Text(`text font style ${this.fontStyle}`)
.fontStyle(this.fontStyle)
.fontSize(20)
.key('fontStyle')
Text(`text fontWeight ${this.fontWeight}`)
.fontWeight(this.fontWeight)
.fontSize(20)
.key('fontWeight')
Text(`text fontFamily ${this.fontFamily}`)
.fontFamily(this.fontFamily)
.fontSize(20)
.key('fontFamily')
Text('red 20 Italic bold cursive text')
.fontColor(Color.Red)
.fontSize(20)
.fontStyle(FontStyle.Italic)
.fontWeight(700)
.fontFamily('cursive')
.textAlign(TextAlign.Center)
.width('90%')
Text('Orange 18 Normal source-sans-pro text')
.fontColor(Color.Orange)
.fontSize(20)
.fontStyle(FontStyle.Normal)
.fontWeight(400)
.fontFamily('source-sans-pro,cursive,sans-serif')
}.width('100%').margin({top: 20})
}
onPageShow() {
let fontColorChangeEvent = {
eventId: 40,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(fontColorChangeEvent, this.textStyleChangCallBack);
let fontSizeChangeEvent = {
eventId: 41,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(fontSizeChangeEvent, this.textStyleChangCallBack);
let fontStyleChangeEvent = {
eventId: 42,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(fontStyleChangeEvent, this.textStyleChangCallBack);
let fontWeightChangeEvent = {
eventId: 43,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(fontWeightChangeEvent, this.textStyleChangCallBack);
let fontFamilyChangeEvent = {
eventId: 44,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(fontFamilyChangeEvent, this.textStyleChangCallBack);
}
textStyleChangCallBack = (eventData) => {
console.info("textStyle page stateChangCallBack" + JSON.stringify(eventData));
if (eventData && eventData.data) {
if (eventData.data.fontColor) {
this.fontColor = eventData.data.fontColor;
} else if (eventData.data.fontSize) {
this.fontSize = eventData.data.fontSize;
} else if (eventData.data.fontWeight) {
this.fontWeight = eventData.data.fontWeight;
} else if (eventData.data.fontFamily) {
this.fontFamily = eventData.data.fontFamily;
} else {
this.fontStyle = eventData.data.fontStyle;
}
}
}
// @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.emitter';
@Entry
@Component
struct TextStyle {
@State fontColor: Color = Color.Red;
@State fontSize: string = 20;
@State fontStyle: FontStyle = FontStyle.Italic;
@State fontWeight: string = 700;
@State fontFamily: string = 'sans-serif';
build() {
Column({ space: 20 }) {
Text('default text').fontSize(20)
Text(`text font color ${this.fontColor}`)
.fontColor(this.fontColor)
.fontSize(20)
.key('fontColor')
Text(`text font size ${this.fontSize}`)
.fontSize(this.fontSize)
.key('fontSize')
Text(`text font style ${this.fontStyle}`)
.fontStyle(this.fontStyle)
.fontSize(20)
.key('fontStyle')
Text(`text fontWeight ${this.fontWeight}`)
.fontWeight(this.fontWeight)
.fontSize(20)
.key('fontWeight')
Text(`text fontFamily ${this.fontFamily}`)
.fontFamily(this.fontFamily)
.fontSize(20)
.key('fontFamily')
Text('red 20 Italic bold cursive text')
.fontColor(Color.Red)
.fontSize(20)
.fontStyle(FontStyle.Italic)
.fontWeight(700)
.fontFamily('cursive')
.textAlign(TextAlign.Center)
.width('90%')
Text('Orange 18 Normal source-sans-pro text')
.fontColor(Color.Orange)
.fontSize(20)
.fontStyle(FontStyle.Normal)
.fontWeight(400)
.fontFamily('source-sans-pro,cursive,sans-serif')
}.width('100%').margin({top: 20})
}
onPageShow() {
let fontColorChangeEvent = {
eventId: 37,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(fontColorChangeEvent, this.textStyleChangCallBack);
let fontSizeChangeEvent = {
eventId: 38,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(fontSizeChangeEvent, this.textStyleChangCallBack);
let fontStyleChangeEvent = {
eventId: 39,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(fontStyleChangeEvent, this.textStyleChangCallBack);
let fontWeightChangeEvent = {
eventId: 40,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(fontWeightChangeEvent, this.textStyleChangCallBack);
let fontFamilyChangeEvent = {
eventId: 41,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(fontFamilyChangeEvent, this.textStyleChangCallBack);
}
textStyleChangCallBack = (eventData) => {
console.info("textStyle page stateChangCallBack" + JSON.stringify(eventData));
if (eventData && eventData.data) {
if (eventData.data.fontColor) {
this.fontColor = eventData.data.fontColor;
} else if (eventData.data.fontSize) {
this.fontSize = eventData.data.fontSize;
} else if (eventData.data.fontWeight) {
this.fontWeight = eventData.data.fontWeight;
} else if (eventData.data.fontFamily) {
this.fontFamily = eventData.data.fontFamily;
} else {
this.fontStyle = eventData.data.fontStyle;
}
}
}
}
\ No newline at end of file
// @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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
import Utils from '../Utils.ets';
export default function touchAbleJsunit() {
beforeEach(async function (done) {
console.info("touchAble beforeEach start");
let options = {
uri: 'pages/general-properties/touchAble',
}
try {
router.clear();
let pages = router.getState();
console.info("get touchAble state pages:" + JSON.stringify(pages));
if (!("touchAble" == pages.name)) {
console.info("get touchAble state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push touchAble page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push touchAble page error:" + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("touchAble after each called");
});
it('testTouchAble001', 0, async function (done) {
await Utils.sleep(1000)
let strJson = getInspectorByKey('ellipse');
let obj = JSON.parse(strJson);
console.info("[testTouchAble001] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.touchable).assertEqual(false);
done();
});
}
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册