Skip to content

Commit e560cc7

Browse files
authored
Styling fixes for paper displays (#514)
1 parent aa7530e commit e560cc7

File tree

15 files changed

+58
-33
lines changed

15 files changed

+58
-33
lines changed

Modules/lvgl-module/source/symbols.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,7 @@ const struct ModuleSymbol lvgl_module_symbols[] = {
435435
// lv_binfont
436436
DEFINE_MODULE_SYMBOL(lv_binfont_create),
437437
DEFINE_MODULE_SYMBOL(lv_binfont_destroy),
438+
// lv_style_gen
439+
DEFINE_MODULE_SYMBOL(lv_style_set_text_font),
438440
MODULE_SYMBOL_TERMINATOR
439441
};

Tactility/Source/app/addgps/AddGps.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ class AddGpsApp final : public App {
122122
lv_dropdown_set_options(uartDropdown, uart_options.c_str());
123123
lv_obj_align(uartDropdown, LV_ALIGN_TOP_RIGHT, 0, 0);
124124
lv_obj_set_width(uartDropdown, LV_PCT(50));
125-
lv_obj_set_style_border_color(uartDropdown, lv_color_hex(0xFAFAFA), LV_PART_MAIN);
126-
lv_obj_set_style_border_width(uartDropdown, 1, LV_PART_MAIN);
127125

128126
auto* uart_label = lv_label_create(uart_wrapper);
129127
lv_obj_align(uart_label, LV_ALIGN_TOP_LEFT, 0, 10);
@@ -144,8 +142,6 @@ class AddGpsApp final : public App {
144142
lv_dropdown_set_options(modelDropdown, model_options.c_str());
145143
lv_obj_align(modelDropdown, LV_ALIGN_TOP_RIGHT, 0, 0);
146144
lv_obj_set_width(modelDropdown, LV_PCT(50));
147-
lv_obj_set_style_border_color(modelDropdown, lv_color_hex(0xFAFAFA), LV_PART_MAIN);
148-
lv_obj_set_style_border_width(modelDropdown, 1, LV_PART_MAIN);
149145

150146
auto* model_label = lv_label_create(model_wrapper);
151147
lv_obj_align(model_label, LV_ALIGN_TOP_LEFT, 0, 10);
@@ -164,8 +160,6 @@ class AddGpsApp final : public App {
164160
lv_dropdown_set_options(baudDropdown, baudRatesDropdownValues);
165161
lv_obj_align(baudDropdown, LV_ALIGN_TOP_RIGHT, 0, 0);
166162
lv_obj_set_width(baudDropdown, LV_PCT(50));
167-
lv_obj_set_style_border_color(baudDropdown, lv_color_hex(0xFAFAFA), LV_PART_MAIN);
168-
lv_obj_set_style_border_width(baudDropdown, 1, LV_PART_MAIN);
169163

170164
auto* baud_rate_label = lv_label_create(baud_wrapper);
171165
lv_obj_align(baud_rate_label, LV_ALIGN_TOP_LEFT, 0, 10);

Tactility/Source/app/chat/ChatView.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ void ChatView::addMessageToList(lv_obj_t* list, const StoredMessage& msg) {
2424
lv_obj_set_style_pad_all(label, 2, 0);
2525

2626
if (msg.isOwn) {
27-
lv_obj_set_style_text_color(label, lv_color_hex(0x80C0FF), 0);
27+
if (lv_display_get_color_format(lv_obj_get_display(label)) != LV_COLOR_FORMAT_L8) {
28+
lv_obj_set_style_text_color(label, lv_color_hex(0x80C0FF), 0);
29+
}
2830
}
2931
}
3032

@@ -155,7 +157,9 @@ void ChatView::init(AppContext& appContext, lv_obj_t* parent) {
155157
msgList = lv_list_create(parent);
156158
lv_obj_set_flex_grow(msgList, 1);
157159
lv_obj_set_width(msgList, LV_PCT(100));
158-
lv_obj_set_style_bg_color(msgList, lv_color_hex(0x262626), 0);
160+
if (lv_display_get_color_format(lv_obj_get_display(parent)) != LV_COLOR_FORMAT_L8) {
161+
lv_obj_set_style_bg_color(msgList, lv_color_hex(0x262626), 0);
162+
}
159163
lv_obj_set_style_border_width(msgList, 0, 0);
160164
lv_obj_set_style_pad_ver(msgList, 2, 0);
161165
lv_obj_set_style_pad_hor(msgList, 4, 0);

Tactility/Source/app/development/Development.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ class DevelopmentApp final : public App {
147147
lv_label_set_text(warning_label, "This feature is experimental and uses an unsecured http connection.");
148148
lv_obj_set_width(warning_label, LV_PCT(100));
149149
lv_label_set_long_mode(warning_label, LV_LABEL_LONG_WRAP);
150-
lv_obj_set_style_text_color(warning_label, lv_color_make(0xff, 0xff, 00), LV_STATE_DEFAULT);
150+
if (lv_display_get_color_format(lv_obj_get_display(parent)) != LV_COLOR_FORMAT_L8) {
151+
lv_obj_set_style_text_color(warning_label, lv_color_make(0xff, 0xff, 0x00), LV_STATE_DEFAULT);
152+
}
151153

152154
updateViewState();
153155

Tactility/Source/app/display/Display.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,6 @@ class DisplayApp final : public App {
203203
// Note: order correlates with settings::display::Orientation item order
204204
lv_dropdown_set_options(orientation_dropdown, "Landscape\nPortrait Right\nLandscape Flipped\nPortrait Left");
205205
lv_obj_align(orientation_dropdown, LV_ALIGN_RIGHT_MID, 0, 0);
206-
lv_obj_set_style_border_color(orientation_dropdown, lv_color_hex(0xFAFAFA), LV_PART_MAIN);
207-
lv_obj_set_style_border_width(orientation_dropdown, 1, LV_PART_MAIN);
208206
lv_obj_add_event_cb(orientation_dropdown, onOrientationSet, LV_EVENT_VALUE_CHANGED, this);
209207
// Set the dropdown to match current orientation enum
210208
lv_dropdown_set_selected(orientation_dropdown, static_cast<uint16_t>(displaySettings.orientation));
@@ -240,8 +238,6 @@ class DisplayApp final : public App {
240238
timeoutDropdown = lv_dropdown_create(timeout_select_wrapper);
241239
lv_dropdown_set_options(timeoutDropdown, "15 seconds\n30 seconds\n1 minute\n2 minutes\n5 minutes\nNever");
242240
lv_obj_align(timeoutDropdown, LV_ALIGN_RIGHT_MID, 0, 0);
243-
lv_obj_set_style_border_color(timeoutDropdown, lv_color_hex(0xFAFAFA), LV_PART_MAIN);
244-
lv_obj_set_style_border_width(timeoutDropdown, 1, LV_PART_MAIN);
245241
lv_obj_add_event_cb(timeoutDropdown, onTimeoutChanged, LV_EVENT_VALUE_CHANGED, this);
246242
// Initialize dropdown selection from settings
247243
uint32_t ms = displaySettings.backlightTimeoutMs;
@@ -276,8 +272,6 @@ class DisplayApp final : public App {
276272
// Note: order correlates with settings::display::ScreensaverType enum order
277273
lv_dropdown_set_options(screensaverDropdown, "None\nBouncing Balls\nMystify\nMatrix Rain");
278274
lv_obj_align(screensaverDropdown, LV_ALIGN_RIGHT_MID, 0, 0);
279-
lv_obj_set_style_border_color(screensaverDropdown, lv_color_hex(0xFAFAFA), LV_PART_MAIN);
280-
lv_obj_set_style_border_width(screensaverDropdown, 1, LV_PART_MAIN);
281275
lv_obj_add_event_cb(screensaverDropdown, onScreensaverChanged, LV_EVENT_VALUE_CHANGED, this);
282276
lv_dropdown_set_selected(screensaverDropdown, static_cast<uint16_t>(displaySettings.screensaverType));
283277
if (!displaySettings.backlightTimeoutEnabled) {

Tactility/Source/app/i2cscanner/I2cScanner.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ void I2cScannerApp::onShow(AppContext& app, lv_obj_t* parent) {
128128
lv_dropdown_set_options(port_dropdown, dropdown_items.c_str());
129129
lv_obj_set_width(port_dropdown, LV_PCT(48));
130130
lv_obj_align(port_dropdown, LV_ALIGN_TOP_RIGHT, 0, 0);
131-
lv_obj_set_style_border_color(port_dropdown, lv_color_hex(0xFAFAFA), LV_PART_MAIN);
132-
lv_obj_set_style_border_width(port_dropdown, 1, LV_PART_MAIN);
133131
lv_obj_add_event_cb(port_dropdown, onSelectBusCallback, LV_EVENT_VALUE_CHANGED, this);
134132
auto selected_bus = getLastBusIndex();
135133
lv_dropdown_set_selected(port_dropdown, selected_bus);

Tactility/Source/app/keyboard/KeyboardSettings.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ class KeyboardSettingsApp final : public App {
161161
timeoutDropdown = lv_dropdown_create(timeout_select_wrapper);
162162
lv_dropdown_set_options(timeoutDropdown, "15 seconds\n30 seconds\n1 minute\n2 minutes\n5 minutes\nNever");
163163
lv_obj_align(timeoutDropdown, LV_ALIGN_RIGHT_MID, 0, 0);
164-
lv_obj_set_style_border_color(timeoutDropdown, lv_color_hex(0xFAFAFA), LV_PART_MAIN);
165-
lv_obj_set_style_border_width(timeoutDropdown, 1, LV_PART_MAIN);
166164
lv_obj_add_event_cb(timeoutDropdown, onTimeoutChanged, LV_EVENT_VALUE_CHANGED, this);
167165
// Initialize dropdown selection from settings
168166
lv_dropdown_set_selected(timeoutDropdown, timeoutMsToIndex(kbSettings.backlightTimeoutMs));

Tactility/Source/app/notes/Notes.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ class NotesApp final : public App {
133133
lv_dropdown_set_text(uiDropDownMenu, "Menu");
134134
lv_dropdown_set_symbol(uiDropDownMenu, LV_SYMBOL_DOWN);
135135
lv_dropdown_set_selected_highlight(uiDropDownMenu, false);
136-
lv_obj_set_style_border_color(uiDropDownMenu, lv_color_hex(0xFAFAFA), LV_PART_MAIN);
137-
lv_obj_set_style_border_width(uiDropDownMenu, 1, LV_PART_MAIN);
138136
lv_obj_align(uiDropDownMenu, LV_ALIGN_RIGHT_MID, 0, 0);
139137
lv_obj_add_event_cb(uiDropDownMenu,
140138
[](lv_event_t* e) {
@@ -153,24 +151,33 @@ class NotesApp final : public App {
153151
lv_obj_set_height(wrapper, LV_PCT(100));
154152
lv_obj_set_style_pad_all(wrapper, 0, LV_PART_MAIN);
155153
lv_obj_set_style_pad_row(wrapper, 0, LV_PART_MAIN);
156-
lv_obj_set_style_border_width(wrapper, 0, 0);
154+
lv_obj_set_style_border_width(wrapper, 0, LV_PART_MAIN);
157155
lv_obj_remove_flag(wrapper, LV_OBJ_FLAG_SCROLLABLE);
158156

159157
uiNoteText = lv_textarea_create(wrapper);
160158
lv_obj_set_width(uiNoteText, LV_PCT(100));
161159
lv_obj_set_height(uiNoteText, LV_PCT(86));
162160
lv_textarea_set_password_mode(uiNoteText, false);
163-
lv_obj_set_style_bg_color(uiNoteText, lv_color_hex(0x262626), LV_PART_MAIN);
161+
if (lv_display_get_color_format(lv_obj_get_display(parent)) != LV_COLOR_FORMAT_L8) {
162+
lv_obj_set_style_bg_color(uiNoteText, lv_color_hex(0x262626), LV_PART_MAIN);
163+
}
164164
lv_textarea_set_placeholder_text(uiNoteText, "Notes...");
165165

166166
lv_obj_t* footer = lv_obj_create(wrapper);
167167
lv_obj_set_flex_flow(footer, LV_FLEX_FLOW_ROW);
168168
lv_obj_set_flex_align(footer, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
169-
lv_obj_set_style_bg_color(footer, lv_color_hex(0x262626), LV_PART_MAIN);
169+
if (lv_display_get_color_format(lv_obj_get_display(parent)) == LV_COLOR_FORMAT_L8) {
170+
lv_obj_set_style_bg_color(footer, lv_color_hex(0xEEEEEE), LV_PART_MAIN);
171+
lv_obj_set_style_border_width(footer, 1, LV_PART_MAIN);
172+
lv_obj_set_style_border_color(footer, lv_theme_get_color_secondary(footer), LV_PART_MAIN);
173+
lv_obj_set_style_border_side(footer, LV_BORDER_SIDE_TOP, LV_PART_MAIN);
174+
} else {
175+
lv_obj_set_style_bg_color(footer, lv_color_hex(0x262626), LV_PART_MAIN);
176+
lv_obj_set_style_border_width(footer, 0, LV_PART_MAIN);
177+
}
170178
lv_obj_set_width(footer, LV_PCT(100));
171179
lv_obj_set_height(footer, LV_PCT(14));
172180
lv_obj_set_style_pad_all(footer, 0, LV_PART_MAIN);
173-
lv_obj_set_style_border_width(footer, 0, 0);
174181
lv_obj_remove_flag(footer, LV_OBJ_FLAG_SCROLLABLE);
175182

176183
uiCurrentFileName = lv_label_create(footer);

Tactility/Source/app/screenshot/Screenshot.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ void ScreenshotApp::createModeSettingWidgets(lv_obj_t* parent) {
170170
modeDropdown = lv_dropdown_create(mode_wrapper);
171171
lv_dropdown_set_options(modeDropdown, "Timer\nApp start");
172172
lv_obj_align_to(modeDropdown, mode_label, LV_ALIGN_OUT_RIGHT_MID, 8, 0);
173-
lv_obj_set_style_border_color(modeDropdown, lv_color_hex(0xFAFAFA), LV_PART_MAIN);
174-
lv_obj_set_style_border_width(modeDropdown, 1, LV_PART_MAIN);
175173
lv_obj_add_event_cb(modeDropdown, onModeSetCallback, LV_EVENT_VALUE_CHANGED, nullptr);
176174
service::screenshot::Mode mode = service->getMode();
177175
if (mode == service::screenshot::Mode::Apps) {

Tactility/Source/app/trackball/TrackballSettings.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ class TrackballSettingsApp final : public App {
139139
trackballModeDropdown = lv_dropdown_create(tb_mode_wrapper);
140140
lv_dropdown_set_options(trackballModeDropdown, "Encoder\nPointer");
141141
lv_obj_align(trackballModeDropdown, LV_ALIGN_RIGHT_MID, 0, 0);
142-
lv_obj_set_style_border_color(trackballModeDropdown, lv_color_hex(0xFAFAFA), LV_PART_MAIN);
143-
lv_obj_set_style_border_width(trackballModeDropdown, 1, LV_PART_MAIN);
144142
lv_dropdown_set_selected(trackballModeDropdown, modeToDropdownIndex(tbSettings.trackballMode));
145143
lv_obj_add_event_cb(trackballModeDropdown, onTrackballModeChanged, LV_EVENT_VALUE_CHANGED, this);
146144

0 commit comments

Comments
 (0)