diff --git a/ETSUI/ArkUIAnimation/README_zh.md b/ETSUI/ArkUIAnimation/README_zh.md index 47ca28557f05ecdb92c9658b386763756804cba0..0339cfd63b763786b03b62460110432dca984b8e 100644 --- a/ETSUI/ArkUIAnimation/README_zh.md +++ b/ETSUI/ArkUIAnimation/README_zh.md @@ -4,7 +4,7 @@ 本示例通过点击按钮触发动画,向用户展示属性动画与显式动画的效果。效果图如下: -  +  ### 相关概念 diff --git a/Preset/AirQuality/entry/src/main/ets/Common/Element.ets b/Preset/AirQuality/entry/src/main/ets/Common/Element.ets index babf1462e0b368f48a4212fd35dea5e285debc20..d16374e10c54884a40b788403c8bb7a668375871 100644 --- a/Preset/AirQuality/entry/src/main/ets/Common/Element.ets +++ b/Preset/AirQuality/entry/src/main/ets/Common/Element.ets @@ -18,10 +18,10 @@ export struct Element { @Builder dateText(text: string, margin: number) { Text(text) .height(100) - .width("14%") + .width("16%") .margin({ left: margin }) .textAlign(TextAlign.Center) - .fontSize(15) + .fontSize(12) } build() { diff --git a/Preset/AirQuality/entry/src/main/ets/MainAbility/MainAbility.ts b/Preset/AirQuality/entry/src/main/ets/MainAbility/MainAbility.ts index 28635defbe93a6e9e59f4f59206588a65a52b711..84720347fa442f32441a70d89e333c110a9640c7 100644 --- a/Preset/AirQuality/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/Preset/AirQuality/entry/src/main/ets/MainAbility/MainAbility.ts @@ -23,6 +23,7 @@ export default class MainAbility extends Ability { logger.info(TAG, `[Demo] MainAbility onCreate`) globalThis.abilityWant = want; globalThis.abilityContext = this.context + this.context.requestPermissionsFromUser(['ohos.permission.INTERNET']) } onDestroy() { diff --git a/Preset/AirQuality/entry/src/main/ets/pages/Detail.ets b/Preset/AirQuality/entry/src/main/ets/pages/Detail.ets index b3be186cfe53ab4bdf2b331c7c8719dc6739b6be..f955ac7e17e1642445fb4f2fff23636df8d01d80 100644 --- a/Preset/AirQuality/entry/src/main/ets/pages/Detail.ets +++ b/Preset/AirQuality/entry/src/main/ets/pages/Detail.ets @@ -23,7 +23,7 @@ import { AirQualityModel } from '../Model/AirQualityModel' @Extend(Text) function fancyText (backgroundColor: string, height: number, margin: number) { .backgroundColor(backgroundColor) .height(height) - .width('14%') + .width('16%') .margin({ left: margin }) } diff --git a/Preset/AirQuality/entry/src/main/module.json5 b/Preset/AirQuality/entry/src/main/module.json5 index 66e8481246b27cbbc4c50c985063191d53d46510..3b279854314f60b01d24e08ef540c01882b3ed32 100644 --- a/Preset/AirQuality/entry/src/main/module.json5 +++ b/Preset/AirQuality/entry/src/main/module.json5 @@ -35,5 +35,17 @@ "startWindowBackground": "$color:white" } ], + "requestPermissions": [ + { + "name": "ohos.permission.INTERNET", + "reason": "$string:internet_permission", + "usedScene": { + "abilities": [ + "MainAbility" + ], + "when": "inuse" + } + } + ] } } \ No newline at end of file diff --git a/Preset/AirQuality/entry/src/main/resources/base/element/string.json b/Preset/AirQuality/entry/src/main/resources/base/element/string.json index eb4e32a608ffc729dffd49edecf51f0eea0c692b..32a7f97854ebfc235954d6432c35577667b94ccd 100644 --- a/Preset/AirQuality/entry/src/main/resources/base/element/string.json +++ b/Preset/AirQuality/entry/src/main/resources/base/element/string.json @@ -51,6 +51,10 @@ { "name": "aqi", "value": "AQI" + }, + { + "name": "internet_permission", + "value": "允许使用网络socket" } ] } \ No newline at end of file diff --git a/Preset/DistributeCalc/entry/src/main/ets/MainAbility/common/ButtonComponent.ets b/Preset/DistributeCalc/entry/src/main/ets/MainAbility/common/ButtonComponent.ets index a67529fd2c38fcc7ab27920cc791f18bc8e0edcc..393bc852f8f8bf9ee0135e5d9dc5964e24e2b8b3 100644 --- a/Preset/DistributeCalc/entry/src/main/ets/MainAbility/common/ButtonComponent.ets +++ b/Preset/DistributeCalc/entry/src/main/ets/MainAbility/common/ButtonComponent.ets @@ -26,6 +26,7 @@ export struct ButtonComponent { ForEach(obtainImgV(), (item, index) => { GridItem() { Image(item.image) + .objectFit(ImageFit.Fill) .margin({ top: 5 }) .onClick(() => { this.onInputValue(item.value) @@ -41,6 +42,7 @@ export struct ButtonComponent { ForEach(item, (item) => { GridItem() { Image(item.image) + .objectFit(ImageFit.Fill) .margin({ top: 5 }) .onClick(() => { this.onInputValue(item.value) diff --git a/Preset/DistributeCalc/entry/src/main/ets/MainAbility/common/TitleBar.ets b/Preset/DistributeCalc/entry/src/main/ets/MainAbility/common/TitleBar.ets index 6c2c69984645492fbb42fa2ca92a33eff0ffc68e..654aea7c487100118a86201411b884256ea7cc30 100644 --- a/Preset/DistributeCalc/entry/src/main/ets/MainAbility/common/TitleBar.ets +++ b/Preset/DistributeCalc/entry/src/main/ets/MainAbility/common/TitleBar.ets @@ -31,12 +31,10 @@ export struct TitleBar { private startAbilityCallBack: (key) => void private remoteDeviceModel: RemoteDeviceModel = null @Link isDistributed: boolean - @Link dialogShow: boolean private dialogController: CustomDialogController = null clearSelectState() { this.deviceList = [] - this.dialogShow = false this.dialogController.close() } @@ -71,7 +69,6 @@ export struct TitleBar { this.isDistributed = false this.deviceList = [] this.dialogController.close() - this.dialogShow = false return } this.selectDevice() @@ -95,8 +92,7 @@ export struct TitleBar { } showDiainfo() { - this.dialogShow = true - this.deviceList = []; + this.deviceList = [] // 注册监听回调,发现设备或查找到已认证设备会弹窗显示 this.remoteDeviceModel.registerDeviceListCallback(() => { Logger.info(TAG, 'registerDeviceListCallback, callback entered') @@ -132,8 +128,8 @@ export struct TitleBar { autoCancel: true, alignment: alignments }) - this.dialogController.open() } + this.dialogController.open() } build() { diff --git a/Preset/DistributedMusicPlayer/entry/src/main/ets/model/PlayerModel.ts b/Preset/DistributedMusicPlayer/entry/src/main/ets/model/PlayerModel.ts index 0502c58ad26d36325a4b78b4a9a6834599c4343f..648cc42bf894b9180bce1d958ab8e8c787d12617 100644 --- a/Preset/DistributedMusicPlayer/entry/src/main/ets/model/PlayerModel.ts +++ b/Preset/DistributedMusicPlayer/entry/src/main/ets/model/PlayerModel.ts @@ -172,13 +172,6 @@ class PlayerModel { if (source === this.player.src && this.player.state !== 'idle') { Logger.info(TAG, 'preLoad finished. src not changed') callback() - } else if (this.player.state === 'idle') { - this.player.on('dataLoad', () => { - Logger.info(TAG, `dataLoad callback, state= ${this.player.state}`) - callback() - }) - Logger.info(TAG, `player.src= ${source}`) - this.player.src = source } else { this.notifyPlayingStatus(false) this.cancelTimer() @@ -202,10 +195,6 @@ class PlayerModel { return this.playlist.audioFiles[this.index].duration } Logger.info(TAG, `getDuration state= ${this.player.state}`) - if (this.player.state === 'idle') { - Logger.warn(TAG, `getDuration ignored player.state= ${this.player.state}`) - return 0 - } this.playlist.audioFiles[this.index].duration = Math.min(this.player.duration, 97615) Logger.info(TAG, `getDuration player.src= ${this.player.src} player.duration= ${this.playlist.audioFiles[this.index].duration} `) return this.playlist.audioFiles[this.index].duration diff --git a/Preset/DistributedMusicPlayer/entry/src/main/ets/pages/Index.ets b/Preset/DistributedMusicPlayer/entry/src/main/ets/pages/Index.ets index 4d5d3eddcc7ed957ecfee9478b0f43f837de5824..07272b97bf2e1cf430c6c1aa4f3d0805d385e2b6 100644 --- a/Preset/DistributedMusicPlayer/entry/src/main/ets/pages/Index.ets +++ b/Preset/DistributedMusicPlayer/entry/src/main/ets/pages/Index.ets @@ -227,7 +227,6 @@ struct Index { this.totalMs = PlayerModel.getDuration() this.totalTimeText = this.getShownTimer(this.totalMs) this.currentTimeText = this.getShownTimer(PlayerModel.getCurrentMs()) - this.currentProgress = Math.floor(PlayerModel.getCurrentMs() / this.totalMs * ONE_HUNDRED) Logger.info(TAG, `refreshSongInfo this.title= ${this.title}, this.totalMs= ${this.totalMs}, this.totalTimeText= ${this.totalTimeText},this.currentTimeText= ${this.currentTimeText}`) diff --git a/Safety/Cipher/entry/src/main/ets/MainAbility/common/Decrypt.ets b/Safety/Cipher/entry/src/main/ets/MainAbility/common/Decrypt.ets index d3efcff07dac5c2ec1427fffe1e03f49d097ed5b..bf35ca5a24adb356f1075ae54e955328efe07a03 100644 --- a/Safety/Cipher/entry/src/main/ets/MainAbility/common/Decrypt.ets +++ b/Safety/Cipher/entry/src/main/ets/MainAbility/common/Decrypt.ets @@ -31,10 +31,9 @@ export struct Decrypt { Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Select([{ value: 'RSA' }, { value: 'AES' }]) - .margin(5) + .margin(4) .selected(0) .value(this.algorithmType) - .width('30%') .font({ size: 20, weight: 300, family: 'serif', style: FontStyle.Normal }) .selectedOptionFont({ size: 16, weight: 280, family: 'serif', style: FontStyle.Normal }) .optionFont({ size: 16, weight: 280, family: 'serif', style: FontStyle.Normal }) @@ -43,7 +42,7 @@ export struct Decrypt { Logger.info(TAG, `Select: ${index} value: ${value}`) }) - TextInput() + TextArea() .margin(6) .width('60%') .onChange((value: string) => { diff --git a/Safety/Cipher/entry/src/main/ets/MainAbility/common/Encryption.ets b/Safety/Cipher/entry/src/main/ets/MainAbility/common/Encryption.ets index e8f7d985320dcdc93f3bd9d549d1bd745ed4d71b..c50fded4cc942fcc5277c486db14f604f85644a7 100644 --- a/Safety/Cipher/entry/src/main/ets/MainAbility/common/Encryption.ets +++ b/Safety/Cipher/entry/src/main/ets/MainAbility/common/Encryption.ets @@ -42,9 +42,9 @@ export struct Encryption { Logger.info(TAG, `Select: ${index} value: ${value}`) }) - TextInput() + TextArea() .margin(4) - .width('90%') + .width('60%') .onChange((value: string) => { this.message = value }) diff --git a/Telephony/Contact/entry/src/main/ets/MainAbility/component/NewContact.ets b/Telephony/Contact/entry/src/main/ets/MainAbility/component/NewContact.ets index 1e1dba6fb1b546e37b2d820abd2751140deb9f1f..809e8d0cef05fcb8264d39d568793665acf3d6f6 100644 --- a/Telephony/Contact/entry/src/main/ets/MainAbility/component/NewContact.ets +++ b/Telephony/Contact/entry/src/main/ets/MainAbility/component/NewContact.ets @@ -13,6 +13,10 @@ * limitations under the License. */ +import Logger from '../data/Logger' + +const TAG: string = 'NewContact' + @Component export struct NewContact { @Link name: string @@ -34,7 +38,7 @@ export struct NewContact { .margin({ top: 22, bottom: 32 }) this.newContact($r('app.string.name'), $r('app.media.name')) - this.newContact($r('app.string.address'), $r("app.media.address")) + this.newContact($r('app.string.address'), $r('app.media.address')) this.newContact($r('app.string.phone'), $r('app.media.phone')) this.newContact($r('app.string.email'), $r('app.media.email')) this.newContact($r('app.string.note'), $r('app.media.nickname')) @@ -58,26 +62,27 @@ export struct NewContact { .fontWeight(FontWeight.Bold) .backgroundColor(Color.White) .placeholderFont({ size: 24, weight: 450, family: 'cursive', style: FontStyle.Normal }) - .onChange(value => { - switch (editText) { - case $r('app.string.name'): - this.name = value; + .onChange((value: string) => { + switch (JSON.stringify(editText)) { + case JSON.stringify($r('app.string.name')): + this.name = value break - case $r('app.string.note'): + case JSON.stringify($r('app.string.note')): this.nickName = value break - case $r('app.string.phone'): + case JSON.stringify($r('app.string.phone')): this.phoneNumber = value break - case $r('app.string.email'): - this.email = value; + case JSON.stringify($r('app.string.email')): + this.email = value break - case $r('app.string.address'): + case JSON.stringify($r('app.string.address')): this.postalAddress = value break default: break } + Logger.info(TAG, `this name is ${this.name} this number is ${this.phoneNumber}`) }) } .margin({ bottom: 16 }) diff --git a/Telephony/Contact/entry/src/main/ets/MainAbility/component/UpdateContact.ets b/Telephony/Contact/entry/src/main/ets/MainAbility/component/UpdateContact.ets index 57709d3f42e9a20f0cecb1b0d529bcd531f136aa..1e059956a08961be2b7105edb9a6155de80cb910 100644 --- a/Telephony/Contact/entry/src/main/ets/MainAbility/component/UpdateContact.ets +++ b/Telephony/Contact/entry/src/main/ets/MainAbility/component/UpdateContact.ets @@ -31,22 +31,22 @@ export struct UpdateContact { @Link contact: contact.Contact build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { Image($r('app.media.touxiang')) - .width('20%') - .height('15%') - .margin({ top: '2%' }) + .width(76) + .height(74) + .margin({ top: 52 }) .objectFit(ImageFit.Contain) - Text($r('app.string.save_phone')) - .fontSize(20) - .margin('2%') + Text($r('app.string.save')) + .fontSize(22) + .margin({ top: 22, bottom: 32 }) - this.updateContact(`${this.nameText}: ${this.name}`, $r('app.media.name')) - this.updateContact(`${this.nickNameText}: ${this.nickName}`, $r('app.media.nickname')) - this.updateContact(`${this.phoneNumberText}: ${this.phoneNumber}`, $r('app.media.phone')) - this.updateContact(`${this.emailText}: ${this.email}`, $r('app.media.email')) - this.updateContact(`${this.postalAddressText}: ${this.postalAddress}`, $r('app.media.address')) + this.updateContact(`${this.nameText} ${this.name}`, $r('app.media.name')) + this.updateContact(`${this.nickNameText} ${this.nickName}`, $r('app.media.nickname')) + this.updateContact(`${this.phoneNumberText} ${this.phoneNumber}`, $r('app.media.phone')) + this.updateContact(`${this.emailText} ${this.email}`, $r('app.media.email')) + this.updateContact(`${this.postalAddressText} ${this.postalAddress}`, $r('app.media.address')) } .width('100%') .height('100%') @@ -56,31 +56,32 @@ export struct UpdateContact { updateContact(editText: string, img: Resource) { Row() { Image(img) - .width('18%') - .height('36%') - .margin({ right: 2 }) + .width(32) + .height(32) + .margin({ left: 16, right: 18 }) .objectFit(ImageFit.Contain) TextInput({ placeholder: editText }) - .width('70%') - .fontSize(25) + .width('80%') + .fontSize(22) .fontWeight(FontWeight.Bold) + .backgroundColor(Color.White) .placeholderFont({ size: 22, weight: 450, family: 'cursive', style: FontStyle.Normal }) - .onChange(value => { - switch (editText) { - case `${this.nameText}:`: + .onChange((value: string) => { + switch (JSON.stringify(editText)) { + case JSON.stringify($r('app.string.name')): this.name = value break - case `${this.nickNameText}:`: + case JSON.stringify($r('app.string.note')): this.nickName = value break - case `${this.phoneNumberText}:`: + case JSON.stringify($r('app.string.phone')): this.phoneNumber = value break - case `${this.emailText}:`: + case JSON.stringify($r('app.string.email')): this.email = value break - case `${this.postalAddressText}:`: + case JSON.stringify($r('app.string.address')): this.postalAddress = value break default: @@ -88,21 +89,24 @@ export struct UpdateContact { } }) } - .width('80%') - .margin({ top: 10 }) + .margin({ bottom: 16 }) + .width('94%') + .height(84) + .borderRadius(32) + .backgroundColor(Color.White) } async aboutToAppear() { - this.name = this.contact.name.fullName - this.phoneNumber = this.contact.phoneNumbers[0].phoneNumber - this.nickName = this.contact.nickName.nickName - this.email = this.contact.emails[0].email - this.postalAddress = this.contact.postalAddresses[0].postalAddress let resource = await resourceManager.getResourceManager() this.nameText = await resource.getString($r('app.string.name').id) this.emailText = await resource.getString($r('app.string.email').id) this.nickNameText = await resource.getString($r('app.string.note').id) this.phoneNumberText = await resource.getString($r('app.string.phone').id) this.postalAddressText = await resource.getString($r('app.string.address').id) + this.name = this.contact.name.fullName + this.phoneNumber = this.contact.phoneNumbers[0].phoneNumber + this.nickName = this.contact.nickName.nickName + this.email = this.contact.emails[0].email + this.postalAddress = this.contact.postalAddresses[0].postalAddress } } \ No newline at end of file diff --git a/Telephony/Contact/entry/src/main/ets/MainAbility/pages/AddContact.ets b/Telephony/Contact/entry/src/main/ets/MainAbility/pages/AddContact.ets index 5717d22f0a57beeba0214bc6db033ed94f48a51e..5e449329414fcbd75b0eaa51fb9238d819491111 100644 --- a/Telephony/Contact/entry/src/main/ets/MainAbility/pages/AddContact.ets +++ b/Telephony/Contact/entry/src/main/ets/MainAbility/pages/AddContact.ets @@ -15,9 +15,11 @@ */ import router from '@ohos.router' +import prompt from '@ohos.prompt' import contact from '@ohos.contact' import Logger from '../data/Logger' import { NewContact } from '../component/NewContact' +import ContactModel from '../data/ContactModel' const TAG: string = '[AddContact]' @@ -38,6 +40,9 @@ struct AddContact { .height(32) .margin({ left: 32, right: 22 }) .objectFit(ImageFit.Contain) + .onClick(() => { + router.back() + }) Text($r('app.string.newContact')) .fontSize(26) @@ -45,12 +50,6 @@ struct AddContact { .textAlign(TextAlign.End) .fontColor(Color.Black) - .onClick(() => { - router.back({ - url: 'pages/Index' - }) - }) - Blank() Image($r('app.media.yes')) @@ -58,25 +57,27 @@ struct AddContact { .height(32) .margin({ right: 32 }) .objectFit(ImageFit.Contain) - .onClick(() => { - Logger.info(TAG, `onClick start`) - let contacts = { - name: { fullName: this.name }, - nickName: { nickName: this.nickName }, - phoneNumbers: [{ phoneNumber: this.phoneNumber }], - emails: [{ email: this.email }], - postalAddresses: [{ postalAddress: this.postalAddress }] - } - Logger.info(TAG, `contacts = ${JSON.stringify(contacts)}`) - try { - contact.addContact(contacts, (id) => { - Logger.info(TAG, `id = ${id}`) - }) - router.back({ + .onClick(async () => { + let test = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}/ + Logger.info(TAG, `this number is ${this.phoneNumber} this test result ${test.test(this.phoneNumber)}`) + if (test.test(this.phoneNumber) === true) { + let contacts = { + name: { fullName: this.name }, + nickName: { nickName: this.nickName }, + phoneNumbers: [{ phoneNumber: this.phoneNumber }], + emails: [{ email: this.email }], + postalAddresses: [{ postalAddress: this.postalAddress }] + } + Logger.info(TAG, `contacts = ${JSON.stringify(contacts)} contact type is ${typeof contact.addContact}`) + let id = await ContactModel.addContact(contacts) + router.replace({ url: 'pages/Index' }) - } catch (error) { - Logger.info(TAG, `contact err = ${JSON.stringify(error)}`) + } else { + prompt.showToast({ + message: 'Please input phone number.', + duration: 2000, + }) } }) } diff --git a/Telephony/Contact/entry/src/main/ets/MainAbility/pages/EditContact.ets b/Telephony/Contact/entry/src/main/ets/MainAbility/pages/EditContact.ets index 1b062e43b06dd2f2b276fe058aaeefe349538cae..8b1084c295a989c8cc6b1a5099fda984eec717e3 100644 --- a/Telephony/Contact/entry/src/main/ets/MainAbility/pages/EditContact.ets +++ b/Telephony/Contact/entry/src/main/ets/MainAbility/pages/EditContact.ets @@ -15,70 +15,76 @@ */ import router from '@ohos.router' +import prompt from '@ohos.prompt' import contact from '@ohos.contact' import Logger from '../data/Logger' import { UpdateContact } from '../component/UpdateContact' +import ContactModel from '../data/ContactModel' const TAG: string = '[EditContact]' @Entry @Component struct EditContact { - private contact = <contact.Contact> router.getParams()['data'] + @State contact: contact.Contact = <contact.Contact> router.getParams()['data'] build() { Column() { Row() { Row() { Image($r('app.media.no')) - .width('20%') - .height('40%') - .margin({ right: '2%' }) + .width(32) + .height(32) + .margin({ left: 32, right: 22 }) .objectFit(ImageFit.Contain) - - Text($r('app.string.editor_contact')) - .fontSize(18) - .textAlign(TextAlign.End) - .fontColor(Color.White) + .onClick(() => { + router.back() + }) } - .layoutWeight(1) - .onClick(() => { - router.back({ - url: 'pages/Index' - }) - }) + + Text($r('app.string.editor_contact')) + .fontSize(26) + .fontWeight(400) + .textAlign(TextAlign.End) + .fontColor(Color.Black) Blank() Image($r('app.media.yes')) - .width('10%') - .height('10%') + .width(32) + .height(32) + .margin({ right: 32 }) .objectFit(ImageFit.Contain) .onClick(async () => { - try { - let id = await contact.addContact({ + let test = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}/ + if (test.test(this.contact.phoneNumbers[0].phoneNumber) === true) { + let id = await ContactModel.updateContact({ name: { fullName: this.contact.name.fullName }, nickName: { nickName: this.contact.nickName.nickName }, phoneNumbers: [{ phoneNumber: this.contact.phoneNumbers[0].phoneNumber }], emails: [{ email: this.contact.emails[0].email }], postalAddresses: [{ postalAddress: this.contact.postalAddresses[0].postalAddress }] }) - Logger.info(TAG, `id = ${id}`) - } catch (err) { - Logger.info(TAG, `edit contact err = ${JSON.stringify(err)}`) + router.push({ + url: 'pages/Index' + }) + } else { + prompt.showToast({ + message: 'Please input phone number.', + duration: 2000, + }) } - router.back({ - url: 'pages/Index' - }) }) } .height('6%') .width('100%') - .padding({ left: 16 }) - .backgroundColor('#0D9FFB') + .margin({ top: 32 }) .constraintSize({ minHeight: 50 }) UpdateContact({ contact: $contact }) } + .width('100%') + .height('100%') + .backgroundColor('#fff5f5f5') } } \ No newline at end of file diff --git a/UI/JsAdaptivePortalList/entry/src/main/js/MainAbility/pages/index/index.css b/UI/JsAdaptivePortalList/entry/src/main/js/MainAbility/pages/index/index.css index 91313a04b6aac2b6f0045fee1b8db7d7d05a531e..fee9a51767c629c3136920bba6f003177e0ffe8d 100644 --- a/UI/JsAdaptivePortalList/entry/src/main/js/MainAbility/pages/index/index.css +++ b/UI/JsAdaptivePortalList/entry/src/main/js/MainAbility/pages/index/index.css @@ -113,6 +113,7 @@ .list-wrapper { width: 100%; + height: 90%; flex-direction: column; background-color: #F6F4F1; margin-top: 8px; diff --git a/UI/JsBasicComponents/entry/src/main/js/MainAbility/i18n/zh-CN.json b/UI/JsBasicComponents/entry/src/main/js/MainAbility/i18n/zh-CN.json index 0e350f80ade14e9a64b07ced09ab9aad110a2a5c..d08b627e1062e03b17d519654d55b3d8a12efb5a 100644 --- a/UI/JsBasicComponents/entry/src/main/js/MainAbility/i18n/zh-CN.json +++ b/UI/JsBasicComponents/entry/src/main/js/MainAbility/i18n/zh-CN.json @@ -16,8 +16,8 @@ "content_case1_t2":"点击效果", "btn_emphasize": "默认按钮", "btn_border": "带边框按钮", - "btn_click": "Click me", - "btn_long_click":"Long press", + "btn_click": " 点击 ", + "btn_long_click":" 长按 ", "btn_normal": "改背景色", "btn_text": "文本按钮", "btn_capsule": "胶囊型按钮", diff --git a/UI/JsBasicComponents/entry/src/main/js/MainAbility/pages/index/index.css b/UI/JsBasicComponents/entry/src/main/js/MainAbility/pages/index/index.css index 85aaf6132dff688e293733d5faa1d19f8bfde03b..8a6468a25073100e9ef057ddb240b27f61a7f20f 100644 --- a/UI/JsBasicComponents/entry/src/main/js/MainAbility/pages/index/index.css +++ b/UI/JsBasicComponents/entry/src/main/js/MainAbility/pages/index/index.css @@ -51,30 +51,30 @@ .button-emphasize { height: 40px; - padding-left: 20px; - padding-right: 20px; + padding-left: 10px; + padding-right: 10px; font-size: 16px; } .button-emphasize-click { height: 40px; - padding-left: 20px; - padding-right: 20px; + padding-left: 10px; + padding-right: 10px; font-size: 16px; } .button-emphasize-long-click { height: 40px; - padding-left: 20px; - padding-right: 20px; + padding-left: 10px; + padding-right: 10px; font-size: 16px; - margin-left: 20px; + margin-left: 10px; } .button-emphasize-click :active { height: 40px; - padding-left: 20px; - padding-right: 20px; + padding-left: 10px; + padding-right: 10px; font-size: 16px; background-color: white; text-color: #0040FF; @@ -89,8 +89,8 @@ border-width: 2px; border-style: solid; background-color: lightgray; - padding-left: 20px; - padding-right: 20px; + padding-left: 10px; + padding-right: 10px; } .button-border-click:active { @@ -101,10 +101,10 @@ border-color: #0040FF; border-width: 2px; border-style: solid; - margin-left: 20px; + margin-left: 10px; background-color: lightgray; - padding-left: 20px; - padding-right: 20px; + padding-left: 10px; + padding-right: 10px; } .button-border-click { @@ -112,18 +112,18 @@ font-size: 16px; text-color: white; radius: 16px; - margin-left: 20px; - padding-left: 20px; - padding-right: 20px; + margin-left: 10px; + padding-left: 10px; + padding-right: 10px; } .button-normal { height: 40px; radius: 16px; font-size: 16px; - margin-left: 20px; - padding-left: 20px; - padding-right: 20px; + margin-left: 10px; + padding-left: 10px; + padding-right: 10px; background-color: lightgray; text-color: black; font-weight: 500; @@ -134,7 +134,7 @@ font-size: 16px; font-weight: 600; height: 40px; - margin-left: 20px; + margin-left: 10px; font-style: normal; } @@ -142,25 +142,25 @@ height: 40px; font-size: 16px; font-style: normal; - padding-left: 20px; - margin-left: 20px; - padding-right: 20px; + padding-left: 10px; + margin-left: 10px; + padding-right: 10px; font-weight: 600; } .button-loading { height: 40px; - margin-left: 20px; - padding-left: 20px; + margin-left: 10px; + padding-left: 10px; font-size: 16px; - padding-right: 20px; - width: 200px; + padding-right: 10px; + width: 160px; } .button-circle { width: 40px; height: 40px; - margin-left: 20px; + margin-left: 10px; } .img { diff --git a/UI/JsPanel/entry/src/main/js/default/pages/index/index.css b/UI/JsPanel/entry/src/main/js/default/pages/index/index.css index 5db806a647a436a2e16177a43227d86cd9d58878..7f286e87098c5828ad6ac26011e4992c850bf43f 100644 --- a/UI/JsPanel/entry/src/main/js/default/pages/index/index.css +++ b/UI/JsPanel/entry/src/main/js/default/pages/index/index.css @@ -79,7 +79,7 @@ } .list-div { - width: 250px; + width: 40%; margin-left: 40px; } diff --git a/UI/JsPanel/entry/src/main/js/default/pages/index/index.hml b/UI/JsPanel/entry/src/main/js/default/pages/index/index.hml index 475297385a8ef04c91f108db5b3ad57dd2ad61df..9dc6a67a51af7c94a481cd2252a41cb620a03d9c 100644 --- a/UI/JsPanel/entry/src/main/js/default/pages/index/index.hml +++ b/UI/JsPanel/entry/src/main/js/default/pages/index/index.hml @@ -41,8 +41,8 @@ <div for="{{ parameter }}" class="inner-div"> <div class="list-div"> <text class="inner-txt">{{ $item.key }}</text> - <text class="panel-txt">{{ $item.value }}</text> </div> + <text class="panel-txt">{{ $item.value }}</text> </div> <button class="btn" type="capsule" value="{{ $t('strings.determine') }}" onclick="closeParameter"></button> </div> diff --git a/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg3/svg3.hml b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg3/svg3.hml index 9cb6088444544ffd9fe469c6da5ea29617705b24..83c9bba9ff044d94f1d8ca707f46a06c616527bf 100644 --- a/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg3/svg3.hml +++ b/UI/JsSvg/entry/src/main/js/MainAbility/pages/svg3/svg3.hml @@ -60,7 +60,7 @@ </text> <text y="100" font-size="40" fill="blue"> <tspan> - tspan attribute x|opacity|rotate + tspan attribute x <animate attributeName="x" from="-100" to="350" dur="3s" repeatCount="indefinite"></animate> <animate attributeName="opacity" from="0.01" to="0.99" dur="3s" repeatCount="indefinite"> </animate> @@ -87,7 +87,7 @@ </text> <text> <tspan x="20" y="320" fill="red"> - tspan attribute font-size + tspan font-size <animate attributeName="font-size" from="10" to="30" dur="3s" repeatCount="indefinite"> </animate> </tspan> @@ -101,7 +101,7 @@ </text> <text> <tspan x="20" y="460" font-size="20" fill="white" stroke="red"> - tspan attribute stroke-width-opacity + tspan attribute stroke <animate attributeName="stroke-width" from="1" to="5" dur="3s" repeatCount="indefinite"> </animate> <animate attributeName="stroke-opacity" from="0.01" to="0.99" dur="3s" diff --git a/common/PowerManager/entry/src/main/ets/MainAbility/pages/Index.ets b/common/PowerManager/entry/src/main/ets/MainAbility/pages/Index.ets index ca2d96588da34a91e3d811dc720dc2bc2b1e9523..fc8775cae2c15f5e47936e63f8587a4b87542cab 100644 --- a/common/PowerManager/entry/src/main/ets/MainAbility/pages/Index.ets +++ b/common/PowerManager/entry/src/main/ets/MainAbility/pages/Index.ets @@ -37,13 +37,13 @@ struct Index { value: $r('app.string.determine'), action: () => { console.info(`Callback when the second button is clicked`) - if (title === $r('app.string.turnOff')) { + if (title.id === $r('app.string.turnOff').id) { this.window = 'Is power off' power.shutdownDevice('shutdown_test') console.info(`power_shutdown_device_test success`) - } else { + } else if (title.id === $r('app.string.restart').id) { this.window = 'Is to restart' - power.rebootDevice(''); + power.rebootDevice('reboot_test'); console.info(`power_reboot_device_test success`) } } @@ -86,7 +86,6 @@ struct Index { .fontSize(20) .fontWeight(FontWeight.Bold) - ForEach(this.buttonText, (item, index) => { Button() { Text(item)