* @Author: luozheng 1732036298@qq.com
* @Date: 2024-06-08 09:36:01
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-08-09 20:14:30
+ * @LastEditTime: 2024-08-15 17:07:18
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/include/AiVoiceView.h
*/
#ifndef AI_VOICE_VIEW_H
void ClearAll(void);
void SetComponentVisibility(UIView *component, bool isVisible);
UILabelExt *title{nullptr}; /*标题*/
- UILabelExt *startChatLabel{nullptr}; /*开始对话标签*/
+ UILabelExt *startChatLabel{nullptr}; /*开始对话标签,暂时不用*/
UIButton *startChatButton{nullptr}; /*开始对话按钮*/
- UILabelExt *chatLabel{nullptr}; /*对话标签*/
+ UILabelExt *chatLabel{nullptr}; /*对话标签,暂时不用*/
UIButton *chatButton{nullptr}; /*对话按钮*/
UIImageView *aiModelImage{nullptr}; /*ai模型图片*/
- UILabelExt *apiKeysLabel{nullptr}; /*API Keys标签*/
- UIButton *apiKeysButton{nullptr}; /*API Keys按钮*/
+ UIImageView *buttonBg{nullptr}; /*按钮背景图片*/
+ UILabelExt *apiKeysLabel{nullptr}; /*API Keys标签,暂时不用*/
+ UIButton *apiKeysButton{nullptr}; /*API Keys按钮,,暂时不用*/
UIPicker *aiModelPicker{nullptr}; /*ai模型选择器*/
UIScrollView *AiVoiceScrollView[MAX_AIVOICE_VIEWID]{nullptr};
bool viewInitStatus{false};
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-05-07 11:25:58
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-08-03 16:45:06
+ * @LastEditTime: 2024-08-15 17:19:41
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/AiVoice/src/AiVoiceView.cpp
*/
#include "aivoice/include/AiVoicePresenter.h"
delete aiModelPicker;
aiModelPicker = nullptr;
+ delete buttonBg;
+ buttonBg = nullptr;
+
delete AiVoiceScrollView[AIVOICE_STARTCHAT_VIEWID];
AiVoiceScrollView[AIVOICE_STARTCHAT_VIEWID] = nullptr;
}
button->SetPosition(buttonconfig.x, buttonconfig.y, buttonconfig.w, buttonconfig.h);
button->SetViewId(buttonconfig.ViewId);
button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff4fc34c);
- button->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
- button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff383838, UIButton::PRESSED);
+ button->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0x00, UIButton::PRESSED);
button->SetOnTouchListener(presenter_);
return button;
aiModelImage->SetTouchable(true);
aiModelImage->SetViewId(AIVOICE_IMGAE_VIEW_ID);
aiModelImage->SetOnClickListener(presenter_);
-
+ /* -------------------------------- buttonBg -------------------------------- */
+ imagecinfig = {
+ .x = 208,
+ .y = 340,
+ .w = 48,
+ .h = 56,
+ .src = "/user/res/AIVoice/ai_chart_icon.bin",
+ };
+ buttonBg = AiVoiceViewImageView(imagecinfig);
+ if (buttonBg == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::aiModelImage is nullptr!!");
+ return false;
+ }
return true;
}
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::CreateAiVoiceViewButton");
/* ----------------------------- startChatButton ---------------------------- */
ButtonConfig buttonconfig = {
- .x = 93,
- .y = 320,
- .w = 280,
- .h = 90,
+ .x = 43,
+ .y = 328,
+ .w = 380,
+ .h = 80,
.ViewId = AIVOICE_START_CHAT_BUTTON_VIEW_ID,
};
startChatButton = AiVoiceViewButtonInit(buttonconfig);
return false;
}
startChatButton->SetVisible(false);
+ const char *image = "/user/res/AIVoice/ai_chart_icon_bg.bin";
+ startChatButton->SetImageSrc(image, image);
/* ------------------------------- chatButton ------------------------------- */
buttonconfig = {
- .x = 58,
- .y = 320,
- .w = 170,
- .h = 90,
+ .x = 43,
+ .y = 328,
+ .w = 380,
+ .h = 80,
.ViewId = AIVOICE_CHAT_BUTTON_VIEW_ID,
};
chatButton = AiVoiceViewButtonInit(buttonconfig);
return false;
}
chatButton->SetVisible(false);
+ chatButton->SetImageSrc(image, image);
/* ------------------------------ apiKeysButton ----------------------------- */
buttonconfig = {
.x = 238,
AiVoiceScrollView[AIVOICE_STARTCHAT_VIEWID]->Add(chatLabel);
AiVoiceScrollView[AIVOICE_STARTCHAT_VIEWID]->Add(apiKeysButton);
AiVoiceScrollView[AIVOICE_STARTCHAT_VIEWID]->Add(apiKeysLabel);
+ AiVoiceScrollView[AIVOICE_STARTCHAT_VIEWID]->Add(buttonBg);
}
void AiVoiceView::OnStart()
bool isAiModeChatGpt = (AiVoiceModel::GetInstance().GetAiModelTextId() == STR_AIMODES_CHATGPT);
SetComponentVisibility(chatButton, isAiModeChatGpt);
- SetComponentVisibility(chatLabel, isAiModeChatGpt);
- SetComponentVisibility(apiKeysButton, isAiModeChatGpt);
- SetComponentVisibility(apiKeysLabel, isAiModeChatGpt);
+ // SetComponentVisibility(chatLabel, isAiModeChatGpt);
+ // SetComponentVisibility(apiKeysButton, isAiModeChatGpt);
+ // SetComponentVisibility(apiKeysLabel, isAiModeChatGpt);
- SetComponentVisibility(startChatLabel, !isAiModeChatGpt);
+ // SetComponentVisibility(startChatLabel, !isAiModeChatGpt);
SetComponentVisibility(startChatButton, !isAiModeChatGpt);
}