#ifndef TJD_UI_APP_LEFUN_AI_VIEW_H #define TJD_UI_APP_LEFUN_AI_VIEW_H #include "TjdUiAppLefunAiPresenter.h" #include "TjdUiMultiLanguageExt.h" #include "View.h" #include "components/ui_image_animator.h" #include "components/ui_image_view.h" #include "components/ui_label.h" #include "components/ui_label_ext.h" #include "components/ui_list.h" #include "components/ui_scroll_view.h" #include "components/ui_scroll_view_nested.h" #include "components/ui_view_group.h" #include "graphic_timer.h" #include "ui_list.h" #include namespace TJD { class LefunAiUIScrollView : public OHOS::UIScrollViewNested { public: LefunAiUIScrollView() {} ~LefunAiUIScrollView() {} bool OnDragStartEvent(const OHOS::DragEvent &event) override; bool OnDragEvent(const OHOS::DragEvent &event) override; bool OnDragEndEvent(const OHOS::DragEvent &event) override; private: bool isOnStart_{false}; }; class LefunAiViewBase : public OHOS::UIScrollView { public: LefunAiViewBase() { SetHorizontalScrollState(false); }; virtual ~LefunAiViewBase(){}; virtual void ShowView() { SetVisible(true); }; virtual void HideView() { SetVisible(false); }; }; class TjdUiAppLefunAiPresenter; class TjdUiAppLefunAiView : public OHOS::View { public: TjdUiAppLefunAiView(); ~TjdUiAppLefunAiView(); static TjdUiAppLefunAiView *GetInstance(void); void OnStart() override; void OnStop() override; void ShowView(LefunAiView showIndex); void InitTargetView(LefunAiView index); void InitHistoryListResource(); static LefunAiView currentViewIndex_; std::list *historyItemList_{nullptr}; LefunAiViewBase *viewManager_[LEFUN_AI_VIEW_COUNT]{nullptr}; private: LefunAiUIScrollView *mainView_{nullptr}; }; #pragma region TjdUiAppLefunAiMainView class TjdUiAppLefunAiMainView : public LefunAiViewBase { public: TjdUiAppLefunAiMainView(); ~TjdUiAppLefunAiMainView() { RemoveAll(); }; void ShowView(); void HideView(); private: OHOS::UIImageView imgBg_; OHOS::UIImageView imgHistory_; OHOS::UILabel lefunAi_; OHOS::UILabelExt brief_; OHOS::UILabelExt guideLabel_; OHOS::UIImageView guideImg_; OHOS::UIImageView imgConfirm_; }; #pragma endregion #pragma region LefunAiNoConnectView class LefunAiNoConnectView : public LefunAiViewBase { public: LefunAiNoConnectView(); ~LefunAiNoConnectView() { RemoveAll(); }; private: OHOS::UIImageView imgNoConnect_; OHOS::UILabelExt lbNoConnect_; }; #pragma endregion #pragma region LefunAiRecordingView class LefunAiRecordingView : public LefunAiViewBase { public: LefunAiRecordingView(); ~LefunAiRecordingView(); static LefunAiRecordingView *GetInstance(void); void ShowView(); void HideView(); void UpdateRecordingTime(); private: uint8_t recordingTime = 0; OHOS::UIImageView imgBg_; OHOS::UILabel recordingGoal_; OHOS::UILabel targetGoal_; OHOS::UILabelExt guideLabel_; OHOS::UIImageView imgConfirm_; OHOS::UIImageAnimatorView animator_; OHOS::ImageAnimatorInfo animatorRecordingInfo_[6] = {0}; OHOS::GraphicTimer *recordingTimer_ = nullptr; // 录制中计时器 }; #pragma endregion #pragma region LefunAiAnalysisView class LefunAiAnalysisView : public LefunAiViewBase { public: LefunAiAnalysisView(); ~LefunAiAnalysisView(); static LefunAiAnalysisView *GetInstance(void); void ShowView(); void HideView(); void ViewExitEvent(); private: OHOS::GraphicTimer *analysisTimer_ = nullptr; // 分析中计时器 OHOS::UILabelExt lbAnalysis_; OHOS::UIImageAnimatorView animator_; OHOS::ImageAnimatorInfo animatorAnalysisInfo_[11] = {0}; }; #pragma endregion #pragma region LefunAiTiemOutView class LefunAiTiemOutView : public LefunAiViewBase { public: LefunAiTiemOutView(); ~LefunAiTiemOutView() { RemoveAll(); }; private: OHOS::UIImageView imgTimeOutBg_; OHOS::UILabelExt lbfail_; OHOS::UIImageView imgCancel_; OHOS::UIImageView imgRetry_; }; #pragma endregion #pragma region LefunAiAnswerView static void waitTimerCallBack(void *arg); class AnswerView : public OHOS::UIScrollView { public: AnswerView(); ~AnswerView() { RemoveAll(); }; void SetAnswer(const std::string answer) { lbAnswer_.SetText(answer.c_str()); } OHOS::UILabel lbAnswer_; friend void waitTimerCallBack(void *arg); }; class LefunAiAnswerView : public LefunAiViewBase { public: LefunAiAnswerView(); ~LefunAiAnswerView(); static LefunAiAnswerView *GetInstance(void); void ShowView(); void HideView(); void RefreshAnswerView(); AnswerView answerView_; private: OHOS::UIView lbQuestionBg_; OHOS::UILabel lbQuestion_; OHOS::UIImageView imgQuestion_; OHOS::UILabel lbAnswer_; OHOS::UIImageView imgAnswer_; OHOS::UIImageView imgConfirm_; }; #pragma endregion #pragma region LefunAiNoContentInputView class LefunAiNoContentInputView : public LefunAiViewBase { public: LefunAiNoContentInputView(); ~LefunAiNoContentInputView() { RemoveAll(); }; private: OHOS::UIImageView imgNoContent_; OHOS::UILabelExt lbNoContent_; OHOS::UIImageView imgReturn_; }; #pragma endregion #pragma region LefunAiHistoryRecordView class LefunAiHistoryRecordView : public LefunAiViewBase { public: LefunAiHistoryRecordView(); ~LefunAiHistoryRecordView(); void ShowView(); void HideView(); private: OHOS::UILabelExt lbTitle_; OHOS::UILabelExt lbNoRecord_; OHOS::UIImageView imgNoRecord_; OHOS::UIImageView imgReturn_; OHOS::UIList *historyList_{nullptr}; TjdUiAppLefunAiAdapter *listAdapter_{nullptr}; }; #pragma endregion #pragma region TjdUiAppLefunAiRecordingView #pragma endregion #pragma region TjdUiAppLefunAiRecordingView #pragma endregion } // namespace TJD #endif