}
/* -------------------------------------------------------------------------- */
- void NativeLauncher::InitMessageSlice(void) // 系统:恢复出厂设置
+ void NativeLauncher::InitMessageSlice(void) // 消息中心
{
SliceProxy *messageview = new AbilitySliceProxy<MessageView, MessagePresenter>;
if (messageview == nullptr)
extern uint8_t battery_get_voltage(float *voltage);
+#include "hal_tick.h"
+
+#ifdef __cplusplus
+#if __cplusplus
+extern "C"
+{
+#endif
+#endif
+
+ extern uint8_t battery_get_voltage(float *voltage);
+#ifdef XTS_SUPPORT
+ extern uint8_t is_xts_test_done(void);
+#endif
+#ifdef __cplusplus
+#if __cplusplus
+}
+#endif
+#endif
+
namespace OHOS
{
#define CHANGEBUTTON "changebutton" // 切换表盘按键
}
};
+ class XTSCallback : public AnimatorCallback
+ {
+ public:
+ explicit XTSCallback(UILabel *XTSlabel) : XTSlabel(XTSlabel) {}
+ ~XTSCallback() {}
+ virtual void Callback(UIView *view)
+ {
+ uint8_t xts_testing = 1;
+#ifdef XTS_SUPPORT
+ xts_testing = is_xts_test_done();
+#endif
+ if (!xts_testing)
+ {
+ // XTS测试进行
+ xts_flag = 1;
+ XTSlabel->SetText("XTS测试进行中\n请勿操作表盘");
+ XTSlabel->SetTextColor(Color::GetColorFromRGBA(0xe6, 0x04, 0x09, 0xff));
+ }
+ else
+ {
+ // XTS测试结束
+ if (xts_flag)
+ {
+ XTSlabel->SetText("XTS测试结束");
+ XTSlabel->SetTextColor(Color::GetColorFromRGBA(0x4e, 0xe6, 0x04, 0xff));
+ xts_flag = 0; // 复位
+ }
+ }
+ }
+
+ private:
+ uint8_t xts_flag = 0; // 标志位
+ UILabel *XTSlabel{nullptr};
+ // std::thread workerThread;
+ // std::atomic<bool> stopThread;
+ };
+
class Digital_clockView : public UICardPage
{
Digital_clockView &operator=(Digital_clockView &&) = delete;
// UIViewGroup *container_ = nullptr;
+ /* --------------------------------- XTS监测标签 -------------------------------- */
+ UILabel *XTSLabel = nullptr;
+ AnimatorCallback *xtsCallback_ = nullptr;
+ Animator *xtsanimator_ = nullptr;
+ /* -------------------------------------------------------------------------- */
UIImageView *background = nullptr;
UIImageView *hour1 = nullptr;
UIImageView *hour2 = nullptr;
if (loadJsonData(JosnfilePath))
{
std::string Dialtype = cJSON_GetObjectItem(cjson_json, "Dialtype")->valuestring;
- /* -------------------------------------------------------------------------- */
-
- /* -------------------------------------------------------------------------- */
Initbackground();
if (Dialtype == "pointer")
{
Initdata();
Initweek();
Initbattery();
+ /* -------------------------------------------------------------------------- */
+#if XTS_SUPPORT
+ if (XTSLabel == nullptr)
+ {
+ XTSLabel = new UILabel();
+ }
+ XTSLabel->SetPosition(130, 273); // widget's left position and top position
+ XTSLabel->Resize(200, 60); // widget's width and height
+ XTSLabel->SetViewId("label1"); // Set style
+ XTSLabel->SetStyle(STYLE_TEXT_FONT, 30);
+
+ XTSLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ XTSLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ XTSLabel->SetRollSpeed(0);
+ XTSLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ Add(XTSLabel);
+ xtsCallback_ = new XTSCallback(XTSLabel);
+ xtsanimator_ = new Animator(xtsCallback_, XTSLabel, 1000, true);
+ xtsanimator_->Start();
+#endif
+ /* -------------------------------------------------------------------------- */
AddButton();
cJSON_Delete(cjson_json);
}
delete backgroundAnimator;
backgroundAnimator = nullptr;
}
+ /* -------------------------------------------------------------------------- */
+ delete XTSLabel;
+ XTSLabel = nullptr;
+ if (xtsCallback_ != nullptr)
+ {
+ delete xtsCallback_;
+ xtsCallback_ = nullptr;
+ }
+ if (xtsanimator_ != nullptr)
+ {
+ xtsanimator_->Stop();
+ delete xtsanimator_;
+ xtsanimator_ = nullptr;
+ }
+ /* -------------------------------------------------------------------------- */
}
/***
typedef struct
{
int index;
- const char *label; // 标签
const char *icon; // 图标
+ const char *label; // 标签
const char *labelbutton; // 未读
-
+ bool hasSecondMenu;
} MessageListItem;
class MessageListAdapter : public AbstractAdapter
private:
MessageItemView(const MessageItemView &);
- UIImageView sbackground; // 背景
- UILabel sLabel; // 标签
- UIImageView sIcon; // 图标
- UILabelButton sLabelButton; // 未读
- MessageListItem sItemInfo = {0, nullptr};
+ UIImageView sbackground; // 背景
+ UIImageView sIcon; // 图标
+ UILabel sLabel; // 标签
+ UILabelButton sLabelButton; // 未读
+ MessageListItem sItemInfo = {0, nullptr, nullptr, nullptr, false};
};
}
* @Author: Caisking 3449750381@qq.com
* @Date: 2024-01-23 16:03:34
* @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-01-23 17:22:49
+ * @LastEditTime: 2024-01-23 18:05:43
* @FilePath: /FD230/code/sdk/application/wearable/nativeapp/nativeui/message/include/MessageModel.h
* @Description:
* @
MessageModel(const MessageModel &);
MessageModel &operator=(const MessageModel &);
virtual ~MessageModel();
- static const uint16_t MessageListMaxNum = 6;
+ static const uint16_t MessageListMaxNum = 4;
MessageListItem Messages[MessageListMaxNum] = {0, nullptr};
//std::map<int, AppViewId> MessageIdToViewId;
bool btConnectStatus{false};
SetTouchable(true);
SetUpChild();
Add(&sbackground);
- Add(&sLabel);
Add(&sIcon);
+ Add(&sLabel);
Add(&sLabelButton);
}
sLabel.SetStyle(STYLE_TEXT_FONT, 30);
sLabel.SetStyle(STYLE_LINE_HEIGHT, 36);
sLabel.SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
- sLabel.SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
+ sLabel.SetTextColor(Color::White());
sLabel.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
sLabelButton.SetPosition(215, 25, 140, 50);
void MessageModel::InitMessageListItem()
{
- Messages[0] = {0, "/user/res/message/system-icon.bin", "系统", "暂无信息"};
- Messages[1] = {1, "/user/res/message/message-icon.bin", "信息", "暂无信息"};
- Messages[2] = {2, "/user/res/message/WeChat-icon.bin", "微信", "暂无信息"};
- Messages[3] = {3, "/user/res/message/QQ-icon.bin", "QQ", "暂无信息"};
+ Messages[0] = {0, "/user/res/message/system-icon.bin", "系统", "暂无信息", false};
+ Messages[1] = {1, "/user/res/message/message-icon.bin", "信息", "暂无信息", false};
+ Messages[2] = {2, "/user/res/message/WeChat-icon.bin", "微信", "暂无信息", false};
+ Messages[3] = {3, "/user/res/message/QQ-icon.bin", "QQ", "暂无信息", false};
}
const MessageListItem *MessageModel::GetMessagelistItems() const
* @Author: Caisking 3449750381@qq.com
* @Date: 2024-01-22 16:20:34
* @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-01-23 17:12:40
+ * @LastEditTime: 2024-01-23 18:11:40
* @FilePath: /FD230/code/sdk/application/wearable/nativeapp/nativeui/message/src/MessageView.cpp
* @Description:
* @
title->SetStyle(STYLE_LINE_HEIGHT, 36);
title->SetText("信息通知");
title->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
- title->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
+ title->SetStyle(STYLE_TEXT_COLOR, Color::White().full);
title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
/* -------------------------------------------------------------------------- */
//UIList 的适配器