From: luozheng <1732036298@qq.com> Date: Wed, 10 Apr 2024 01:35:14 +0000 (+0800) Subject: 修改录音和天气视图的按键监听 X-Git-Tag: release_V1.2.70_20241020_135402~1189^2~26 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=dc81b93daefdfab7ec6a0f356d9f7e82aacfb961;p=mirrors%2FFD230.git 修改录音和天气视图的按键监听 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp index f85bd5561..a2fb28277 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp @@ -242,8 +242,9 @@ namespace OHOS { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingPresenter::OnKeyAct"); uint16 keyID = event.GetKeyId(); + uint16_t keyState = event.GetState(); // 如果是power键就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER)) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) { uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); NativeAbility::GetInstance().ChangeSlice(preSlice); diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherPresenter.cpp index 43bf11f93..6d0b00d87 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherPresenter.cpp @@ -4,6 +4,8 @@ #include "NativeAbility.h" #include "weather/include/MainWeatherPresenter.h" #include "common/key_code.h" +#include "common/key_code.h" +#include namespace OHOS { @@ -83,8 +85,9 @@ namespace OHOS { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingPresenter::OnKeyAct"); uint16 keyID = event.GetKeyId(); + uint16_t keyState = event.GetState(); // 如果是power键就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER)) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) { uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); NativeAbility::GetInstance().ChangeSlice(preSlice);