${CMAKE_CURRENT_SOURCE_DIR}/nativeui/ecg/src/EcgTestAnalysisView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/ecg/src/EcgResetTestOfSuccView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/ecg/src/EcgTestResultView.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/ecg/src/EcgTestNeedAppOrNetworkView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/BluetoothDeviceListView.cpp
--- /dev/null
+#ifndef ECG_TESTNEEDAPPORNETWORK_VIEW_H_
+#define ECG_TESTNEEDAPPORNETWORK_VIEW_H_
+
+#include "components/ui_view_group.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_button.h"
+#include "components/ui_label_button_ext.h"
+#include "components/ui_image_view.h"
+#include "components/ui_scroll_view.h"
+namespace OHOS
+{
+ class EcgTestNeedAppOrNetworkView
+ {
+ public:
+ EcgTestNeedAppOrNetworkView();
+ ~EcgTestNeedAppOrNetworkView();
+ static EcgTestNeedAppOrNetworkView *GetInstance(void);
+ UIViewGroup *EcgTestNeedAppOrNetworkInit();
+
+ private:
+ void ClearAll(void);
+ UIViewGroup *group{nullptr};
+ UILabelExt *reminderLabel{nullptr};
+ };
+}
+#endif
\ No newline at end of file
#include "ecg/include/EcgTestAnalysisView.h"
#include "ecg/include/EcgResetTestOfSuccView.h"
#include "ecg/include/EcgTestResultView.h"
+#include "ecg/include/EcgTestNeedAppOrNetworkView.h"
namespace OHOS
{
typedef enum : uint8_t
{
- ECGSTARTTESTVIEW = 0, // 开始测量界面
- ECGTESTREMINDERVIEW, // 测量提醒界面
- ECGTESTINGVIEW, // 测量中界面
- ECGTESTFAILNOVALUE, // 测量失败无值
- ECGTESTFAILNOWEARING, // 测量失败未佩戴
- ECGTESTANALYSISVIEW, // 测量分析界面
- ECGRESETTESTOFSUCCVIEW, // 测量成功重新测量界面
- ECGTESTRESULTVIEW, // 测量结果界面
+ ECGSTARTTESTVIEW = 0, // 开始测量界面
+ ECGTESTREMINDERVIEW, // 测量提醒界面
+ ECGTESTINGVIEW, // 测量中界面
+ ECGTESTFAILNOVALUE, // 测量失败无值
+ ECGTESTFAILNOWEARING, // 测量失败未佩戴
+ ECGTESTANALYSISVIEW, // 测量分析界面
+ ECGRESETTESTOFSUCCVIEW, // 测量成功重新测量界面
+ ECGTESTRESULTVIEW, // 测量结果界面
+ ECGTESTNEEDAPPORNETWORKVIEW, // 测量需要app或网络界面
MAX_ECGVIEW,
} EcgViewID;
bool ChangeEcgTestAnalysisView(int16_t thisView);
bool ChangeEcgResetTestOfSuccView(int16_t thisView);
bool ChangeEcgTestResultView(int16_t thisView);
+ bool ChangeEcgTestNeedAppOrNetworkView(int16_t thisView);
bool ClickFunc(int16_t interface);
void ChangeView(int16_t hideView, int16_t showView);
EcgTestAnalysisView *p_EcgTestAnalysisView{nullptr};
EcgResetTestOfSuccView *p_EcgResetTestOfSuccView{nullptr};
EcgTestResultView *p_EcgTestResultView{nullptr};
+ EcgTestNeedAppOrNetworkView *p_EcgTestNeedAppOrNetworkView{nullptr};
private:
void CreateEcgView(void);
--- /dev/null
+#include "ecg/include/EcgTestNeedAppOrNetworkView.h"
+#include "ecg/include/EcgPresenter.h"
+#include "wearable_log.h"
+
+namespace OHOS
+{
+ static EcgTestNeedAppOrNetworkView *g_pEcgTestNeedAppOrNetworkView = nullptr;
+ EcgTestNeedAppOrNetworkView::EcgTestNeedAppOrNetworkView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "EcgTestNeedAppOrNetworkView::EcgTestNeedAppOrNetworkView");
+ g_pEcgTestNeedAppOrNetworkView = this;
+ }
+
+ EcgTestNeedAppOrNetworkView::~EcgTestNeedAppOrNetworkView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "EcgTestNeedAppOrNetworkView::~EcgTestNeedAppOrNetworkView");
+ ClearAll();
+ g_pEcgTestNeedAppOrNetworkView = nullptr;
+ }
+
+ EcgTestNeedAppOrNetworkView *EcgTestNeedAppOrNetworkView::GetInstance(void)
+ {
+ return g_pEcgTestNeedAppOrNetworkView;
+ }
+
+ void EcgTestNeedAppOrNetworkView::ClearAll(void)
+ {
+ if (group)
+ {
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ delete reminderLabel;
+ reminderLabel = nullptr;
+ }
+ }
+
+ UIViewGroup *EcgTestNeedAppOrNetworkView::EcgTestNeedAppOrNetworkInit()
+ {
+ if (group == nullptr)
+ {
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group null!");
+ return nullptr;
+ }
+ }
+ group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+ group->SetTouchable(true);
+ group->SetDraggable(true);
+ UIView::OnDragListener *dragListener = (UIView::OnDragListener *)OHOS::EcgPresenter::GetInstance();
+ group->SetOnDragListener(dragListener);
+ /* -------------------------------------------------------------------------- */
+ if (reminderLabel == nullptr)
+ {
+ reminderLabel = new UILabelExt();
+ if (reminderLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "reminderLabel null!");
+ return nullptr;
+ }
+ }
+ reminderLabel->SetPosition((HORIZONTAL_RESOLUTION - 400) / 2, 201, 400, 77);
+ reminderLabel->SetStyle(STYLE_TEXT_FONT, 36);
+ reminderLabel->SetStyle(STYLE_LINE_HEIGHT, 77);
+ reminderLabel->SetText("请连接APP或开启4G网络");
+ reminderLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ reminderLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ reminderLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 36);
+ group->Add(reminderLabel);
+ return group;
+ }
+}
\ No newline at end of file
delete p_EcgTestResultView;
p_EcgTestResultView = nullptr;
}
+ if(p_EcgTestNeedAppOrNetworkView)
+ {
+ delete p_EcgTestNeedAppOrNetworkView;
+ p_EcgTestNeedAppOrNetworkView = nullptr;
+ }
for (int i = 0; i < MAX_ECGVIEW; i++)
{
group[i] = nullptr;
}
return true;
}
+ bool EcgView::ChangeEcgTestNeedAppOrNetworkView(int16_t thisView)
+ {
+ if (group[thisView] == nullptr)
+ {
+ p_EcgTestNeedAppOrNetworkView = new EcgTestNeedAppOrNetworkView();
+ if (p_EcgTestNeedAppOrNetworkView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new scrollView[%d] fail", thisView);
+ return false;
+ }
+ // 初始化视图并添加到视图组
+ group[thisView] = p_EcgTestNeedAppOrNetworkView->EcgTestNeedAppOrNetworkInit();
+ container_->Add(group[thisView]);
+ }
+ return true;
+ }
struct EcgViewMapper
{
{ECGTESTANALYSISVIEW, &EcgView::ChangeEcgTestAnalysisView},
{ECGRESETTESTOFSUCCVIEW, &EcgView::ChangeEcgResetTestOfSuccView},
{ECGTESTRESULTVIEW, &EcgView::ChangeEcgTestResultView},
+ {ECGTESTNEEDAPPORNETWORKVIEW, &EcgView::ChangeEcgTestNeedAppOrNetworkView},
};
bool EcgView::ClickFunc(int16_t interface)