* @Author: luozheng 1732036298@qq.com
* @Date: 2024-06-20 15:14:43
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-08-03 14:26:12
+ * @LastEditTime: 2024-08-03 17:45:26
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h
*/
#ifndef AI_VOICE_MODEL_H
static AiVoiceModel &GetInstance(void); // 获取单例实例
bool ChangeToReturnResultTextView(void);
bool ChangeToAIVoiceListeningView(bool value);
+ void FunctionKeyOnClickToChangeAIModel(void);
// 初始化和状态管理
bool CreateIfNotExists();
void StatusResume(void);
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-06-20 14:44:22
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-08-03 17:28:03
+ * @LastEditTime: 2024-08-03 17:46:15
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h
*/
#ifndef AI_VOICE_PRESENTER_H
bool JumpToReturnResultTextView(void);
bool ChangeToAIVoiceListeningView(bool val);
bool ChangeViewAndLogicOperator(int16_t hideView, int16_t showView);
+ void FunctionKeyOnClickToChangeAIModel(void);
private:
bool OnClick(UIView &view, const ClickEvent &event) override;
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-06-20 15:14:50
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-08-03 15:06:35
+ * @LastEditTime: 2024-08-03 17:47:08
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp
*/
#include "aivoice/include/AiVoiceModel.h"
return true;
}
+ void AiVoiceModel::FunctionKeyOnClickToChangeAIModel(void)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::FunctionKeyOnClickToChangeAIModel");
+ AiVoicePresenter *Aipresenter_ = AiVoicePresenter::GetInstance();
+ if (Aipresenter_ == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::FunctionKeyOnClickToChangeAIModel fail!!");
+ return;
+ }
+ Aipresenter_->FunctionKeyOnClickToChangeAIModel();
+ return;
+ }
+
/*如果文件不存在就创建*/
bool AiVoiceModel::CreateIfNotExists()
{
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-06-20 15:11:17
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-08-03 16:26:41
+ * @LastEditTime: 2024-08-03 17:48:50
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp
*/
#include "AppViewIDs.h"
return true;
}
+ void AiVoicePresenter::FunctionKeyOnClickToChangeAIModel(void)
+ {
+ int index = model->GetSelectAiModel() + 1;
+ if (index >= AIMODES_MAX_NUM)
+ {
+ index = 0;
+ }
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiModelsPresenter::index = %d", index);
+ model->SetSelectAiModel(index);
+ view_->ChangeAiModelAndUpdateComponentsStatus();
+ return;
+ }
+
bool AiVoicePresenter::ChangeViewAndLogicOperator(int16_t hideView, int16_t showView)
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::ChangeViewOperator");
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-07-18 14:55:27
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-08-02 11:57:16
+ * @LastEditTime: 2024-08-03 17:53:50
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp
*/
#include "settings/include/SettingModel.h"
#include <custom_utils.h>
#include "themestyle/include/ThemeStyleModel.h"
-#include "aimodels/include/AiModelsModel.h"
+#include "aivoice/include/AiVoiceModel.h"
#include "ConfigModel.h"
#include "graphic_service.h"
namespace OHOS
if (display_api->get_screen_state() == SCREEN_ON)
{
- AiModelsModel &aiModelsModel = AiModelsModel::GetInstance();
- if (!aiModelsModel.ChangeAiModel())
+ uint16_t curSliceId = NativeAbility::GetInstance().GetCurSliceId();
+ if (curSliceId == VIEW_AI_VOICE) // 如果当前已在ai语音界面单击切换模型
+ {
+ AiVoiceModel::GetInstance().FunctionKeyOnClickToChangeAIModel();
+ return;
+ }
+ else
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to change AI model");
+ NativeAbility::GetInstance().EnterSlice(VIEW_AI_VOICE);// 切换到Ai语音界面
}
}
else
RegisterPowerKeyDoubleClickEvent();
RegisterPowerKeyLongPressEvent();
RegisterFuncKeyPressEvent();
- RegisterFuncKeyLongPressEvent();
- // RegisterFuncKeyClickEvent();
+ // RegisterFuncKeyLongPressEvent();
+ RegisterFuncKeyClickEvent();
// RegisterFuncKeyDoubleClickEvent();
}
}