From d3ad8d86916c13f42e162ec036403d70e4b2f06c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Fri, 28 Feb 2025 08:30:53 +0000 Subject: [PATCH] Merge #1676 into sdk602patch0911 from refs/changes/1676/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 罗正 * refs/changes/1676/head: (3 commits squashed) - AI大模型标题DEEPSEEK修改为deepSeek - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 解决拨号盘风格转动问题 Signed-off-by: 罗正 <1732036298@qq.com> Reviewed-by: Caisking <3449750381@qq.com> Reviewed-by: 罗正 <1732036298@qq.com> Reviewed-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Reviewed-by: aliyun6865282430 <1624952103@qq.com> Merged-by: Caisking <3449750381@qq.com> CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/1676 --- .../nativeui/aivoice/src/AiVoiceView.cpp | 15 +- .../nativeui/applist/src/ApplistView.cpp | 156 ++++++++++-------- 2 files changed, 101 insertions(+), 70 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp index 6f857067a..ebd1cd90e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-05-07 11:25:58 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-11-19 22:07:15 + * @LastEditTime: 2025-02-28 15:44:14 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/AiVoice/src/AiVoiceView.cpp */ #include "aivoice/include/AiVoicePresenter.h" @@ -158,7 +158,11 @@ namespace OHOS label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height); label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize); label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh); - label->SetTextId(labelconfig.textId); + //TOOD: 待优化 + if(labelconfig.textId == STR_DEEPSEEK) { + label->SetText("DeepSeek"); + } else + label->SetTextId(labelconfig.textId); label->SetLineBreakMode(labelconfig.lineBreakMode); label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); label->SetRollSpeed(23); @@ -934,8 +938,15 @@ namespace OHOS int textId = AiVoiceModel::GetInstance().GetAiModelTextId(); if (title) { + if(textId == STR_DEEPSEEK) + { + title->SetText("DeepSeek"); + } + else + { title->SetTextId(textId); title->ForceResetText(); + } } if (aiModelImage) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistView.cpp b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistView.cpp index 968e85fec..b228896d2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistView.cpp @@ -1269,37 +1269,40 @@ public: bool OnDragStart(UIView& view, const DragEvent& event) override { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AppCircleListOnDragListener::OnDragStart"); - prepoint = convertToRelativeCoordinates(event.GetStartPoint()); - preX = event.GetStartPoint().x; - preY = event.GetStartPoint().y; - dragstartTimeStamp = event.GetTimeStamp(); + if(!isEncoderEvent) //如果此时编码器未旋转 + { + isDragEvent = true; + prepoint = convertToRelativeCoordinates(event.GetStartPoint()); + preX = event.GetStartPoint().x; + preY = event.GetStartPoint().y; + dragstartTimeStamp = event.GetTimeStamp(); + } return true; } bool OnDrag(UIView& view, const DragEvent& event) override { - isEncoderEvent = false; - isDragEvent = true; - - int curX = event.GetCurrentPos().x; - int curY = event.GetCurrentPos().y; - int deltaX = abs(curX - preX); - int deltaY = abs(curY - preY); - if (deltaX < 8 && deltaY < 8) + if(isDragEvent) { - return false; + int curX = event.GetCurrentPos().x; + int curY = event.GetCurrentPos().y; + int deltaX = abs(curX - preX); + int deltaY = abs(curY - preY); + if (deltaX < 8 && deltaY < 8) + { + return false; + } + curpoint = convertToRelativeCoordinates(event.GetCurrentPos()); + /* -------------------------------------------------------------------------- */ + isDirectRotate(event,isDirectRotateFlag); + angle += (isDirectRotateFlag ? angleIncrement : - angleIncrement); + native_app_position_update(CircleListAPP,CircleListAPPNum,CircleListSelectImage,angle,isDirectRotateFlag); + /* -------------------------------------------------------------------------- */ + prepoint = curpoint; + preX = curX; + preY = curY; + /* -------------------------------------------------------------------------- */ } - curpoint = convertToRelativeCoordinates(event.GetCurrentPos()); - /* -------------------------------------------------------------------------- */ - isDirectRotate(event,isDirectRotateFlag); - angle += (isDirectRotateFlag ? angleIncrement : - angleIncrement); - native_app_position_update(CircleListAPP,CircleListAPPNum,CircleListSelectImage,angle,isDirectRotateFlag); - /* -------------------------------------------------------------------------- */ - prepoint = curpoint; - preX = curX; - preY = curY; - /* -------------------------------------------------------------------------- */ - return true; } @@ -1313,14 +1316,17 @@ public: isDirectRotateFlag = isDirectRotate(event);//获取是否是正向旋转的标志 } #endif - dragendTimeStamp = event.GetTimeStamp(); - dragDuration = dragendTimeStamp - dragstartTimeStamp; - // OnDragEndFlag = (dragDuration >= 25 ? 1 : 0);//点击应用的时候容易产生滑动,小于25ms的屏蔽 - OnDragEndFlag = 1; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "dragDuration:%d,dragstartTimeStamp:%d,dragendTimeStamp:%d",dragDuration,dragstartTimeStamp,dragendTimeStamp); - int deltaX = abs(event.GetLastPoint().x - event.GetStartPoint().x); - int deltaY = abs(event.GetLastPoint().y - event.GetStartPoint().y); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "拖动时间:%d 毫秒,deltaX:%d,deltaY:%d",dragDuration,deltaX,deltaY); + if(isDragEvent) + { + dragendTimeStamp = event.GetTimeStamp(); + dragDuration = dragendTimeStamp - dragstartTimeStamp; + // OnDragEndFlag = (dragDuration >= 25 ? 1 : 0);//点击应用的时候容易产生滑动,小于25ms的屏蔽 + OnDragEndFlag = 1; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "dragDuration:%d,dragstartTimeStamp:%d,dragendTimeStamp:%d",dragDuration,dragstartTimeStamp,dragendTimeStamp); + int deltaX = abs(event.GetLastPoint().x - event.GetStartPoint().x); + int deltaY = abs(event.GetLastPoint().y - event.GetStartPoint().y); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "拖动时间:%d 毫秒,deltaX:%d,deltaY:%d",dragDuration,deltaX,deltaY); + } return true; } #if 0 @@ -1389,7 +1395,8 @@ public: { OnDragEndFlag = 0; isInitialized = false; - inertiaDragAngle = 0; + inertiaDragAngle = 0; + isDragEvent = false; if (isEncoderEvent) { angleIncrement = 10;//还原为drag的角度 @@ -1460,8 +1467,12 @@ public: bool OnRotateStart(UIView& view, const RotateEvent& event) { - angleIncrement = 15; - preRotateAngle = angle; + if(!isDragEvent) //如果此时未拖拽 + { + isEncoderEvent = true; + angleIncrement = 15; + preRotateAngle = angle; + } return false; } @@ -1469,50 +1480,59 @@ public: { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AppCircleListOnDragListener::OnRotate %d",event.GetRotate()); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnRotate回调次数%d",++RotateReportedCount); - ++RotateReportedCount; - isEncoderEvent = true; - isDragEvent = false; - if(RotateReportedCount > 4) + if(isEncoderEvent) { - if(event.GetRotate() > 0) - { - isDirectRotateFlag = true; - angle += angleIncrement; - native_app_position_update(CircleListAPP,CircleListAPPNum,CircleListSelectImage,angle,isDirectRotateFlag); - } - else + ++RotateReportedCount; + if(RotateReportedCount > 4) { - isDirectRotateFlag = false; - angle -= angleIncrement; - native_app_position_update(CircleListAPP,CircleListAPPNum,CircleListSelectImage,angle,isDirectRotateFlag); - } + if(event.GetRotate() > 0) + { + isDirectRotateFlag = true; + angle += angleIncrement; + native_app_position_update(CircleListAPP,CircleListAPPNum,CircleListSelectImage,angle,isDirectRotateFlag); + } + else + { + isDirectRotateFlag = false; + angle -= angleIncrement; + native_app_position_update(CircleListAPP,CircleListAPPNum,CircleListSelectImage,angle,isDirectRotateFlag); + } - // rotateangle += angleIncrement; - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "rotateangle:%d",rotateangle); - // if(rotateangle >= 30 || rotateangle <= -30) - // { - // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "震动一次"); - // rotateangle = 0; - // ui_api_vibrate_once_func(); - // } + // rotateangle += angleIncrement; + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "rotateangle:%d",rotateangle); + // if(rotateangle >= 30 || rotateangle <= -30) + // { + // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "震动一次"); + // rotateangle = 0; + // ui_api_vibrate_once_func(); + // } + } } return false; } bool OnRotateEnd(UIView& view, const RotateEvent& event) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AppCircleListOnDragListener::OnRotateEnd %d",event.GetRotate()); - if(angle % 30 == 0) { - angleIncrement = 10; //还原为drag的角度 - OnDragEndFlag = 0; //不需要补偿角度 - if(preRotateAngle != angle) { - ui_api_vibrate_once_func(); + if(isEncoderEvent) + { + if(angle % 30 == 0) + { + angleIncrement = 10; //还原为drag的角度 + OnDragEndFlag = 0; //不需要补偿角度 + isEncoderEvent = false; + if(preRotateAngle != angle) + { + ui_api_vibrate_once_func(); + } + } + else + { + OnDragEndFlag = 1; } - } else { - OnDragEndFlag = 1; + RotateReportedCount = 0; + rotateangle = 0; + dragDuration = 0; } - RotateReportedCount = 0; - rotateangle = 0; - dragDuration = 0; return false; } -- 2.17.1