mirror of https://github.com/meshcore-dev/MeshCore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.3 KiB
78 lines
2.3 KiB
#ifndef UI_MANAGER_h
|
|
#define UI_MANAGER_h
|
|
|
|
#include <Arduino.h>
|
|
#include "uiDefines.h"
|
|
#include <helpers/ContactInfo.h>
|
|
|
|
class UIManager {
|
|
private:
|
|
// functions
|
|
void format_datetime(char *buf, size_t size, const struct tm *timeinfo);
|
|
void timestampToTime(time_t timestamp, char *buffer, size_t buffer_size);
|
|
const char* convertDegreesToDirection(int degrees);
|
|
int windSpeedToBeaufort(float speed);
|
|
void getInitials(const char *name, char *out);
|
|
void formatLastSeen(uint32_t ts, char *out, size_t len);
|
|
|
|
// Calendar days and months
|
|
static const char *days[7];
|
|
static const char *months[12];
|
|
|
|
// vars
|
|
char time_str[9];
|
|
String lastUpdate = "";
|
|
char* tmp_buf;
|
|
|
|
lv_obj_t *chat_items[MAX_CHAT_MESSAGES];
|
|
int chat_count = 0;
|
|
int channelInputBaseY = 185;
|
|
int channelInputBaseKeybOnY = -15;
|
|
void onShowKeyboard();
|
|
void onHideKeyboard();
|
|
void ui_Screen1_screen_init(void);
|
|
|
|
lv_obj_t* ui_Screen1;
|
|
lv_obj_t* ui_TabView1;
|
|
lv_obj_t* ui_TabPageContacts;
|
|
lv_obj_t* ui_Contacts;
|
|
lv_obj_t* ui_ContactMessages;
|
|
lv_obj_t* ui_TabPageChannels;
|
|
lv_obj_t* ui_Channels;
|
|
lv_obj_t* ui_ChannelMessages;
|
|
lv_obj_t* ui_AutoLight;
|
|
lv_obj_t* ui____initial_actions0;
|
|
|
|
lv_obj_t* ui_DimOverlay;
|
|
lv_obj_t* ui_TabPageHome;
|
|
lv_obj_t* ui_ValueDate;
|
|
lv_obj_t* ui_ValueTime;
|
|
lv_obj_t* ui_TabPageSettings;
|
|
lv_obj_t* ui_DayLight;
|
|
lv_obj_t* ui_ChannelInput;
|
|
lv_obj_t* ui_SendBtn;
|
|
lv_obj_t* ui_Keyboard;
|
|
lv_obj_t* iu_SendLabel;
|
|
lv_obj_t* ui_ChannelDivider;
|
|
|
|
public:
|
|
UIManager();
|
|
|
|
void onChannelInputFocus(lv_event_t* e);
|
|
void onDimOverlayClick(lv_event_t* e);
|
|
void onSendClick(lv_event_t* e);
|
|
void onKeyboardEvent(lv_event_t* e);
|
|
void scroll_begin_event(lv_event_t* e);
|
|
|
|
void updateDateTime(const struct tm timeinfo);
|
|
void updateInfo(const char *str, uint32_t color);
|
|
void clearDateTime();
|
|
void updateValues();
|
|
void addPrivateChatBubble(const char *time_str, const char *msg, bool is_self);
|
|
void addChatBubble(const char *time_str, const char *sender, const char *msg,bool is_self);
|
|
void addContactToUI(ContactInfo c);
|
|
void handleContactClick(lv_event_t *e);
|
|
void setNightMode(bool night);
|
|
};
|
|
|
|
#endif
|