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 0000000000000000000000000000000000000000..4130cef4269e42b44f9b944e12f6bd92ee0752b2 --- /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 0000000000000000000000000000000000000000..d8c6f2ca48eadeed69da600544c115bfc1608134 --- /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] diff --git a/MediaKit/entry/src/main/ets/pages/AVRecorderProfile.ets b/MediaKit/entry/src/main/ets/pages/AVRecorderProfile.ets index 98d612b4f0981141bfb719c59d9b3d9dda52ba9f..979b87d01c03f6933d35efb80bc8360f78c417ca 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.