mirror of
https://github.com/m5stack/meshtastic-device-ui.git
synced 2026-05-20 11:51:03 -07:00
settings tabview
This commit is contained in:
@@ -1338,7 +1338,7 @@ void create_screen_main_screen() {
|
||||
objects.top_basic_settings_label = obj;
|
||||
lv_obj_set_pos(obj, 25, 0);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "Settings");
|
||||
lv_label_set_text(obj, "Settings (basic)");
|
||||
lv_obj_set_style_text_font(obj, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffe0e0e0), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_align(obj, LV_ALIGN_LEFT_MID, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
@@ -1551,81 +1551,6 @@ void create_screen_main_screen() {
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
// MsgPopupPanel
|
||||
lv_obj_t *obj = lv_obj_create(parent_obj);
|
||||
objects.msg_popup_panel = obj;
|
||||
lv_obj_set_pos(obj, 18, -20);
|
||||
lv_obj_set_size(obj, LV_PCT(85), 55);
|
||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff303030), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_color(obj, lv_color_hex(0xffff8c04), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_color(obj, lv_color_hex(0xffbb6c04), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_width(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_spread(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_ofs_y(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_ofs_x(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
{
|
||||
lv_obj_t *parent_obj = obj;
|
||||
{
|
||||
// MsgPopupButton
|
||||
lv_obj_t *obj = lv_btn_create(parent_obj);
|
||||
objects.msg_popup_button = obj;
|
||||
lv_obj_set_pos(obj, 0, 0);
|
||||
lv_obj_set_size(obj, 36, 36);
|
||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
||||
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_style_align(obj, LV_ALIGN_LEFT_MID, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff303030), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_image_src(obj, &img_msg_popup_button_image, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_ofs_y(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
// MsgPopupLabel
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.msg_popup_label = obj;
|
||||
lv_obj_set_pos(obj, 10, 0);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "New Message from\n");
|
||||
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffffffff), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
// AlertPanel
|
||||
lv_obj_t *obj = lv_obj_create(parent_obj);
|
||||
objects.alert_panel = obj;
|
||||
lv_obj_set_pos(obj, 18, -20);
|
||||
lv_obj_set_size(obj, LV_PCT(85), 55);
|
||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff303030), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_color(obj, lv_color_hex(0xffff0024), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_color(obj, lv_color_hex(0xffa10000), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_width(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_spread(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_ofs_y(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_ofs_x(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
{
|
||||
lv_obj_t *parent_obj = obj;
|
||||
{
|
||||
// AlertLabel
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.alert_label = obj;
|
||||
lv_obj_set_pos(obj, 10, 0);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "Resynch...");
|
||||
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffff0000), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_font(obj, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
// SettingsUsernamePanel
|
||||
lv_obj_t *obj = lv_obj_create(parent_obj);
|
||||
@@ -1666,7 +1591,7 @@ void create_screen_main_screen() {
|
||||
objects.settings_user_short_textarea = obj;
|
||||
lv_obj_set_pos(obj, 0, 18);
|
||||
lv_obj_set_size(obj, LV_PCT(42), 25);
|
||||
lv_textarea_set_max_length(obj, 5);
|
||||
lv_textarea_set_max_length(obj, 4);
|
||||
lv_textarea_set_one_line(obj, true);
|
||||
lv_textarea_set_password_mode(obj, false);
|
||||
lv_obj_set_style_pad_top(obj, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
@@ -1704,7 +1629,7 @@ void create_screen_main_screen() {
|
||||
objects.settings_user_long_textarea = obj;
|
||||
lv_obj_set_pos(obj, 0, 80);
|
||||
lv_obj_set_size(obj, LV_PCT(88), 25);
|
||||
lv_textarea_set_max_length(obj, 40);
|
||||
lv_textarea_set_max_length(obj, 39);
|
||||
lv_textarea_set_one_line(obj, true);
|
||||
lv_textarea_set_password_mode(obj, false);
|
||||
lv_obj_set_style_pad_top(obj, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
@@ -2581,6 +2506,81 @@ void create_screen_main_screen() {
|
||||
lv_obj_set_style_bg_color(obj, lv_color_hex(0xffccd1d8), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_max_width(obj, 400, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
// MsgPopupPanel
|
||||
lv_obj_t *obj = lv_obj_create(parent_obj);
|
||||
objects.msg_popup_panel = obj;
|
||||
lv_obj_set_pos(obj, 18, -20);
|
||||
lv_obj_set_size(obj, LV_PCT(85), 55);
|
||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff303030), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_color(obj, lv_color_hex(0xffff8c04), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_color(obj, lv_color_hex(0xffbb6c04), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_width(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_spread(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_ofs_y(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_ofs_x(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
{
|
||||
lv_obj_t *parent_obj = obj;
|
||||
{
|
||||
// MsgPopupButton
|
||||
lv_obj_t *obj = lv_btn_create(parent_obj);
|
||||
objects.msg_popup_button = obj;
|
||||
lv_obj_set_pos(obj, 0, 0);
|
||||
lv_obj_set_size(obj, 36, 36);
|
||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
||||
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_style_align(obj, LV_ALIGN_LEFT_MID, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff303030), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_image_src(obj, &img_msg_popup_button_image, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_ofs_y(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
// MsgPopupLabel
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.msg_popup_label = obj;
|
||||
lv_obj_set_pos(obj, 10, 0);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "New Message from\n");
|
||||
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffffffff), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
// AlertPanel
|
||||
lv_obj_t *obj = lv_obj_create(parent_obj);
|
||||
objects.alert_panel = obj;
|
||||
lv_obj_set_pos(obj, 18, -20);
|
||||
lv_obj_set_size(obj, LV_PCT(85), 55);
|
||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff303030), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_color(obj, lv_color_hex(0xffff0024), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_color(obj, lv_color_hex(0xffa10000), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_width(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_spread(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_ofs_y(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_shadow_ofs_x(obj, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
{
|
||||
lv_obj_t *parent_obj = obj;
|
||||
{
|
||||
// AlertLabel
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.alert_label = obj;
|
||||
lv_obj_set_pos(obj, 10, 0);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "Resynch...");
|
||||
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xffff0000), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_font(obj, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,62 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern lv_obj_t * ui_AdvancedSettingsPanel;
|
||||
extern lv_obj_t * ui_SettingsTabView;
|
||||
extern lv_obj_t * ui_TabPageGeneral;
|
||||
extern lv_obj_t * ui_GeneralLanguageButton;
|
||||
extern lv_obj_t * ui_LanguageLabel;
|
||||
extern lv_obj_t * ui_GeneralTimezoneButton;
|
||||
extern lv_obj_t * ui_TimezoneLabel;
|
||||
extern lv_obj_t * ui_GeneralScreenButton;
|
||||
extern lv_obj_t * ui_ScreenLabel;
|
||||
extern lv_obj_t * ui_GeneralMapsButton;
|
||||
extern lv_obj_t * ui_MapsLabel;
|
||||
extern lv_obj_t * ui_GeneralAudioButton;
|
||||
extern lv_obj_t * ui_AudioLabel1;
|
||||
extern lv_obj_t * ui_TabPageRadio;
|
||||
extern lv_obj_t * ui_RadioBluetoothButton;
|
||||
extern lv_obj_t * ui_BluetoothLabel;
|
||||
extern lv_obj_t * ui_RadioDeviceButton;
|
||||
extern lv_obj_t * ui_DeviceLabel;
|
||||
extern lv_obj_t * ui_RadioDisplayButton;
|
||||
extern lv_obj_t * ui_DisplayLabel;
|
||||
extern lv_obj_t * ui_RadioLoRaButton;
|
||||
extern lv_obj_t * ui_LoRaLabel;
|
||||
extern lv_obj_t * ui_RadioNetworkButton;
|
||||
extern lv_obj_t * ui_NetworkLabel;
|
||||
extern lv_obj_t * ui_RadioPositionButton;
|
||||
extern lv_obj_t * ui_PositionLabel;
|
||||
extern lv_obj_t * ui_RadioPowerButton;
|
||||
extern lv_obj_t * ui_PowerLabel;
|
||||
extern lv_obj_t * ui_TabPageModules;
|
||||
extern lv_obj_t * ui_ModuleCannedMsgButton;
|
||||
extern lv_obj_t * ui_CannedMsgLabel;
|
||||
extern lv_obj_t * ui_ModuleSaFButton;
|
||||
extern lv_obj_t * ui_StoreAndForwardLabel;
|
||||
extern lv_obj_t * ui_ModuleTelemetryButton;
|
||||
extern lv_obj_t * ui_TelemetryLabel;
|
||||
extern lv_obj_t * ui_ModuleMQTTButton;
|
||||
extern lv_obj_t * ui_MQTTLabel;
|
||||
extern lv_obj_t * ui_ModuleRangeTestButton;
|
||||
extern lv_obj_t * ui_RangeTestLabel;
|
||||
extern lv_obj_t * ui_ModuleAudioButton;
|
||||
extern lv_obj_t * ui_AudioLabel;
|
||||
extern lv_obj_t * ui_ModuleSerialButton;
|
||||
extern lv_obj_t * ui_SerialLabel;
|
||||
extern lv_obj_t * ui_ModuleExtNotificationButton;
|
||||
extern lv_obj_t * ui_ExtNotificationLabel;
|
||||
extern lv_obj_t * ui_ModuleNeighborInfoButton;
|
||||
extern lv_obj_t * ui_NeighborInfoLabel;
|
||||
extern lv_obj_t * ui_ModuleAmbientLightingButton;
|
||||
extern lv_obj_t * ui_AmbientLightingLabel;
|
||||
extern lv_obj_t * ui_ModuleDetectionSensorButton;
|
||||
extern lv_obj_t * ui_DetectionSensorLabel;
|
||||
extern lv_obj_t * ui_ModuleRemoteHardwareButton;
|
||||
extern lv_obj_t * ui_RemoteHardwareLabel;
|
||||
|
||||
void create_tabview_settings(void);
|
||||
|
||||
typedef struct _objects_t {
|
||||
lv_obj_t *boot_screen;
|
||||
lv_obj_t *main_screen;
|
||||
|
||||
@@ -27,6 +27,7 @@ void loadScreen(enum ScreensEnum screenId) {
|
||||
|
||||
void ui_init() {
|
||||
create_screens();
|
||||
create_tabview_settings();
|
||||
loadScreen(SCREEN_ID_BOOT_SCREEN);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -128,6 +128,8 @@ void TFTView_320x240::ui_set_active(lv_obj_t *b, lv_obj_t *p, lv_obj_t *tp)
|
||||
void TFTView_320x240::apply_hotfix(void)
|
||||
{
|
||||
lv_obj_set_scrollbar_mode(objects.home_container, LV_SCROLLBAR_MODE_OFF);
|
||||
lv_obj_set_scrollbar_mode(objects.settings_user_long_textarea, LV_SCROLLBAR_MODE_OFF);
|
||||
lv_obj_set_scrollbar_mode(objects.settings_modify_channel_psk_textarea, LV_SCROLLBAR_MODE_OFF);
|
||||
}
|
||||
|
||||
void TFTView_320x240::ui_events_init(void)
|
||||
@@ -293,8 +295,14 @@ void TFTView_320x240::ui_event_SettingsButton(lv_event_t *e)
|
||||
{
|
||||
lv_event_code_t event_code = lv_event_get_code(e);
|
||||
if (event_code == LV_EVENT_CLICKED && TFTView_320x240::instance()->activeSettings == eNone) {
|
||||
lv_obj_t *top_panel = advanced_mode ? objects.top_advanced_settings_panel : objects.top_settings_panel;
|
||||
TFTView_320x240::instance()->ui_set_active(objects.settings_button, objects.basic_settings_panel, top_panel);
|
||||
TFTView_320x240::instance()->ui_set_active(objects.settings_button, objects.basic_settings_panel,
|
||||
objects.top_settings_panel);
|
||||
} else if (event_code == LV_EVENT_LONG_PRESSED && !advanced_mode && TFTView_320x240::instance()->activeSettings == eNone) {
|
||||
advanced_mode = !advanced_mode;
|
||||
} else if (event_code == LV_EVENT_LONG_PRESSED && advanced_mode && TFTView_320x240::instance()->activeSettings == eNone) {
|
||||
advanced_mode = !advanced_mode;
|
||||
TFTView_320x240::instance()->ui_set_active(objects.settings_button, ui_AdvancedSettingsPanel,
|
||||
objects.top_advanced_settings_panel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user