${CMAKE_CURRENT_SOURCE_DIR}/nativeui/rotate/src/RotateView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/rotate/src/RotatePresenter.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/obumessage/src/OBUMessageitemView.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/obumessage/src/OBUMessageListAdapter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/obumessage/src/OBUMessageModel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/obumessage/src/OBUMessageView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/obumessage/src/OBUMessagePresenter.cpp
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-07 11:04:21
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-07 11:52:11
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/obumessage/include/OBUMessageListAdapter.h
+ */
+#ifndef OBU_MESSAGE_LIST_ADAPTER_H
+#define OBU_MESSAGE_LIST_ADAPTER_H
+
+#include "components/abstract_adapter.h"
+#include "components/ui_list.h"
+#include "obumessage/include/OBUMessageitemView.h"
+#include "OUBMessageItem.h"
+#include "iostream"
+#include <list>
+
+namespace OHOS
+{
+
+
+ class OBUMessageListAdapter : public AbstractAdapter
+ {
+ public:
+ OBUMessageListAdapter();
+ ~OBUMessageListAdapter();
+
+ void SetData(std::list<OBUItem> &data);
+ void ClearData(void);
+ std::list<OBUItem> &GetChatContentItem();
+ virtual uint16_t GetCount(void) override;
+ virtual UIView *GetView(UIView *inView, int16_t index) override;
+ void AddListItem(const OBUItem &item);
+
+ private:
+ std::list<OBUItem> listData;
+ int itemViewHeight{0};
+ bool aiAnswerFlag{false};
+ };
+}
+#endif
\ No newline at end of file
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-07-27 10:58:43
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-27 12:02:16
+ * @LastEditTime: 2024-08-07 11:37:56
* @FilePath: /xts_origin/FD230/code/sdk/application/wearable/fd230app/nativeui/obumessage/include/OBUMessageView..h
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
#include "components/ui_label.h"
#include "components/ui_button.h"
#include "components/ui_view_group.h"
+#include "components/ui_list.h"
+#include "obumessage/include/OBUMessageListAdapter.h"
namespace OHOS
{
class OBUMessagePresenter;
UILabel *title = nullptr;
UILabel *displayTimeLabel = nullptr;
UILabel *obuMessageLabel = nullptr;
+
+ OBUMessageListAdapter *obuAdapter{nullptr};
+ UIList *obuList{nullptr};
+
+ int count{0};
bool viewInitStatus{false};
};
}
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-07 11:05:29
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-07 11:58:19
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/obumessage/include/OBUMessageitemView.h
+ */
+#ifndef OBU_MESSAGE_ITEM_VIEW_H
+#define OBU_MESSAGE_ITEM_VIEW_H
+#include "components/ui_label.h"
+#include "OUBMessageItem.h"
+#include "obumessage/include/OBUMessageListAdapter.h"
+namespace OHOS
+{
+
+ class OBUMessageitemView : public UIViewGroup
+ {
+ public:
+ OBUMessageitemView();
+ ~OBUMessageitemView();
+ void SetItemInfo(const OBUItem itemInfo);
+ void SetUpChild();
+ UILabel label;
+ OBUItem sItemInfo = {0, ""};
+ };
+}
+#endif
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-07 11:54:25
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-07 11:54:42
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/obumessage/include/OUBMessageItem.h
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
+#include "iostream"
+#include "string"
+#ifndef OBU_MESSAGE_ITEM_H
+#define OBU_MESSAGE_ITEM_H
+
+namespace OHOS
+{
+ typedef struct
+ {
+ int index;
+ std::string text;
+ } OBUItem;
+
+}
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-07 11:04:32
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-07 11:40:27
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessageListAdapter.cpp
+ */
+#include "obumessage/include/OBUMessageListAdapter.h"
+#include "obumessage/include/OBUMessageitemView.h"
+
+namespace OHOS
+{
+
+ OBUMessageListAdapter::OBUMessageListAdapter() {}
+
+ OBUMessageListAdapter::~OBUMessageListAdapter()
+ {
+ listData.clear();
+ }
+
+ uint16_t OBUMessageListAdapter::GetCount(void)
+ {
+ return listData.size();
+ }
+
+ void OBUMessageListAdapter::ClearData(void)
+ {
+ if (!listData.empty())
+ {
+ listData.clear();
+ }
+ }
+
+ void OBUMessageListAdapter::SetData(std::list<OBUItem> &data)
+ {
+ if (!listData.empty())
+ {
+ listData.clear();
+ }
+ std::list<OBUItem>::iterator it;
+ for (it = data.begin(); it != data.end(); it++)
+ {
+ listData.push_back(*it);
+ }
+ }
+
+ UIView *OBUMessageListAdapter::GetView(UIView *inView, int16_t index)
+ {
+ if (listData.empty())
+ {
+ return nullptr;
+ }
+ if (index < 0)
+ {
+ return nullptr;
+ }
+ size_t uindex = index;
+ if (uindex >= listData.size())
+ {
+ return nullptr;
+ }
+
+ std::list<OBUItem>::iterator it = listData.begin();
+ for (int i = 0; i < index; i++)
+ {
+ it++;
+ }
+ OBUItem itemData = *it;
+ OBUMessageitemView *item = nullptr;
+ if (inView == nullptr)
+ {
+ item = new OBUMessageitemView();
+ }
+ else
+ {
+ item = static_cast<OBUMessageitemView *>(inView);
+ }
+ item->SetItemInfo(itemData);
+ return item;
+ }
+
+ void OBUMessageListAdapter::AddListItem(const OBUItem &item)
+ {
+ listData.push_back(item);
+ }
+} // namespace OHOS
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-05-07 11:25:58
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-27 14:06:08
+ * @LastEditTime: 2024-08-07 12:11:00
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessageView.cpp
*/
#include "obumessage/include/OBUMessagePresenter.h"
delete obuMessageLabel;
obuMessageLabel = nullptr;
}
+ if (obuAdapter != nullptr)
+ {
+ delete obuAdapter;
+ obuAdapter = nullptr;
+ }
+ if (obuList != nullptr)
+ {
+ delete obuList;
+ obuList = nullptr;
+ }
delete group;
group = nullptr;
}
obuMessageLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
obuMessageLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);
group->Add(obuMessageLabel);
+
+ /*
+ obuAdapter = new OBUMessageListAdapter();
+ if (obuAdapter == nullptr)
+ {
+ return;
+ }
+ obuList = new UIList(UIList::VERTICAL);
+ if (obuList == nullptr)
+ {
+ return;
+ }
+ obuList->SetPosition(53, 30, 360, 250);
+ obuList->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+ obuList->EnableAutoAlign(true);
+ obuList->SetTouchable(true);
+ obuList->SetDraggable(true);
+ obuList->SetThrowDrag(true);
+ obuList->SetReboundSize(35);
+ obuList->SetMaxScrollDistance(1000);
+ obuList->SetSwipeACCLevel(800); // 800: compensation distance
+ obuList->SetDragACCLevel(5); // 5: drag acceleration
+ obuList->SetRotateFactor(2);
+ obuList->RequestFocus();
+ obuList->SetIntercept(true);
+ obuList->SetAdapter(obuAdapter);
+ obuList->RefreshList();
+ group->Add(obuList);
+ */
+
viewInitStatus = true;
}
}
displayTimeLabel->SetText(labelTimeStr.c_str()); /*时间更新:时:分:秒*/
obuMessageLabel->SetText(rxdataStr.c_str()); /*数据更新*/
+ /*
+ OBUItem item;
+ item.index = count++;
+ item.text = rxdataStr;
+ if (count >= 50)
+ {
+ count = 0;
+ obuAdapter->ClearData();
+ }
+ obuAdapter->AddListItem(item);
+ obuList->RefreshList();
+ obuList->SetStartIndex(count);
+ */
}
}
\ No newline at end of file
--- /dev/null
+#include "obumessage/include/OBUMessageitemView.h"
+
+namespace OHOS
+{
+ OBUMessageitemView::OBUMessageitemView()
+ {
+ SetPosition(0, 0, 360, 250);
+ SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+ SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ SetUpChild();
+ Add(&label);
+ }
+
+ OBUMessageitemView::~OBUMessageitemView()
+ {
+ Remove(&label);
+ }
+
+ void OBUMessageitemView::SetItemInfo(const OBUItem itemInfo)
+ {
+ sItemInfo = itemInfo;
+ label.SetText(itemInfo.text.c_str());
+ }
+
+ void OBUMessageitemView::SetUpChild()
+ {
+ label.SetPosition(0, 0, 360, 250);
+ label.SetStyle(STYLE_BORDER_RADIUS, 33);
+ label.SetStyle(STYLE_TEXT_FONT, 40);
+ label.SetStyle(STYLE_LINE_HEIGHT, 45);
+ label.SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
+ label.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);
+ }
+
+}
\ No newline at end of file