From 2dd096e53ae0120772079dc8b83da40649e0d069 Mon Sep 17 00:00:00 2001 From: ywcoder <1104410818@qq.com> Date: Wed, 23 Jul 2025 16:48:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1=E3=80=81=E6=96=B0=E5=A2=9EFAQ:=E5=BD=93?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E7=BB=84=E4=BB=B6=E5=90=8C=E6=97=B6=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E4=BA=86=E7=82=B9=E5=87=BB=E4=BA=8B=E4=BB=B6=EF=BC=88?= =?UTF-8?q?onClick=EF=BC=89=E5=92=8C=E5=B9=B6=E8=A1=8C=E6=89=8B=E5=8A=BF?= =?UTF-8?q?=EF=BC=88parallelGesture=EF=BC=89=EF=BC=8C=E4=B8=BA=E4=BB=80?= =?UTF-8?q?=E4=B9=88=E5=BD=93=E6=93=8D=E4=BD=9C=E4=B8=BA=E9=95=BF=E6=8C=89?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=B8=A4=E4=B8=AA=E6=89=8B=E5=8A=BF=E9=83=BD?= =?UTF-8?q?=E4=BC=9A=E5=93=8D=E5=BA=94=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../onClickAndParallelGestureProblematic.ets | 53 ++++++++++++++++++ .../onClickAndParallelGestureSolution.ets | 54 +++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 ArkUI/entry/src/main/ets/pages/onClickAndParallelGestureProblematic.ets create mode 100644 ArkUI/entry/src/main/ets/pages/onClickAndParallelGestureSolution.ets diff --git a/ArkUI/entry/src/main/ets/pages/onClickAndParallelGestureProblematic.ets b/ArkUI/entry/src/main/ets/pages/onClickAndParallelGestureProblematic.ets new file mode 100644 index 0000000..4130cef --- /dev/null +++ b/ArkUI/entry/src/main/ets/pages/onClickAndParallelGestureProblematic.ets @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2024 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. +*/ + +/* +* FAQ:当一个组件同时绑定了点击事件(onClick)和并行手势(parallelGesture),为什么当操作为长按时,两个手势都会响应? +*/ + +// [Start onClickAndParallelGestureProblematic] +@Entry +@Component +struct onClickAndParallelGestureProblematic { + @State message: string = '多种手势,长按这里'; + + build() { + RelativeContainer() { + Text(this.message) + .id('TwoGestureHelloWorld') + .fontSize($r('app.float.page_text_font_size')) + .fontWeight(FontWeight.Bold) + .alignRules({ + center: { anchor: '__container__', align: VerticalAlign.Center }, + middle: { anchor: '__container__', align: HorizontalAlign.Center } + }) + .onClick(() => { + console.info('TapGesture--单击'); + }) + .parallelGesture( + GestureGroup(GestureMode.Exclusive, + LongPressGesture({ repeat: false }) + .onAction(() => { + console.info('LongPressGesture--长按'); + }) + ) + ) + } + .height('100%') + .width('100%') + } +} + +// [End onClickAndParallelGestureProblematic] diff --git a/ArkUI/entry/src/main/ets/pages/onClickAndParallelGestureSolution.ets b/ArkUI/entry/src/main/ets/pages/onClickAndParallelGestureSolution.ets new file mode 100644 index 0000000..d8c6f2c --- /dev/null +++ b/ArkUI/entry/src/main/ets/pages/onClickAndParallelGestureSolution.ets @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2024 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. +*/ + +/* +* FAQ:当一个组件同时绑定了点击事件(onClick)和并行手势(parallelGesture),为什么当操作为长按时,两个手势都会响应? +*/ + +// [Start onClickAndParallelGestureSolution] +@Entry +@Component +struct onClickAndParallelGestureSolution { + @State message: string = '多种手势,长按这里'; + + build() { + RelativeContainer() { + Text(this.message) + .id('HelloWorld') + .fontSize($r('app.float.page_text_font_size')) + .fontWeight(FontWeight.Bold) + .alignRules({ + center: { anchor: '__container__', align: VerticalAlign.Center }, + middle: { anchor: '__container__', align: HorizontalAlign.Center } + }) + .parallelGesture( + GestureGroup(GestureMode.Exclusive, + TapGesture({ count: 1, fingers: 1 }) + .onAction(() => { + console.info('TapGesture--单击'); + }), + LongPressGesture({ repeat: false }) + .onAction(() => { + console.info('LongPressGesture--长按'); + }) + ) + ) + } + .height('100%') + .width('100%') + } +} + +// [Start onClickAndParallelGestureSolution] -- Gitee From 37ea970d834d1217b42d513d78619ca409a02c93 Mon Sep 17 00:00:00 2001 From: ywcoder <1104410818@qq.com> Date: Thu, 24 Jul 2025 16:20:11 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=82=E6=95=B0audioBi?= =?UTF-8?q?trate=E7=9A=84=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MediaKit/entry/src/main/ets/pages/AVRecorderProfile.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MediaKit/entry/src/main/ets/pages/AVRecorderProfile.ets b/MediaKit/entry/src/main/ets/pages/AVRecorderProfile.ets index 98d612b..979b87d 100644 --- a/MediaKit/entry/src/main/ets/pages/AVRecorderProfile.ets +++ b/MediaKit/entry/src/main/ets/pages/AVRecorderProfile.ets @@ -24,7 +24,7 @@ struct AVRecorderProfile { @State message: string = 'Hello World'; // [Start AVRecorderProfile] private avProfile: media.AVRecorderProfile = { - audioBitrate: 6400, // set audioBitrate according to device ability. + audioBitrate: 64000, // set audioBitrate according to device ability. audioChannels: 1, // set audioChannels,valid value 1-8,CFT_WAV supports 1. audioCodec: media.CodecMimeType.AUDIO_G711MU, // set audioCodec,AUDIO_G711MU matching CFT_WAV. audioSampleRate: 8000, // set audioSampleRate according to device ability. -- Gitee