From a3eb2dd9dc2399ce9c22cd3b07f482f080976440 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 11 Jul 2024 15:11:28 +1000 Subject: WIP improve bluetooth api and settings screen --- lua/settings.lua | 105 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 83 insertions(+), 22 deletions(-) (limited to 'lua') diff --git a/lua/settings.lua b/lua/settings.lua index cb7f65e0..0691f2d1 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -30,10 +30,37 @@ local SettingsScreen = widgets.MenuScreen:new { end } +local BluetoothPairing = SettingsScreen:new { + title = "Nearby Devices", + createUi = function(self) + SettingsScreen.createUi(self) + + local devices = self.content:List { + w = lvgl.PCT(100), + h = lvgl.SIZE_CONTENT, + } + + self.bindings = self.bindings + { + bluetooth.discovered_devices:bind(function(devs) + devices:clean() + for _, dev in pairs(devs) do + devices:add_btn(nil, dev.name):onClicked(function() + bluetooth.paired_device:set(dev) + end) + end + end) + } + end, + onShown = function() bluetooth.discovering:set(true) end, + onHidden = function() bluetooth.discovering:set(false) end, +} + local BluetoothSettings = SettingsScreen:new { title = "Bluetooth", createUi = function(self) SettingsScreen.createUi(self) + + -- Enable/Disable switch local enable_container = self.content:Object { flex = { flex_direction = "row", @@ -52,11 +79,43 @@ local BluetoothSettings = SettingsScreen:new { bluetooth.enabled:set(enabled) end) - theme.set_style(self.content:Label { - text = "Paired Device", - pad_bottom = 1, - }, "settings_title") + self.bindings = self.bindings + { + bluetooth.enabled:bind(function(en) + if en then + enable_sw:add_state(lvgl.STATE.CHECKED) + else + enable_sw:clear_state(lvgl.STATE.CHECKED) + end + end), + } + + -- Connection status + -- This is presented as a label on the field showing the currently paired + -- device. + + local paired_label = + self.content:Label { + text = "", + pad_bottom = 1, + } + theme.set_style(paired_label, "settings_title") + + self.bindings = self.bindings + { + bluetooth.connected:bind(function(conn) + if conn then + paired_label:set { text = "Connected to:" } + else + paired_label:set { text = "Paired with:" } + end + end), + bluetooth.connecting:bind(function(conn) + if conn then + paired_label:set { text = "Connecting to:" } + end + end), + } + -- The name of the currently paired device. local paired_container = self.content:Object { flex = { flex_direction = "row", @@ -78,24 +137,7 @@ local BluetoothSettings = SettingsScreen:new { bluetooth.paired_device:set() end) - theme.set_style(self.content:Label { - text = "Nearby Devices", - pad_bottom = 1, - }, "settings_title") - - local devices = self.content:List { - w = lvgl.PCT(100), - h = lvgl.SIZE_CONTENT, - } - self.bindings = self.bindings + { - bluetooth.enabled:bind(function(en) - if en then - enable_sw:add_state(lvgl.STATE.CHECKED) - else - enable_sw:clear_state(lvgl.STATE.CHECKED) - end - end), bluetooth.paired_device:bind(function(device) if device then paired_device:set { text = device.name } @@ -105,7 +147,20 @@ local BluetoothSettings = SettingsScreen:new { clear_paired:add_flag(lvgl.FLAG.HIDDEN) end end), - bluetooth.devices:bind(function(devs) + } + + theme.set_style(self.content:Label { + text = "Known Devices", + pad_bottom = 1, + }, "settings_title") + + local devices = self.content:List { + w = lvgl.PCT(100), + h = lvgl.SIZE_CONTENT, + } + + self.bindings = self.bindings + { + bluetooth.known_devices:bind(function(devs) devices:clean() for _, dev in pairs(devs) do devices:add_btn(nil, dev.name):onClicked(function() @@ -114,6 +169,12 @@ local BluetoothSettings = SettingsScreen:new { end end) } + + local pair_new = self.content:Button {} + pair_new:Label { text = "Pair new device" } + pair_new:onClicked(function() + backstack.push(BluetoothPairing:new()) + end) end } -- cgit v1.2.3 From f78de39a750d58bfe883a789aa6cc4b0a5d9b9e7 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 12 Jul 2024 14:40:54 +1000 Subject: Give Bluetooth settings a bit of a refresh It's now a bit more responsive to stuff happening, gives you more information, and remembers your previously paired devices for faster switching between them. --- lua/settings.lua | 46 +++++++++++++++++++++++++++++++++------------- lua/widgets.lua | 9 ++++----- 2 files changed, 37 insertions(+), 18 deletions(-) (limited to 'lua') diff --git a/lua/settings.lua b/lua/settings.lua index 0691f2d1..3751a12a 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -46,6 +46,7 @@ local BluetoothPairing = SettingsScreen:new { for _, dev in pairs(devs) do devices:add_btn(nil, dev.name):onClicked(function() bluetooth.paired_device:set(dev) + backstack.pop() end) end end) @@ -101,16 +102,15 @@ local BluetoothSettings = SettingsScreen:new { theme.set_style(paired_label, "settings_title") self.bindings = self.bindings + { - bluetooth.connected:bind(function(conn) - if conn then - paired_label:set { text = "Connected to:" } - else - paired_label:set { text = "Paired with:" } - end - end), bluetooth.connecting:bind(function(conn) if conn then paired_label:set { text = "Connecting to:" } + else + if bluetooth.connected:get() then + paired_label:set { text = "Connected to:" } + else + paired_label:set { text = "Paired with:" } + end end end), } @@ -159,22 +159,42 @@ local BluetoothSettings = SettingsScreen:new { h = lvgl.SIZE_CONTENT, } + -- 'Pair new device' button that goes to the discovery screen. + + local button_container = self.content:Object { + w = lvgl.PCT(100), + h = lvgl.SIZE_CONTENT, + flex = { + flex_direction = "row", + justify_content = "center", + align_items = "space-evenly", + align_content = "center", + }, + pad_top = 4, + pad_column = 4, + } + button_container:add_style(styles.list_item) + + local pair_new = button_container:Button {} + pair_new:Label { text = "Pair new device" } + pair_new:onClicked(function() + backstack.push(BluetoothPairing:new()) + end) + + self.bindings = self.bindings + { bluetooth.known_devices:bind(function(devs) + local group = lvgl.group.get_default() + group.remove_obj(pair_new) devices:clean() for _, dev in pairs(devs) do devices:add_btn(nil, dev.name):onClicked(function() bluetooth.paired_device:set(dev) end) end + group:add_obj(pair_new) end) } - - local pair_new = self.content:Button {} - pair_new:Label { text = "Pair new device" } - pair_new:onClicked(function() - backstack.push(BluetoothPairing:new()) - end) end } diff --git a/lua/widgets.lua b/lua/widgets.lua index c3573c0b..c7a24576 100644 --- a/lua/widgets.lua +++ b/lua/widgets.lua @@ -79,11 +79,10 @@ function widgets.Row(parent, left, right) } end -local bindings_meta = { - __add = function(a, b) - return table.move(a, 1, #a, #b + 1, b) - end -} +local bindings_meta = {} +bindings_meta["__add"] = function(a, b) + return setmetatable(table.move(a, 1, #a, #b + 1, b), bindings_meta) +end function widgets.StatusBar(parent, opts) local root = parent.root:Object { -- cgit v1.2.3 From 24fde7af0cc411e897e28ba4612105c4aa9bee18 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 12 Jul 2024 16:14:52 +1000 Subject: Disable shuffle when selecting 'play all' --- lua/browser.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'lua') diff --git a/lua/browser.lua b/lua/browser.lua index ce0f7978..f8f87a6a 100644 --- a/lua/browser.lua +++ b/lua/browser.lua @@ -84,6 +84,7 @@ return screen:new{ local play = widgets.IconBtn(buttons, "//lua/img/play_small.png", "Play") play:onClicked(function() queue.clear() + queue.random:set(false) queue.add(original_iterator) playback.playing:set(true) backstack.push(playing:new()) -- cgit v1.2.3 From 0ca82fb1d14ea996195dc956bf40cd4ea7e35728 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 17 Jul 2024 13:37:38 +1000 Subject: Fix the top bar scrolling off the screen on the licenses screen --- lua/licenses.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/licenses.lua b/lua/licenses.lua index b8c71f36..5c8d12cf 100644 --- a/lua/licenses.lua +++ b/lua/licenses.lua @@ -64,7 +64,7 @@ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR I end return function(self) - local container = self.root:Object { + local container = self.content:Object { flex = { flex_direction = "column", flex_wrap = "nowrap", -- cgit v1.2.3 From 374bc5e734c230a1e9220d126eb401b478dcd571 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 17 Jul 2024 13:38:19 +1000 Subject: Add a screen for FCC and CE regulatory nonsense --- lua/img/ce.png | Bin 0 -> 1276 bytes lua/img/weee.png | Bin 0 -> 1395 bytes lua/settings.lua | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 lua/img/ce.png create mode 100644 lua/img/weee.png (limited to 'lua') diff --git a/lua/img/ce.png b/lua/img/ce.png new file mode 100644 index 00000000..dae12bc6 Binary files /dev/null and b/lua/img/ce.png differ diff --git a/lua/img/weee.png b/lua/img/weee.png new file mode 100644 index 00000000..ca0a5ddd Binary files /dev/null and b/lua/img/weee.png differ diff --git a/lua/settings.lua b/lua/settings.lua index 3751a12a..761f6ff4 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -9,6 +9,7 @@ local bluetooth = require("bluetooth") local theme = require("theme") local database = require("database") local usb = require("usb") +local font = require("font") local SettingsScreen = widgets.MenuScreen:new { show_back = true, @@ -551,7 +552,107 @@ local LicensesScreen = SettingsScreen:new { title = "Licenses", createUi = function(self) SettingsScreen.createUi(self) - self.root = require("licenses")(self) + require("licenses")(self) + end +} + +local FccStatementScreen = SettingsScreen:new { + title = "FCC Statement", + createUi = function(self) + SettingsScreen.createUi(self) + + local text_part = function(text) + self.content:Label { + w = lvgl.PCT(100), + h = lvgl.SIZE_CONTENT, + text = text, + text_font = font.fusion_10, + long_mode = lvgl.LABEL.LONG_WRAP, + } + end + + text_part( + "This device complies with part 15 of the FCC Rules. Operation is subject to the following two conditions:") + text_part("(1) This device may not cause harmful interference, and") + text_part( + "(2) this device must accept any interference received, including interference that may cause undesired operation.") + + local scroller = self.content:Object { w = 1, h = 1 } + scroller:onevent(lvgl.EVENT.FOCUSED, function() + scroller:scroll_to_view(1); + end) + lvgl.group.get_default():add_obj(scroller) + end +} + +local RegulatoryScreen = SettingsScreen:new { + title = "Regulatory", + createUi = function(self) + SettingsScreen.createUi(self) + local version = require("version") + + local small_row = function(left, right) + local container = self.content:Object { + flex = { + flex_direction = "row", + justify_content = "flex-start", + align_items = "flex-start", + align_content = "flex-start" + }, + w = lvgl.PCT(100), + h = lvgl.SIZE_CONTENT + } + container:add_style(styles.list_item) + container:Label { + text = left, + flex_grow = 1, + text_font = font.fusion_10, + } + container:Label { + text = right, + text_font = font.fusion_10, + } + end + small_row("Manufacturer", "cool tech zone") + small_row("Product model", "CTZ-1") + small_row("FCC ID", "2BG33-CTZ1") + + local button_container = self.content:Object { + w = lvgl.PCT(100), + h = lvgl.SIZE_CONTENT, + flex = { + flex_direction = "row", + justify_content = "center", + align_items = "space-evenly", + align_content = "center", + }, + pad_top = 4, + pad_column = 4, + } + button_container:add_style(styles.list_item) + + local button = button_container:Button {} + button:Label { text = "FCC Statement" } + button:onClicked(function() + backstack.push(FccStatementScreen:new()) + end) + + local logo_container = self.content:Object { + w = lvgl.PCT(100), + h = lvgl.SIZE_CONTENT, + flex = { + flex_direction = "row", + justify_content = "center", + align_items = "center", + align_content = "center", + }, + pad_top = 4, + pad_column = 4, + } + button_container:add_style(styles.list_item) + + logo_container:Image { src = "//lua/img/ce.png" } + logo_container:Image { src = "//lua/img/weee.png" } end } @@ -597,5 +698,6 @@ return widgets.MenuScreen:new { submenu("Database", DatabaseSettings) submenu("Firmware", FirmwareSettings) submenu("Licenses", LicensesScreen) + submenu("Regulatory", RegulatoryScreen) end } -- cgit v1.2.3 From d8ce31e46b0dea356dd415b62f71c265bea54d2a Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 17 Jul 2024 13:38:44 +1000 Subject: Scroll to top when selecting the back button --- lua/widgets.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lua') diff --git a/lua/widgets.lua b/lua/widgets.lua index c7a24576..78d53a57 100644 --- a/lua/widgets.lua +++ b/lua/widgets.lua @@ -113,6 +113,16 @@ function widgets.StatusBar(parent, opts) local label = back:Label({ text = "<", align = lvgl.ALIGN.CENTER }) widgets.Description(label, "Back") back:onClicked(opts.back_cb) + back:onevent(lvgl.EVENT.FOCUSED, function() + local first_view = parent.content + if not first_view then return end + while first_view:get_child_cnt() > 0 do + first_view = first_view:get_child(0) + end + if first_view then + first_view:scroll_to_view_recursive(1) + end + end) end local title = root:Label { -- cgit v1.2.3 From 7012e64a14841fb018289529d08e5542e33f2151 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 17 Jul 2024 14:13:03 +1000 Subject: Fix an error in the scroll sensitivity UI --- lua/settings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/settings.lua b/lua/settings.lua index 761f6ff4..49a826af 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -344,7 +344,7 @@ local InputSettings = SettingsScreen:new { controls.scheme:set(scheme) end) - theme.set_style(self.menu.content:Label { + theme.set_style(self.content:Label { text = "Scroll Sensitivity", }, "settings_title") -- cgit v1.2.3 From ac54cab319b7525630e8376c0a6d236df8ccb8fd Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 18 Jul 2024 18:57:51 +1000 Subject: Add Hangul characters to the bundled font --- lua/fonts/fusion10 | Bin 198308 -> 386220 bytes lua/fonts/fusion12 | Bin 375744 -> 615260 bytes 2 files changed, 0 insertions(+), 0 deletions(-) (limited to 'lua') diff --git a/lua/fonts/fusion10 b/lua/fonts/fusion10 index 9fa4b78d..41e3916e 100644 Binary files a/lua/fonts/fusion10 and b/lua/fonts/fusion10 differ diff --git a/lua/fonts/fusion12 b/lua/fonts/fusion12 index 0fda8b03..3745c17d 100644 Binary files a/lua/fonts/fusion12 and b/lua/fonts/fusion12 differ -- cgit v1.2.3 From 0cc75366848e9205ac88884afcc128925024ccec Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 24 Jul 2024 15:29:45 +1000 Subject: Add a settings screen with power+battery info Mostly for debugging, but also u can toggle fast charging off and on now --- lua/settings.lua | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lua/widgets.lua | 16 ++++++++++------ 2 files changed, 66 insertions(+), 6 deletions(-) (limited to 'lua') diff --git a/lua/settings.lua b/lua/settings.lua index 49a826af..79572ee9 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -485,6 +485,59 @@ local DatabaseSettings = SettingsScreen:new { end } +local PowerSettings = SettingsScreen:new { + title = "Power", + createUi = function(self) + SettingsScreen.createUi(self) + local power = require("power") + + local charge_pct = widgets.Row(self.content, "Charge").right + local charge_volts = widgets.Row(self.content, "Voltage").right + local charge_state = widgets.Row(self.content, "Status").right + + self.bindings = self.bindings + { + power.battery_pct:bind(function(pct) + charge_pct:set { text = string.format("%d%%", pct) } + end), + power.battery_millivolts:bind(function(mv) + charge_volts:set { text = string.format("%.2fV", mv / 1000) } + end), + power.charge_state:bind(function(state) + charge_state:set { text = state } + end), + } + + local fast_charge_container = self.content:Object { + flex = { + flex_direction = "row", + justify_content = "flex-start", + align_items = "center", + align_content = "flex-start", + }, + w = lvgl.PCT(100), + h = lvgl.SIZE_CONTENT, + pad_bottom = 4, + } + fast_charge_container:add_style(styles.list_item) + fast_charge_container:Label { text = "Fast Charging", flex_grow = 1 } + local fast_charge_sw = fast_charge_container:Switch {} + + fast_charge_sw:onevent(lvgl.EVENT.VALUE_CHANGED, function() + power.fast_charge:set(fast_charge_sw:enabled()) + end) + + self.bindings = self.bindings + { + power.fast_charge:bind(function(en) + if en then + fast_charge_sw:add_state(lvgl.STATE.CHECKED) + else + fast_charge_sw:clear_state(lvgl.STATE.CHECKED) + end + end), + } + end +} + local SamdConfirmation = SettingsScreen:new { title = "Are you sure?", createUi = function(self) @@ -696,6 +749,9 @@ return widgets.MenuScreen:new { section("System") submenu("Database", DatabaseSettings) + submenu("Power", PowerSettings) + + section("About") submenu("Firmware", FirmwareSettings) submenu("Licenses", LicensesScreen) submenu("Regulatory", RegulatoryScreen) diff --git a/lua/widgets.lua b/lua/widgets.lua index 78d53a57..f830390f 100644 --- a/lua/widgets.lua +++ b/lua/widgets.lua @@ -58,7 +58,7 @@ widgets.MenuScreen = screen:new { end } -function widgets.Row(parent, left, right) +function widgets.Row(parent, left_text, right_text) local container = parent:Object { flex = { flex_direction = "row", @@ -70,12 +70,16 @@ function widgets.Row(parent, left, right) h = lvgl.SIZE_CONTENT } container:add_style(styles.list_item) - container:Label { - text = left, - flex_grow = 1 + local left = container:Label { + text = left_text, + flex_grow = 1, + } + local right = container:Label { + text = right_text or "", } - container:Label { - text = right + return { + left = left, + right = right, } end -- cgit v1.2.3 From b34959917446ac5d47ddec7bb6d98a6397045558 Mon Sep 17 00:00:00 2001 From: ailurux Date: Tue, 30 Jul 2024 04:36:48 +0000 Subject: daniel/playlist-queue (#84) Support for playlist files being opened along side the queue's own playlist. Playlists can be opened from the file browser, if the file ends in ".playlist" (will add support for .m3u as well eventually) Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/84 Co-authored-by: ailurux Co-committed-by: ailurux --- lua/file_browser.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lua') diff --git a/lua/file_browser.lua b/lua/file_browser.lua index 91b84c84..aed4aef8 100644 --- a/lua/file_browser.lua +++ b/lua/file_browser.lua @@ -62,10 +62,14 @@ return screen:new{ if is_dir then backstack.push(require("file_browser"):new{ title = self.title, - iterator = filesystem.iterator(tostring(item)), - breadcrumb = tostring(item) + iterator = filesystem.iterator(item:filepath()), + breadcrumb = item:filepath() }) end + if item:filepath():match("%.playlist$") then + queue.open_playlist(item:filepath()) + backstack.push(playing:new()) + end end end }) -- cgit v1.2.3 From 2a280c9b4b3afdedf68f8b27b8ce8dad6ab9470f Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 30 Jul 2024 14:56:42 +1000 Subject: Start playback immediately when selecting a playlist --- lua/file_browser.lua | 121 ++++++++++++++++++++++++++------------------------- 1 file changed, 61 insertions(+), 60 deletions(-) (limited to 'lua') diff --git a/lua/file_browser.lua b/lua/file_browser.lua index aed4aef8..f4f6f216 100644 --- a/lua/file_browser.lua +++ b/lua/file_browser.lua @@ -10,68 +10,69 @@ local theme = require("theme") local screen = require("screen") local filesystem = require("filesystem") -return screen:new{ - createUi = function(self) - self.root = lvgl.Object(nil, { - flex = { - flex_direction = "column", - flex_wrap = "wrap", - justify_content = "flex-start", - align_items = "flex-start", - align_content = "flex-start" - }, - w = lvgl.HOR_RES(), - h = lvgl.VER_RES() - }) - self.root:center() +return screen:new { + createUi = function(self) + self.root = lvgl.Object(nil, { + flex = { + flex_direction = "column", + flex_wrap = "wrap", + justify_content = "flex-start", + align_items = "flex-start", + align_content = "flex-start" + }, + w = lvgl.HOR_RES(), + h = lvgl.VER_RES() + }) + self.root:center() - self.status_bar = widgets.StatusBar(self, { - back_cb = backstack.pop, - title = self.title - }) + self.status_bar = widgets.StatusBar(self, { + back_cb = backstack.pop, + title = self.title + }) - local header = self.root:Object{ - flex = { - flex_direction = "column", - flex_wrap = "wrap", - justify_content = "flex-start", - align_items = "flex-start", - align_content = "flex-start" - }, - w = lvgl.HOR_RES(), - h = lvgl.SIZE_CONTENT, - pad_left = 4, - pad_right = 4, - pad_bottom = 2, - bg_opa = lvgl.OPA(100), - scrollbar_mode = lvgl.SCROLLBAR_MODE.OFF - } - theme.set_style(header, "header") + local header = self.root:Object { + flex = { + flex_direction = "column", + flex_wrap = "wrap", + justify_content = "flex-start", + align_items = "flex-start", + align_content = "flex-start" + }, + w = lvgl.HOR_RES(), + h = lvgl.SIZE_CONTENT, + pad_left = 4, + pad_right = 4, + pad_bottom = 2, + bg_opa = lvgl.OPA(100), + scrollbar_mode = lvgl.SCROLLBAR_MODE.OFF + } + theme.set_style(header, "header") - if self.breadcrumb then - header:Label{ - text = self.breadcrumb, - text_font = font.fusion_10 - } - end - - widgets.InfiniteList(self.root, self.iterator, { - callback = function(item) - return function() - local is_dir = item:is_directory() - if is_dir then - backstack.push(require("file_browser"):new{ - title = self.title, - iterator = filesystem.iterator(item:filepath()), - breadcrumb = item:filepath() - }) - end - if item:filepath():match("%.playlist$") then - queue.open_playlist(item:filepath()) - backstack.push(playing:new()) - end - end - end - }) + if self.breadcrumb then + header:Label { + text = self.breadcrumb, + text_font = font.fusion_10 + } end + + widgets.InfiniteList(self.root, self.iterator, { + callback = function(item) + return function() + local is_dir = item:is_directory() + if is_dir then + backstack.push(require("file_browser"):new { + title = self.title, + iterator = filesystem.iterator(item:filepath()), + breadcrumb = item:filepath() + }) + end + if item:filepath():match("%.playlist$") then + queue.open_playlist(item:filepath()) + playback.playing:set(true) + backstack.push(playing:new()) + end + end + end + }) + end } -- cgit v1.2.3 From d719f9c5017ad8006c21b6d546a5d70e846e9502 Mon Sep 17 00:00:00 2001 From: ailurux Date: Mon, 12 Aug 2024 03:19:03 +0000 Subject: daniel/theme-setting (#87) - Themes can be loaded from disk and built-in - Themes can be selected in a new themes menu of the settings screen - Some touch-ups to existing themes - The saved theme is persisted in nvs Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/87 Reviewed-by: cooljqln Co-authored-by: ailurux Co-committed-by: ailurux --- lua/img/next.png | Bin 4811 -> 7828 bytes lua/img/pause.png | Bin 4771 -> 5963 bytes lua/img/play.png | Bin 4813 -> 6828 bytes lua/img/prev.png | Bin 4810 -> 7839 bytes lua/main.lua | 12 ++++++-- lua/main_menu.lua | 7 +++-- lua/playing.lua | 23 +++++++++------- lua/settings.lua | 61 ++++++++++++++++++++++++++++++++++++++++ lua/theme_dark.lua | 29 +++++++++++++++---- lua/theme_light.lua | 78 +++++++++++++++++++++++++++++++++++++++++++--------- 10 files changed, 175 insertions(+), 35 deletions(-) (limited to 'lua') diff --git a/lua/img/next.png b/lua/img/next.png index 1f6f044b..929c5f36 100644 Binary files a/lua/img/next.png and b/lua/img/next.png differ diff --git a/lua/img/pause.png b/lua/img/pause.png index e7011821..32c5a2b4 100644 Binary files a/lua/img/pause.png and b/lua/img/pause.png differ diff --git a/lua/img/play.png b/lua/img/play.png index a3b8a5af..833cb087 100644 Binary files a/lua/img/play.png and b/lua/img/play.png differ diff --git a/lua/img/prev.png b/lua/img/prev.png index b445c75a..714c7c20 100644 Binary files a/lua/img/prev.png and b/lua/img/prev.png differ diff --git a/lua/main.lua b/lua/main.lua index 4cd754b6..9dd88c84 100644 --- a/lua/main.lua +++ b/lua/main.lua @@ -14,9 +14,15 @@ local backstack = require("backstack") local main_menu = require("main_menu") local function init_ui() - -- Load the theme within init_ui because the theme needs fonts to be ready. - local theme_dark = require("theme_dark") - theme.set(theme_dark) + -- Theme is set within init_ui because the theme needs fonts to be ready. + -- Set the theme to the saved theme if available + local saved_theme = theme.theme_filename() + local res = theme.load_theme(saved_theme) + if not res then + -- Set a default theme (in case the saved theme does not load) + local default_theme = require("theme_light") + theme.set(default_theme) + end local lock_time = time.ticks() diff --git a/lua/main_menu.lua b/lua/main_menu.lua index f3b7a042..54f382a1 100644 --- a/lua/main_menu.lua +++ b/lua/main_menu.lua @@ -33,9 +33,9 @@ return widgets.MenuScreen:new { margin_all = 2, pad_bottom = 2, pad_column = 4, - border_color = "#FFFFFF", border_width = 1, }) + theme.set_style(now_playing, "now_playing"); local play_pause = now_playing:Image { src = img.play_small } local title = now_playing:Label { @@ -140,6 +140,7 @@ return widgets.MenuScreen:new { w = lvgl.PCT(100), h = lvgl.SIZE_CONTENT, pad_top = 4, + pad_bottom = 2, }) -- local queue_btn = bottom_bar:Button {} @@ -154,13 +155,13 @@ return widgets.MenuScreen:new { }) end) files_btn:Image { src = img.files } - theme.set_style(files_btn, "icon_enabled") + theme.set_style(files_btn, "menu_icon") local settings_btn = bottom_bar:Button {} settings_btn:onClicked(function() backstack.push(require("settings"):new()) end) settings_btn:Image { src = img.settings } - theme.set_style(settings_btn, "icon_enabled") + theme.set_style(settings_btn, "menu_icon") end, } diff --git a/lua/playing.lua b/lua/playing.lua index 90e20f49..97997366 100644 --- a/lua/playing.lua +++ b/lua/playing.lua @@ -74,7 +74,7 @@ return screen:new { align_items = "center", align_content = "center", }, - w = lvgl.PCT(100), + w = lvgl.PCT(95), h = lvgl.SIZE_CONTENT, } @@ -114,11 +114,12 @@ return screen:new { playlist:Object({ w = 3, h = 1 }) -- spacer local scrubber = self.root:Slider { - w = lvgl.PCT(100), + w = lvgl.PCT(90), h = 5, range = { min = 0, max = 100 }, value = 0, } + theme.set_style(scrubber, "scrubber"); local scrubber_desc = widgets.Description(scrubber, "Scrubber") scrubber:onevent(lvgl.EVENT.RELEASED, function() @@ -138,6 +139,8 @@ return screen:new { end end) + self.root:Object({ w = 1, h = 1 }) -- spacer + local controls = self.root:Object { flex = { flex_direction = "row", @@ -158,7 +161,7 @@ return screen:new { queue.repeat_track:set(not queue.repeat_track:get()) end) local repeat_img = repeat_btn:Image { src = img.repeat_src } - theme.set_style(repeat_img, icon_enabled_class) + theme.set_style(repeat_btn, icon_enabled_class) local repeat_desc = widgets.Description(repeat_btn) @@ -171,7 +174,7 @@ return screen:new { end end) local prev_img = prev_btn:Image { src = img.prev } - theme.set_style(prev_img, icon_enabled_class) + theme.set_style(prev_btn, icon_enabled_class) local prev_desc = widgets.Description(prev_btn, "Previous track") local play_pause_btn = controls:Button {} @@ -180,13 +183,13 @@ return screen:new { end) play_pause_btn:focus() local play_pause_img = play_pause_btn:Image { src = img.pause } - theme.set_style(play_pause_img, icon_enabled_class) + theme.set_style(play_pause_btn, icon_enabled_class) local play_pause_desc = widgets.Description(play_pause_btn, "Play") local next_btn = controls:Button {} next_btn:onClicked(queue.next) local next_img = next_btn:Image { src = img.next } - theme.set_style(next_img, icon_disabled_class) + theme.set_style(next_btn, icon_disabled_class) local next_desc = widgets.Description(next_btn, "Next track") local shuffle_btn = controls:Button {} @@ -194,7 +197,7 @@ return screen:new { queue.random:set(not queue.random:get()) end) local shuffle_img = shuffle_btn:Image { src = img.shuffle } - theme.set_style(shuffle_img, icon_enabled_class) + theme.set_style(shuffle_btn, icon_enabled_class) local shuffle_desc = widgets.Description(shuffle_btn) controls:Object({ flex_grow = 1, h = 1 }) -- spacer @@ -238,11 +241,11 @@ return screen:new { local can_next = pos < queue.size:get() or queue.random:get() theme.set_style( - next_img, can_next and icon_enabled_class or icon_disabled_class + next_btn, can_next and icon_enabled_class or icon_disabled_class ) end), queue.random:bind(function(shuffling) - theme.set_style(shuffle_img, shuffling and icon_enabled_class or icon_disabled_class) + theme.set_style(shuffle_btn, shuffling and icon_enabled_class or icon_disabled_class) if shuffling then shuffle_desc:set { text = "Disable shuffle" } else @@ -250,7 +253,7 @@ return screen:new { end end), queue.repeat_track:bind(function(en) - theme.set_style(repeat_img, en and icon_enabled_class or icon_disabled_class) + theme.set_style(repeat_btn, en and icon_enabled_class or icon_disabled_class) if en then repeat_desc:set { text = "Disable track repeat" } else diff --git a/lua/settings.lua b/lua/settings.lua index 79572ee9..3033b36e 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -7,9 +7,11 @@ local display = require("display") local controls = require("controls") local bluetooth = require("bluetooth") local theme = require("theme") +local filesystem = require("filesystem") local database = require("database") local usb = require("usb") local font = require("font") +local main_menu = require("main_menu") local SettingsScreen = widgets.MenuScreen:new { show_back = true, @@ -301,6 +303,64 @@ local DisplaySettings = SettingsScreen:new { end } +local ThemeSettings = SettingsScreen:new { + title = "Theme", + createUi = function(self) + SettingsScreen.createUi(self) + + theme.set_style(self.content:Label { + text = "Theme", + }, "settings_title") + + local themeOptions = {} + themeOptions["Dark"] = "/lua/theme_dark.lua" + themeOptions["Light"] = "/lua/theme_light.lua" + + -- Parse theme directory for more themes + local theme_dir_iter = filesystem.iterator("/.themes/") + for dir in theme_dir_iter do + local theme_name = tostring(dir):match("(.+).lua$") + themeOptions[theme_name] = "/sdcard/.themes/" .. theme_name .. ".lua" + end + + local saved_theme = theme.theme_filename(); + local saved_theme_name = saved_theme:match(".+/(.*).lua$") + + local options = "" + local idx = 0 + local selected_idx = -1 + for i, v in pairs(themeOptions) do + if (saved_theme == v) then + selected_idx = idx + end + if idx > 0 then + options = options .. "\n" + end + options = options .. i + idx = idx + 1 + end + + if (selected_idx == -1) then + options = options .. "\n" .. saved_theme_name + selected_idx = idx + end + + local theme_chooser = self.content:Dropdown { + options = options, + } + theme_chooser:set({selected = selected_idx}) + + theme_chooser:onevent(lvgl.EVENT.VALUE_CHANGED, function() + local option = theme_chooser:get('selected_str') + local selectedTheme = themeOptions[option] + if (selectedTheme) then + theme.load_theme(tostring(selectedTheme)) + backstack.reset(main_menu:new()) + end + end) + end +} + local InputSettings = SettingsScreen:new { title = "Input Method", createUi = function(self) @@ -742,6 +802,7 @@ return widgets.MenuScreen:new { section("Interface") submenu("Display", DisplaySettings) + submenu("Theme", ThemeSettings) submenu("Input Method", InputSettings) section("USB") diff --git a/lua/theme_dark.lua b/lua/theme_dark.lua index 6508f642..b9bcece2 100644 --- a/lua/theme_dark.lua +++ b/lua/theme_dark.lua @@ -95,24 +95,27 @@ local theme_dark = { switch = { {lvgl.PART.MAIN, lvgl.Style { bg_opa = lvgl.OPA(100), - width = 28, - height = 8, + width = 18, + height = 10, radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff bg_color = background_muted, - border_color = highlight_color, + border_color = text_color, + border_width = 1, }}, {lvgl.PART.INDICATOR, lvgl.Style { radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff - bg_color = background_muted, + bg_color = background_color, }}, {lvgl.PART.INDICATOR | lvgl.STATE.CHECKED, lvgl.Style { bg_color = highlight_color, + bg_opa = lvgl.OPA(100), }}, {lvgl.PART.KNOB, lvgl.Style { radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff - pad_all = 2, bg_opa = lvgl.OPA(100), bg_color = background_muted, + border_color = text_color, + border_width = 1, }}, {lvgl.PART.KNOB | lvgl.STATE.FOCUSED, lvgl.Style { bg_color = highlight_color, @@ -170,7 +173,21 @@ local theme_dark = { image_recolor = icon_enabled_color, }}, }, - + now_playing = { + {lvgl.PART.MAIN, lvgl.Style { + bg_opa = lvgl.OPA(100), + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + border_width = 1, + border_color = highlight_color, + border_side = 15, -- LV_BORDER_SIDE_FULL + }}, + }, + menu_icon = { + {lvgl.PART.MAIN, lvgl.Style { + pad_all = 4, + radius = 4 + }}, + }, } return theme_dark diff --git a/lua/theme_light.lua b/lua/theme_light.lua index 05b7d291..96403de3 100644 --- a/lua/theme_light.lua +++ b/lua/theme_light.lua @@ -2,10 +2,10 @@ local lvgl = require("lvgl") local font = require("font") local background_color = "#ffffff" -local background_muted = "#fafafa" -local text_color = "#000000" -local highlight_color = "#ce93d8" -local icon_enabled_color = "#2c2c2c" +local background_muted = "#f2f2f2" +local text_color = "#2c2c2c" +local highlight_color = "#ff82bc" +local icon_enabled_color = "#ff82bc" local icon_disabled_color = "#999999" local theme_light = { @@ -47,6 +47,7 @@ local theme_light = { }}, {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { bg_opa = lvgl.OPA(100), + text_color = "#ffffff", bg_color = highlight_color, image_recolor_opa = 0, }}, @@ -55,6 +56,7 @@ local theme_light = { {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { bg_opa = lvgl.OPA(100), bg_color = highlight_color, + text_color = "#ffffff" }}, }, bar = { @@ -75,16 +77,41 @@ local theme_light = { }}, {lvgl.PART.KNOB, lvgl.Style { radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff - pad_all = 2, bg_color = background_muted, shadow_width = 5, - shadow_opa = lvgl.OPA(100) + shadow_opa = lvgl.OPA(100), + pad_all = 2, + }}, + {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { + bg_color = background_muted, + }}, + {lvgl.PART.KNOB | lvgl.STATE.FOCUSED, lvgl.Style { + bg_color = highlight_color, + }}, + {lvgl.PART.INDICATOR | lvgl.STATE.CHECKED, lvgl.Style { + bg_color = highlight_color, + }}, + }, + scrubber = { + {lvgl.PART.MAIN, lvgl.Style { + bg_opa = lvgl.OPA(100), + bg_color = background_muted, + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + }}, + {lvgl.PART.INDICATOR, lvgl.Style { + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + bg_color = highlight_color, + }}, + {lvgl.PART.KNOB, lvgl.Style { + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + bg_color = background_muted, }}, {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { bg_color = background_muted, }}, {lvgl.PART.KNOB | lvgl.STATE.FOCUSED, lvgl.Style { bg_color = highlight_color, + pad_all = 1, }}, {lvgl.PART.INDICATOR | lvgl.STATE.CHECKED, lvgl.Style { bg_color = highlight_color, @@ -93,24 +120,27 @@ local theme_light = { switch = { {lvgl.PART.MAIN, lvgl.Style { bg_opa = lvgl.OPA(100), - width = 28, - height = 8, + width = 18, + height = 10, radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff bg_color = background_muted, - border_color = highlight_color, + border_color = text_color, + border_width = 1, }}, {lvgl.PART.INDICATOR, lvgl.Style { radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff - bg_color = background_muted, + bg_color = background_color, }}, {lvgl.PART.INDICATOR | lvgl.STATE.CHECKED, lvgl.Style { + bg_opa = lvgl.OPA(100), bg_color = highlight_color, }}, {lvgl.PART.KNOB, lvgl.Style { radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff - pad_all = 2, bg_opa = lvgl.OPA(100), - bg_color = background_muted, + bg_color = background_color, + border_color = text_color, + border_width = 1, }}, {lvgl.PART.KNOB | lvgl.STATE.FOCUSED, lvgl.Style { bg_color = highlight_color, @@ -161,14 +191,36 @@ local theme_light = { image_recolor_opa = 180, image_recolor = icon_disabled_color, }}, + {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { + image_recolor_opa = 0, + image_recolor = "#ffffff", + }}, }, icon_enabled = { {lvgl.PART.MAIN, lvgl.Style { image_recolor_opa = 180, image_recolor = icon_enabled_color, }}, + {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { + image_recolor_opa = 0, + image_recolor = "#ffffff", + }}, + }, + now_playing = { + {lvgl.PART.MAIN, lvgl.Style { + bg_opa = lvgl.OPA(100), + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + border_width = 1, + border_color = highlight_color, + border_side = 15, -- LV_BORDER_SIDE_FULL + }}, + }, + menu_icon = { + {lvgl.PART.MAIN, lvgl.Style { + pad_all = 4, + radius = 4 + }}, }, - } return theme_light -- cgit v1.2.3 From 0662bb037b94ffc50ee7ce313c348cbe6b7f6e4c Mon Sep 17 00:00:00 2001 From: ailurux Date: Thu, 15 Aug 2024 16:14:18 +1000 Subject: Some UI/themes tweaks --- lua/images.lua | 1 + lua/img/back.png | Bin 0 -> 7254 bytes lua/settings.lua | 3 --- lua/theme_dark.lua | 29 ++++++++++++++++++++++++++--- lua/theme_light.lua | 38 +++++++++++++++++++++++++------------- lua/widgets.lua | 9 ++++++--- 6 files changed, 58 insertions(+), 22 deletions(-) create mode 100644 lua/img/back.png (limited to 'lua') diff --git a/lua/images.lua b/lua/images.lua index 1634bc44..8900233f 100644 --- a/lua/images.lua +++ b/lua/images.lua @@ -1,6 +1,7 @@ local lvgl = require("lvgl") local img = { + back = lvgl.ImgData("//lua/img/back.png"), play = lvgl.ImgData("//lua/img/play.png"), play_small = lvgl.ImgData("//lua/img/playcirc.png"), pause = lvgl.ImgData("//lua/img/pause.png"), diff --git a/lua/img/back.png b/lua/img/back.png new file mode 100644 index 00000000..0f34453b Binary files /dev/null and b/lua/img/back.png differ diff --git a/lua/settings.lua b/lua/settings.lua index 3033b36e..ff8a6e7f 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -227,7 +227,6 @@ local HeadphonesSettings = SettingsScreen:new { local balance = self.content:Slider { w = lvgl.PCT(100), - h = 5, range = { min = -100, max = 100 }, value = 0, } @@ -287,7 +286,6 @@ local DisplaySettings = SettingsScreen:new { local brightness = self.content:Slider { w = lvgl.PCT(100), - h = 5, range = { min = 0, max = 100 }, value = display.brightness:get(), } @@ -411,7 +409,6 @@ local InputSettings = SettingsScreen:new { local slider_scale = 4; -- Power steering local sensitivity = self.content:Slider { w = lvgl.PCT(90), - h = 5, range = { min = 0, max = 255 / slider_scale }, value = controls.scroll_sensitivity:get() / slider_scale, } diff --git a/lua/theme_dark.lua b/lua/theme_dark.lua index b9bcece2..20d64495 100644 --- a/lua/theme_dark.lua +++ b/lua/theme_dark.lua @@ -79,8 +79,6 @@ local theme_dark = { radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff pad_all = 2, bg_color = background_muted, - shadow_width = 5, - shadow_opa = lvgl.OPA(100) }}, {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { bg_color = background_muted, @@ -92,6 +90,31 @@ local theme_dark = { bg_color = highlight_color, }}, }, + scrubber = { + {lvgl.PART.MAIN, lvgl.Style { + bg_opa = lvgl.OPA(100), + bg_color = background_muted, + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + }}, + {lvgl.PART.INDICATOR, lvgl.Style { + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + bg_color = highlight_color, + }}, + {lvgl.PART.KNOB, lvgl.Style { + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + bg_color = background_muted, + }}, + {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { + bg_color = background_muted, + }}, + {lvgl.PART.KNOB | lvgl.STATE.FOCUSED, lvgl.Style { + bg_color = highlight_color, + pad_all = 1, + }}, + {lvgl.PART.INDICATOR | lvgl.STATE.CHECKED, lvgl.Style { + bg_color = highlight_color, + }}, + }, switch = { {lvgl.PART.MAIN, lvgl.Style { bg_opa = lvgl.OPA(100), @@ -107,8 +130,8 @@ local theme_dark = { bg_color = background_color, }}, {lvgl.PART.INDICATOR | lvgl.STATE.CHECKED, lvgl.Style { - bg_color = highlight_color, bg_opa = lvgl.OPA(100), + bg_color = highlight_color, }}, {lvgl.PART.KNOB, lvgl.Style { radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff diff --git a/lua/theme_light.lua b/lua/theme_light.lua index 96403de3..03d076f4 100644 --- a/lua/theme_light.lua +++ b/lua/theme_light.lua @@ -7,6 +7,7 @@ local text_color = "#2c2c2c" local highlight_color = "#ff82bc" local icon_enabled_color = "#ff82bc" local icon_disabled_color = "#999999" +local border_color = "#888888" local theme_light = { base = { @@ -43,7 +44,9 @@ local theme_light = { bg_color = background_color, image_recolor_opa = 180, image_recolor = highlight_color, - radius = 5, + radius = 4, + border_color = border_color, + border_width = 1, }}, {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { bg_opa = lvgl.OPA(100), @@ -70,17 +73,21 @@ local theme_light = { bg_opa = lvgl.OPA(100), bg_color = background_muted, radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + border_color = border_color, + border_width = 1, + height = 8, }}, {lvgl.PART.INDICATOR, lvgl.Style { radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff bg_color = highlight_color, + border_color = border_color, + border_width = 1, }}, {lvgl.PART.KNOB, lvgl.Style { radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff bg_color = background_muted, - shadow_width = 5, - shadow_opa = lvgl.OPA(100), - pad_all = 2, + border_color = border_color, + border_width = 1, }}, {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { bg_color = background_muted, @@ -123,9 +130,6 @@ local theme_light = { width = 18, height = 10, radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff - bg_color = background_muted, - border_color = text_color, - border_width = 1, }}, {lvgl.PART.INDICATOR, lvgl.Style { radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff @@ -138,9 +142,6 @@ local theme_light = { {lvgl.PART.KNOB, lvgl.Style { radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff bg_opa = lvgl.OPA(100), - bg_color = background_color, - border_color = text_color, - border_width = 1, }}, {lvgl.PART.KNOB | lvgl.STATE.FOCUSED, lvgl.Style { bg_color = highlight_color, @@ -151,7 +152,7 @@ local theme_light = { radius = 2, pad_all = 2, border_width = 1, - border_color = background_muted, + border_color = border_color, border_side = 15, -- LV_BORDER_SIDE_FULL bg_color = background_color, }}, @@ -164,7 +165,7 @@ local theme_light = { radius = 2, pad_all = 2, border_width = 1, - border_color = highlight_color, + border_color = border_color, bg_opa = lvgl.OPA(100), bg_color = background_color }}, @@ -178,6 +179,17 @@ local theme_light = { image_recolor = highlight_color, }}, }, + back_button = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 180, + image_recolor = icon_enabled_color, + pad_all = 0, + }}, + {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { + image_recolor_opa = 0, + image_recolor = "#ffffff", + }}, + }, settings_title = { {lvgl.PART.MAIN, lvgl.Style { pad_top = 2, @@ -211,7 +223,7 @@ local theme_light = { bg_opa = lvgl.OPA(100), radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff border_width = 1, - border_color = highlight_color, + border_color = border_color, border_side = 15, -- LV_BORDER_SIDE_FULL }}, }, diff --git a/lua/widgets.lua b/lua/widgets.lua index f830390f..2eab3af6 100644 --- a/lua/widgets.lua +++ b/lua/widgets.lua @@ -8,6 +8,7 @@ local styles = require("styles") local database = require("database") local theme = require("theme") local screen = require("screen") +local images = require("images") local img = { db = lvgl.ImgData("//lua/img/db.png"), @@ -112,10 +113,11 @@ function widgets.StatusBar(parent, opts) if opts.back_cb then local back = root:Button { w = lvgl.SIZE_CONTENT, - h = 12, + h = lvgl.SIZE_CONTENT, } - local label = back:Label({ text = "<", align = lvgl.ALIGN.CENTER }) - widgets.Description(label, "Back") + back:Image{src=images.back} + theme.set_style(back, "back_button") + widgets.Description(back, "Back") back:onClicked(opts.back_cb) back:onevent(lvgl.EVENT.FOCUSED, function() local first_view = parent.content @@ -136,6 +138,7 @@ function widgets.StatusBar(parent, opts) text = "", align = lvgl.ALIGN.CENTER, flex_grow = 1, + pad_left = 2, } if opts.title then title:set { text = opts.title } -- cgit v1.2.3 From f203bfde606fab1f001b6085edb02a6f94e9fbdb Mon Sep 17 00:00:00 2001 From: ailurux Date: Thu, 15 Aug 2024 16:36:16 +1000 Subject: Add border to switch widget --- lua/theme_light.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lua') diff --git a/lua/theme_light.lua b/lua/theme_light.lua index 03d076f4..9e35cf9e 100644 --- a/lua/theme_light.lua +++ b/lua/theme_light.lua @@ -130,6 +130,9 @@ local theme_light = { width = 18, height = 10, radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + bg_color = background_muted, + border_color = border_color, + border_width = 1, }}, {lvgl.PART.INDICATOR, lvgl.Style { radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff @@ -142,6 +145,9 @@ local theme_light = { {lvgl.PART.KNOB, lvgl.Style { radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff bg_opa = lvgl.OPA(100), + bg_color = background_muted, + border_color = border_color, + border_width = 1, }}, {lvgl.PART.KNOB | lvgl.STATE.FOCUSED, lvgl.Style { bg_color = highlight_color, -- cgit v1.2.3 From 3ed3f1dfeb7f83630f0e1d0633eaa5fbda9d37c7 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 16 Aug 2024 11:42:32 +1000 Subject: Add cool skeumorphic embossing --- lua/browser.lua | 2 +- lua/settings.lua | 3 ++- lua/theme_light.lua | 27 +++++++++++++++++---------- lua/widgets.lua | 4 ---- 4 files changed, 20 insertions(+), 16 deletions(-) (limited to 'lua') diff --git a/lua/browser.lua b/lua/browser.lua index f8f87a6a..31cb9b54 100644 --- a/lua/browser.lua +++ b/lua/browser.lua @@ -58,7 +58,7 @@ return screen:new{ flex = { flex_direction = "row", flex_wrap = "wrap", - justify_content = "center", + justify_content = "space-between", align_items = "center", align_content = "center" }, diff --git a/lua/settings.lua b/lua/settings.lua index ff8a6e7f..3e0817e4 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -496,11 +496,12 @@ local DatabaseSettings = SettingsScreen:new { flex = { flex_direction = "row", justify_content = "flex-start", - align_items = "flex-start", + align_items = "center", align_content = "flex-start", }, w = lvgl.PCT(100), h = lvgl.SIZE_CONTENT, + pad_bottom = 4, } auto_update_container:add_style(styles.list_item) auto_update_container:Label { text = "Auto update", flex_grow = 1 } diff --git a/lua/theme_light.lua b/lua/theme_light.lua index 9e35cf9e..ce728c7c 100644 --- a/lua/theme_light.lua +++ b/lua/theme_light.lua @@ -37,16 +37,18 @@ local theme_light = { }, button = { {lvgl.PART.MAIN, lvgl.Style { - pad_left = 2, - pad_right = 2, - pad_top = 1, - pad_bottom = 1, + pad_left = 1, + pad_right = 1, + margin_all = 1, bg_color = background_color, image_recolor_opa = 180, image_recolor = highlight_color, radius = 4, border_color = border_color, border_width = 1, + border_side = 9, + outline_color = border_color, + outline_width = 1, }}, {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { bg_opa = lvgl.OPA(100), @@ -88,6 +90,9 @@ local theme_light = { bg_color = background_muted, border_color = border_color, border_width = 1, + border_side = 9, + outline_color = border_color, + outline_width = 1, }}, {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { bg_color = background_muted, @@ -148,6 +153,9 @@ local theme_light = { bg_color = background_muted, border_color = border_color, border_width = 1, + border_side = 9, + outline_color = border_color, + outline_width = 1, }}, {lvgl.PART.KNOB | lvgl.STATE.FOCUSED, lvgl.Style { bg_color = highlight_color, @@ -157,10 +165,12 @@ local theme_light = { {lvgl.PART.MAIN, lvgl.Style{ radius = 2, pad_all = 2, - border_width = 1, - border_color = border_color, - border_side = 15, -- LV_BORDER_SIDE_FULL bg_color = background_color, + border_color = border_color, + border_width = 1, + border_side = 9, + outline_color = border_color, + outline_width = 1, }}, {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { border_color = highlight_color, @@ -228,9 +238,6 @@ local theme_light = { {lvgl.PART.MAIN, lvgl.Style { bg_opa = lvgl.OPA(100), radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff - border_width = 1, - border_color = border_color, - border_side = 15, -- LV_BORDER_SIDE_FULL }}, }, menu_icon = { diff --git a/lua/widgets.lua b/lua/widgets.lua index 2eab3af6..4e83393e 100644 --- a/lua/widgets.lua +++ b/lua/widgets.lua @@ -226,10 +226,6 @@ function widgets.IconBtn(parent, icon, text) }, w = lvgl.SIZE_CONTENT, h = lvgl.SIZE_CONTENT, - pad_top = 1, - pad_bottom = 1, - pad_left = 1, - pad_column = 1 } btn:Image { src = icon -- cgit v1.2.3 From 9cdb268b2bc5e30db9914b69db5d9763b3ddf656 Mon Sep 17 00:00:00 2001 From: ailurux Date: Fri, 16 Aug 2024 13:04:44 +1000 Subject: Updated a few icons --- lua/img/bt.png | Bin 4595 -> 9652 bytes lua/img/bt_conn.png | Bin 4363 -> 11355 bytes lua/img/next.png | Bin 7828 -> 7873 bytes lua/img/prev.png | Bin 7839 -> 7870 bytes 4 files changed, 0 insertions(+), 0 deletions(-) (limited to 'lua') diff --git a/lua/img/bt.png b/lua/img/bt.png index 73f3179f..24127267 100644 Binary files a/lua/img/bt.png and b/lua/img/bt.png differ diff --git a/lua/img/bt_conn.png b/lua/img/bt_conn.png index 91f9964d..e26ad218 100644 Binary files a/lua/img/bt_conn.png and b/lua/img/bt_conn.png differ diff --git a/lua/img/next.png b/lua/img/next.png index 929c5f36..d245148e 100644 Binary files a/lua/img/next.png and b/lua/img/next.png differ diff --git a/lua/img/prev.png b/lua/img/prev.png index 714c7c20..ee4273e7 100644 Binary files a/lua/img/prev.png and b/lua/img/prev.png differ -- cgit v1.2.3 From 0f9005626d2d919e6995809453b9b5ec3c72096b Mon Sep 17 00:00:00 2001 From: ailurux Date: Fri, 16 Aug 2024 16:56:58 +1000 Subject: Redesigned many icons, added styles for battery icon recolouring based on percentage --- lua/img/bat/0.png | Bin 627 -> 6267 bytes lua/img/bat/0chg.png | Bin 627 -> 0 bytes lua/img/bat/100.png | Bin 629 -> 6279 bytes lua/img/bat/20.png | Bin 624 -> 6271 bytes lua/img/bat/40.png | Bin 625 -> 6274 bytes lua/img/bat/60.png | Bin 628 -> 6279 bytes lua/img/bat/80.png | Bin 623 -> 6279 bytes lua/img/bat/chg.png | Bin 667 -> 6259 bytes lua/img/bt.png | Bin 9652 -> 10120 bytes lua/img/bt_conn.png | Bin 11355 -> 11932 bytes lua/theme_dark.lua | 23 +++++++++++++++++++++++ lua/theme_light.lua | 24 ++++++++++++++++++++++++ lua/widgets.lua | 18 ++++++++++++------ 13 files changed, 59 insertions(+), 6 deletions(-) delete mode 100644 lua/img/bat/0chg.png (limited to 'lua') diff --git a/lua/img/bat/0.png b/lua/img/bat/0.png index 15639ef5..a0e0e480 100644 Binary files a/lua/img/bat/0.png and b/lua/img/bat/0.png differ diff --git a/lua/img/bat/0chg.png b/lua/img/bat/0chg.png deleted file mode 100644 index 7267ade1..00000000 Binary files a/lua/img/bat/0chg.png and /dev/null differ diff --git a/lua/img/bat/100.png b/lua/img/bat/100.png index f762ec2f..caf2a160 100644 Binary files a/lua/img/bat/100.png and b/lua/img/bat/100.png differ diff --git a/lua/img/bat/20.png b/lua/img/bat/20.png index b1fcca1b..e440d1bf 100644 Binary files a/lua/img/bat/20.png and b/lua/img/bat/20.png differ diff --git a/lua/img/bat/40.png b/lua/img/bat/40.png index fbba9c3b..4a9dacaa 100644 Binary files a/lua/img/bat/40.png and b/lua/img/bat/40.png differ diff --git a/lua/img/bat/60.png b/lua/img/bat/60.png index 97a8b605..a8ed889f 100644 Binary files a/lua/img/bat/60.png and b/lua/img/bat/60.png differ diff --git a/lua/img/bat/80.png b/lua/img/bat/80.png index ab90987b..4e02261b 100644 Binary files a/lua/img/bat/80.png and b/lua/img/bat/80.png differ diff --git a/lua/img/bat/chg.png b/lua/img/bat/chg.png index d604bb76..89fd8368 100644 Binary files a/lua/img/bat/chg.png and b/lua/img/bat/chg.png differ diff --git a/lua/img/bt.png b/lua/img/bt.png index 24127267..ae45dfbf 100644 Binary files a/lua/img/bt.png and b/lua/img/bt.png differ diff --git a/lua/img/bt_conn.png b/lua/img/bt_conn.png index e26ad218..890e4160 100644 Binary files a/lua/img/bt_conn.png and b/lua/img/bt_conn.png differ diff --git a/lua/theme_dark.lua b/lua/theme_dark.lua index 20d64495..a908245f 100644 --- a/lua/theme_dark.lua +++ b/lua/theme_dark.lua @@ -211,6 +211,29 @@ local theme_dark = { radius = 4 }}, }, + battery = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 0, + }}, + }, + battery_0 = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 180, + image_recolor = "#aa3333", + }}, + }, + battery_charging = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 180, + image_recolor = "#33aa33", + }}, + }, + battery_charge_icon = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 180, + image_recolor = "#fdd833", + }}, + }, } return theme_dark diff --git a/lua/theme_light.lua b/lua/theme_light.lua index ce728c7c..e856c015 100644 --- a/lua/theme_light.lua +++ b/lua/theme_light.lua @@ -246,6 +246,30 @@ local theme_light = { radius = 4 }}, }, + battery = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 180, + image_recolor = highlight_color, + }}, + }, + battery_0 = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 180, + image_recolor = "#aa3333", + }}, + }, + battery_charging = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 180, + image_recolor = "#33aa33", + }}, + }, + battery_charge_icon = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 180, + image_recolor = "#fdd833", + }}, + }, } return theme_light diff --git a/lua/widgets.lua b/lua/widgets.lua index 4e83393e..29e50f29 100644 --- a/lua/widgets.lua +++ b/lua/widgets.lua @@ -19,7 +19,6 @@ local img = { bat_40 = lvgl.ImgData("//lua/img/bat/40.png"), bat_20 = lvgl.ImgData("//lua/img/bat/20.png"), bat_0 = lvgl.ImgData("//lua/img/bat/0.png"), - bat_0chg = lvgl.ImgData("//lua/img/bat/0chg.png"), bt_conn = lvgl.ImgData("//lua/img/bt_conn.png"), bt = lvgl.ImgData("//lua/img/bt.png") } @@ -102,6 +101,7 @@ function widgets.StatusBar(parent, opts) pad_top = 1, pad_bottom = 1, pad_left = 4, + pad_right = 4, pad_column = 1, scrollbar_mode = lvgl.SCROLLBAR_MODE.OFF, } @@ -157,24 +157,29 @@ function widgets.StatusBar(parent, opts) local function update_battery_icon() if is_charging == nil or percent == nil then return end local src + theme.set_style(battery_icon, "battery") if percent >= 95 then + theme.set_style(battery_icon, "battery_100") src = img.bat_100 elseif percent >= 75 then + theme.set_style(battery_icon, "battery_80") src = img.bat_80 elseif percent >= 55 then + theme.set_style(battery_icon, "battery_60") src = img.bat_60 elseif percent >= 35 then + theme.set_style(battery_icon, "battery_40") src = img.bat_40 elseif percent >= 15 then + theme.set_style(battery_icon, "battery_20") src = img.bat_20 else - if is_charging then - src = img.bat_0chg - else - src = img.bat_0 - end + theme.set_style(battery_icon, "battery_0") + src = img.bat_0 end if is_charging then + theme.set_style(battery_icon, "battery_charging") + theme.set_style(charge_icon, "battery_charge_icon") charge_icon:clear_flag(lvgl.FLAG.HIDDEN) else charge_icon:add_flag(lvgl.FLAG.HIDDEN) @@ -206,6 +211,7 @@ function widgets.StatusBar(parent, opts) end end), bluetooth.connected:bind(function(connected) + theme.set_style(bt_icon, "bluetooth_icon") if connected then bt_icon:set_src(img.bt_conn) else -- cgit v1.2.3 From a09b3f24fef7e320a626a9cf10d72886a62c3ffe Mon Sep 17 00:00:00 2001 From: ailurux Date: Tue, 27 Aug 2024 13:19:39 +1000 Subject: Update battery icon to be a bit smaller --- lua/img/bat/0.png | Bin 6267 -> 8430 bytes lua/img/bat/100.png | Bin 6279 -> 8434 bytes lua/img/bat/20.png | Bin 6271 -> 8430 bytes lua/img/bat/40.png | Bin 6274 -> 8431 bytes lua/img/bat/60.png | Bin 6279 -> 8435 bytes lua/img/bat/80.png | Bin 6279 -> 8436 bytes lua/img/bat/chg.png | Bin 6259 -> 8326 bytes 7 files changed, 0 insertions(+), 0 deletions(-) (limited to 'lua') diff --git a/lua/img/bat/0.png b/lua/img/bat/0.png index a0e0e480..d4c69fd4 100644 Binary files a/lua/img/bat/0.png and b/lua/img/bat/0.png differ diff --git a/lua/img/bat/100.png b/lua/img/bat/100.png index caf2a160..443ac6cc 100644 Binary files a/lua/img/bat/100.png and b/lua/img/bat/100.png differ diff --git a/lua/img/bat/20.png b/lua/img/bat/20.png index e440d1bf..11fb049e 100644 Binary files a/lua/img/bat/20.png and b/lua/img/bat/20.png differ diff --git a/lua/img/bat/40.png b/lua/img/bat/40.png index 4a9dacaa..3dcfe2e6 100644 Binary files a/lua/img/bat/40.png and b/lua/img/bat/40.png differ diff --git a/lua/img/bat/60.png b/lua/img/bat/60.png index a8ed889f..9e677571 100644 Binary files a/lua/img/bat/60.png and b/lua/img/bat/60.png differ diff --git a/lua/img/bat/80.png b/lua/img/bat/80.png index 4e02261b..4c393f03 100644 Binary files a/lua/img/bat/80.png and b/lua/img/bat/80.png differ diff --git a/lua/img/bat/chg.png b/lua/img/bat/chg.png index 89fd8368..629586e3 100644 Binary files a/lua/img/bat/chg.png and b/lua/img/bat/chg.png differ -- cgit v1.2.3 From e0b057b3fa6ee1e8e8fd90d1abd6f201f73937ab Mon Sep 17 00:00:00 2001 From: ailurux Date: Tue, 27 Aug 2024 16:30:40 +1000 Subject: Various UI tweaks and improvements --- lua/images.lua | 2 ++ lua/img/repeat.png | Bin 5023 -> 8578 bytes lua/img/repeat_off.png | Bin 0 -> 9349 bytes lua/img/shuffle_off.png | Bin 0 -> 7791 bytes lua/playing.lua | 4 ++++ lua/theme_dark.lua | 6 ++++++ lua/theme_light.lua | 12 +++++++++++- 7 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 lua/img/repeat_off.png create mode 100644 lua/img/shuffle_off.png (limited to 'lua') diff --git a/lua/images.lua b/lua/images.lua index 8900233f..5bb33d4d 100644 --- a/lua/images.lua +++ b/lua/images.lua @@ -9,7 +9,9 @@ local img = { next = lvgl.ImgData("//lua/img/next.png"), prev = lvgl.ImgData("//lua/img/prev.png"), shuffle = lvgl.ImgData("//lua/img/shuffle.png"), + shuffle_off = lvgl.ImgData("//lua/img/shuffle_off.png"), repeat_src = lvgl.ImgData("//lua/img/repeat.png"), -- repeat is a reserved word + repeat_off = lvgl.ImgData("//lua/img/repeat_off.png"), queue = lvgl.ImgData("//lua/img/queue.png"), files = lvgl.ImgData("//lua/img/files.png"), settings = lvgl.ImgData("//lua/img/settings.png"), diff --git a/lua/img/repeat.png b/lua/img/repeat.png index 40a7564e..c9941601 100644 Binary files a/lua/img/repeat.png and b/lua/img/repeat.png differ diff --git a/lua/img/repeat_off.png b/lua/img/repeat_off.png new file mode 100644 index 00000000..b8db6c4d Binary files /dev/null and b/lua/img/repeat_off.png differ diff --git a/lua/img/shuffle_off.png b/lua/img/shuffle_off.png new file mode 100644 index 00000000..eb99ccf5 Binary files /dev/null and b/lua/img/shuffle_off.png differ diff --git a/lua/playing.lua b/lua/playing.lua index 97997366..942b8836 100644 --- a/lua/playing.lua +++ b/lua/playing.lua @@ -247,16 +247,20 @@ return screen:new { queue.random:bind(function(shuffling) theme.set_style(shuffle_btn, shuffling and icon_enabled_class or icon_disabled_class) if shuffling then + shuffle_img:set_src(img.shuffle) shuffle_desc:set { text = "Disable shuffle" } else + shuffle_img:set_src(img.shuffle_off) shuffle_desc:set { text = "Enable shuffle" } end end), queue.repeat_track:bind(function(en) theme.set_style(repeat_btn, en and icon_enabled_class or icon_disabled_class) if en then + repeat_img:set_src(img.repeat_src) repeat_desc:set { text = "Disable track repeat" } else + repeat_img:set_src(img.repeat_off) repeat_desc:set { text = "Enable track repeat" } end end), diff --git a/lua/theme_dark.lua b/lua/theme_dark.lua index a908245f..41fddf81 100644 --- a/lua/theme_dark.lua +++ b/lua/theme_dark.lua @@ -86,6 +86,9 @@ local theme_dark = { {lvgl.PART.KNOB | lvgl.STATE.FOCUSED, lvgl.Style { bg_color = highlight_color, }}, + {lvgl.PART.KNOB | lvgl.STATE.EDITED, lvgl.Style { + pad_all = 2, + }}, {lvgl.PART.INDICATOR | lvgl.STATE.CHECKED, lvgl.Style { bg_color = highlight_color, }}, @@ -111,6 +114,9 @@ local theme_dark = { bg_color = highlight_color, pad_all = 1, }}, + {lvgl.PART.KNOB | lvgl.STATE.EDITED, lvgl.Style { + pad_all = 2, + }}, {lvgl.PART.INDICATOR | lvgl.STATE.CHECKED, lvgl.Style { bg_color = highlight_color, }}, diff --git a/lua/theme_light.lua b/lua/theme_light.lua index e856c015..3da3de9b 100644 --- a/lua/theme_light.lua +++ b/lua/theme_light.lua @@ -46,7 +46,7 @@ local theme_light = { radius = 4, border_color = border_color, border_width = 1, - border_side = 9, + border_side = 9, -- Bottom right outline_color = border_color, outline_width = 1, }}, @@ -56,6 +56,10 @@ local theme_light = { bg_color = highlight_color, image_recolor_opa = 0, }}, + {lvgl.PART.MAIN | lvgl.STATE.PRESSED, lvgl.Style { + margin_left = 2, + border_width = 0, + }}, }, listbutton = { {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { @@ -100,6 +104,9 @@ local theme_light = { {lvgl.PART.KNOB | lvgl.STATE.FOCUSED, lvgl.Style { bg_color = highlight_color, }}, + {lvgl.PART.KNOB | lvgl.STATE.EDITED, lvgl.Style { + pad_all = 2, + }}, {lvgl.PART.INDICATOR | lvgl.STATE.CHECKED, lvgl.Style { bg_color = highlight_color, }}, @@ -125,6 +132,9 @@ local theme_light = { bg_color = highlight_color, pad_all = 1, }}, + {lvgl.PART.KNOB | lvgl.STATE.EDITED, lvgl.Style { + pad_all = 2, + }}, {lvgl.PART.INDICATOR | lvgl.STATE.CHECKED, lvgl.Style { bg_color = highlight_color, }}, -- cgit v1.2.3 From 9ec8d6dafcee6c9722672eefad28ee3aeba4feb9 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 28 Aug 2024 12:45:10 +1000 Subject: Handle the loading state whilst appending many tracks better 1) Update the queue length periodically so that the user can see we're working 2) Clear any previous track and display "loading..." instead --- lua/playing.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/playing.lua b/lua/playing.lua index 942b8836..ff503a6c 100644 --- a/lua/playing.lua +++ b/lua/playing.lua @@ -226,7 +226,18 @@ return screen:new { end end), playback.track:bind(function(track) - if not track then return end + if not track then + if queue.loading:get() then + title:set { text = "Loading..." } + else + title:set { text = "" } + end + artist:set { text = "" } + cur_time:set { text = format_time(0) } + end_time:set { text = format_time(0) } + scrubber:set { value = 0 } + return + end if track.duration then end_time:set { text = format_time(track.duration) } else -- cgit v1.2.3 From 3421bd652c39b253872e43d3b6e43664bd0b66e2 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 28 Aug 2024 15:30:53 +1000 Subject: When clicking a track in the file browser, play it Includes adding a `playback.is_playable` for working out whether or not a particular file is able to be played --- lua/file_browser.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lua') diff --git a/lua/file_browser.lua b/lua/file_browser.lua index f4f6f216..08d683e1 100644 --- a/lua/file_browser.lua +++ b/lua/file_browser.lua @@ -65,11 +65,15 @@ return screen:new { iterator = filesystem.iterator(item:filepath()), breadcrumb = item:filepath() }) - end - if item:filepath():match("%.playlist$") then + elseif item:filepath():match("%.playlist$") then queue.open_playlist(item:filepath()) playback.playing:set(true) backstack.push(playing:new()) + elseif playback.is_playable(item:filepath()) then + queue.clear() + queue.add(item:filepath()) + playback.playing:set(true) + backstack.push(playing:new()) end end end -- cgit v1.2.3 From 91eaed4b37c7cda29103d3478df3e2c6356f8396 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 29 Aug 2024 15:52:34 +1000 Subject: use snake_case consistently in lua function names --- lua/browser.lua | 2 +- lua/file_browser.lua | 2 +- lua/licenses.lua | 4 +-- lua/main.lua | 2 +- lua/main_menu.lua | 4 +-- lua/playing.lua | 8 +++--- lua/settings.lua | 70 ++++++++++++++++++++++++++-------------------------- lua/widgets.lua | 2 +- 8 files changed, 47 insertions(+), 47 deletions(-) (limited to 'lua') diff --git a/lua/browser.lua b/lua/browser.lua index 31cb9b54..406c2e49 100644 --- a/lua/browser.lua +++ b/lua/browser.lua @@ -10,7 +10,7 @@ local theme = require("theme") local screen = require("screen") return screen:new{ - createUi = function(self) + create_ui = function(self) self.root = lvgl.Object(nil, { flex = { flex_direction = "column", diff --git a/lua/file_browser.lua b/lua/file_browser.lua index 08d683e1..b9c31d62 100644 --- a/lua/file_browser.lua +++ b/lua/file_browser.lua @@ -11,7 +11,7 @@ local screen = require("screen") local filesystem = require("filesystem") return screen:new { - createUi = function(self) + create_ui = function(self) self.root = lvgl.Object(nil, { flex = { flex_direction = "column", diff --git a/lua/licenses.lua b/lua/licenses.lua index 5c8d12cf..404719e3 100644 --- a/lua/licenses.lua +++ b/lua/licenses.lua @@ -8,8 +8,8 @@ local function show_license(text) backstack.push(widgets.MenuScreen:new { show_back = true, title = "Licenses", - createUi = function(self) - widgets.MenuScreen.createUi(self) + create_ui = function(self) + widgets.MenuScreen.create_ui(self) self.root:Label { w = lvgl.PCT(100), h = lvgl.SIZE_CONTENT, diff --git a/lua/main.lua b/lua/main.lua index 9dd88c84..f79b0e87 100644 --- a/lua/main.lua +++ b/lua/main.lua @@ -65,7 +65,7 @@ local function init_ui() elseif time.ticks() - lock_time > 8000 then local queue = require("queue") if queue.size:get() > 0 then - require("playing"):pushIfNotShown() + require("playing"):push_if_not_shown() end end end), diff --git a/lua/main_menu.lua b/lua/main_menu.lua index 54f382a1..a6b46a8a 100644 --- a/lua/main_menu.lua +++ b/lua/main_menu.lua @@ -13,8 +13,8 @@ local img = require("images") local playback = require("playback") return widgets.MenuScreen:new { - createUi = function(self) - widgets.MenuScreen.createUi(self) + create_ui = function(self) + widgets.MenuScreen.create_ui(self) -- At the top, a card showing details about the current track. Hidden if -- there is no track currently playing. diff --git a/lua/playing.lua b/lua/playing.lua index ff503a6c..b3b4ec4d 100644 --- a/lua/playing.lua +++ b/lua/playing.lua @@ -20,7 +20,7 @@ local icon_enabled_class = "icon_enabled" local icon_disabled_class = "icon_disabled" return screen:new { - createUi = function(self) + create_ui = function(self) self.root = lvgl.Object(nil, { flex = { flex_direction = "column", @@ -281,9 +281,9 @@ return screen:new { end), } end, - onShown = function() is_now_playing_shown = true end, - onHidden = function() is_now_playing_shown = false end, - pushIfNotShown = function(self) + on_show = function() is_now_playing_shown = true end, + on_hide = function() is_now_playing_shown = false end, + push_if_not_shown = function(self) if not is_now_playing_shown then backstack.push(self:new()) end diff --git a/lua/settings.lua b/lua/settings.lua index 3e0817e4..31fb5945 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -15,8 +15,8 @@ local main_menu = require("main_menu") local SettingsScreen = widgets.MenuScreen:new { show_back = true, - createUi = function(self) - widgets.MenuScreen.createUi(self) + create_ui = function(self) + widgets.MenuScreen.create_ui(self) self.content = self.root:Object { flex = { flex_direction = "column", @@ -35,8 +35,8 @@ local SettingsScreen = widgets.MenuScreen:new { local BluetoothPairing = SettingsScreen:new { title = "Nearby Devices", - createUi = function(self) - SettingsScreen.createUi(self) + create_ui = function(self) + SettingsScreen.create_ui(self) local devices = self.content:List { w = lvgl.PCT(100), @@ -55,14 +55,14 @@ local BluetoothPairing = SettingsScreen:new { end) } end, - onShown = function() bluetooth.discovering:set(true) end, - onHidden = function() bluetooth.discovering:set(false) end, + on_show = function() bluetooth.discovering:set(true) end, + on_hide = function() bluetooth.discovering:set(false) end, } local BluetoothSettings = SettingsScreen:new { title = "Bluetooth", - createUi = function(self) - SettingsScreen.createUi(self) + create_ui = function(self) + SettingsScreen.create_ui(self) -- Enable/Disable switch local enable_container = self.content:Object { @@ -203,8 +203,8 @@ local BluetoothSettings = SettingsScreen:new { local HeadphonesSettings = SettingsScreen:new { title = "Headphones", - createUi = function(self) - SettingsScreen.createUi(self) + create_ui = function(self) + SettingsScreen.create_ui(self) theme.set_style(self.content:Label { text = "Maxiumum volume limit", @@ -266,8 +266,8 @@ local HeadphonesSettings = SettingsScreen:new { local DisplaySettings = SettingsScreen:new { title = "Display", - createUi = function(self) - SettingsScreen.createUi(self) + create_ui = function(self) + SettingsScreen.create_ui(self) local brightness_title = self.content:Object { flex = { @@ -303,8 +303,8 @@ local DisplaySettings = SettingsScreen:new { local ThemeSettings = SettingsScreen:new { title = "Theme", - createUi = function(self) - SettingsScreen.createUi(self) + create_ui = function(self) + SettingsScreen.create_ui(self) theme.set_style(self.content:Label { text = "Theme", @@ -361,8 +361,8 @@ local ThemeSettings = SettingsScreen:new { local InputSettings = SettingsScreen:new { title = "Input Method", - createUi = function(self) - SettingsScreen.createUi(self) + create_ui = function(self) + SettingsScreen.create_ui(self) theme.set_style(self.content:Label { text = "Control scheme", @@ -420,8 +420,8 @@ local InputSettings = SettingsScreen:new { local MassStorageSettings = SettingsScreen:new { title = "USB Storage", - createUi = function(self) - SettingsScreen.createUi(self) + create_ui = function(self) + SettingsScreen.create_ui(self) local version = require("version").samd() if tonumber(version) < 3 then @@ -478,15 +478,15 @@ local MassStorageSettings = SettingsScreen:new { end) } end, - canPop = function() + can_pop = function() return not usb.msc_enabled:get() end } local DatabaseSettings = SettingsScreen:new { title = "Database", - createUi = function(self) - SettingsScreen.createUi(self) + create_ui = function(self) + SettingsScreen.create_ui(self) local db = require("database") widgets.Row(self.content, "Schema version", db.version()) @@ -545,8 +545,8 @@ local DatabaseSettings = SettingsScreen:new { local PowerSettings = SettingsScreen:new { title = "Power", - createUi = function(self) - SettingsScreen.createUi(self) + create_ui = function(self) + SettingsScreen.create_ui(self) local power = require("power") local charge_pct = widgets.Row(self.content, "Charge").right @@ -598,8 +598,8 @@ local PowerSettings = SettingsScreen:new { local SamdConfirmation = SettingsScreen:new { title = "Are you sure?", - createUi = function(self) - SettingsScreen.createUi(self) + create_ui = function(self) + SettingsScreen.create_ui(self) self.content:Label { w = lvgl.PCT(100), text = "After selecting 'flash', copy the new UF2 file onto the USB drive that appears. The screen will be blank until the update is finished.", @@ -630,8 +630,8 @@ local SamdConfirmation = SettingsScreen:new { local FirmwareSettings = SettingsScreen:new { title = "Firmware", - createUi = function(self) - SettingsScreen.createUi(self) + create_ui = function(self) + SettingsScreen.create_ui(self) local version = require("version") widgets.Row(self.content, "ESP32", version.esp()) widgets.Row(self.content, "SAMD21", version.samd()) @@ -661,16 +661,16 @@ local FirmwareSettings = SettingsScreen:new { local LicensesScreen = SettingsScreen:new { title = "Licenses", - createUi = function(self) - SettingsScreen.createUi(self) + create_ui = function(self) + SettingsScreen.create_ui(self) require("licenses")(self) end } local FccStatementScreen = SettingsScreen:new { title = "FCC Statement", - createUi = function(self) - SettingsScreen.createUi(self) + create_ui = function(self) + SettingsScreen.create_ui(self) local text_part = function(text) self.content:Label { @@ -698,8 +698,8 @@ local FccStatementScreen = SettingsScreen:new { local RegulatoryScreen = SettingsScreen:new { title = "Regulatory", - createUi = function(self) - SettingsScreen.createUi(self) + create_ui = function(self) + SettingsScreen.create_ui(self) local version = require("version") local small_row = function(left, right) @@ -770,8 +770,8 @@ local RegulatoryScreen = SettingsScreen:new { return widgets.MenuScreen:new { show_back = true, title = "Settings", - createUi = function(self) - widgets.MenuScreen.createUi(self) + create_ui = function(self) + widgets.MenuScreen.create_ui(self) local list = self.root:List { w = lvgl.PCT(100), h = lvgl.PCT(100), diff --git a/lua/widgets.lua b/lua/widgets.lua index 29e50f29..980f0bb2 100644 --- a/lua/widgets.lua +++ b/lua/widgets.lua @@ -37,7 +37,7 @@ end widgets.MenuScreen = screen:new { show_back = false, title = "", - createUi = function(self) + create_ui = function(self) self.root = lvgl.Object(nil, { flex = { flex_direction = "column", -- cgit v1.2.3 From 20d5de38cc3b0c236e68b409ab1870dbb3812174 Mon Sep 17 00:00:00 2001 From: ailurux Date: Thu, 29 Aug 2024 16:08:11 +1000 Subject: Style regulatory icons so they are visible with the light theme --- lua/settings.lua | 1 + lua/theme_light.lua | 6 ++++++ 2 files changed, 7 insertions(+) (limited to 'lua') diff --git a/lua/settings.lua b/lua/settings.lua index 31fb5945..934d32a2 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -760,6 +760,7 @@ local RegulatoryScreen = SettingsScreen:new { pad_top = 4, pad_column = 4, } + theme.set_style(logo_container, "regulatory_icons") button_container:add_style(styles.list_item) logo_container:Image { src = "//lua/img/ce.png" } diff --git a/lua/theme_light.lua b/lua/theme_light.lua index 3da3de9b..275d06ca 100644 --- a/lua/theme_light.lua +++ b/lua/theme_light.lua @@ -280,6 +280,12 @@ local theme_light = { image_recolor = "#fdd833", }}, }, + regulatory_icons = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 255, + image_recolor = text_color, + }}, + }, } return theme_light -- cgit v1.2.3 From 0426dfd4f21861297850905bf27158659f9d959a Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 6 Sep 2024 12:39:53 +1000 Subject: Support opening m3u and m3u8 files as playlists --- lua/file_browser.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/file_browser.lua b/lua/file_browser.lua index b9c31d62..a79cc7f0 100644 --- a/lua/file_browser.lua +++ b/lua/file_browser.lua @@ -65,7 +65,9 @@ return screen:new { iterator = filesystem.iterator(item:filepath()), breadcrumb = item:filepath() }) - elseif item:filepath():match("%.playlist$") then + elseif + item:filepath():match("%.playlist$") or + item:filepath():match("%.m3u$") then queue.open_playlist(item:filepath()) playback.playing:set(true) backstack.push(playing:new()) -- cgit v1.2.3 From d0f70787b1686adf48858b94b6187433659549c9 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 6 Sep 2024 12:41:49 +1000 Subject: m3u and m3u8 --- lua/file_browser.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/file_browser.lua b/lua/file_browser.lua index a79cc7f0..0ccd2c13 100644 --- a/lua/file_browser.lua +++ b/lua/file_browser.lua @@ -67,7 +67,7 @@ return screen:new { }) elseif item:filepath():match("%.playlist$") or - item:filepath():match("%.m3u$") then + item:filepath():match("%.m3u8?$") then queue.open_playlist(item:filepath()) playback.playing:set(true) backstack.push(playing:new()) -- cgit v1.2.3 From 45937ac6486a6258bd48359db93877f2633336d9 Mon Sep 17 00:00:00 2001 From: ailurux Date: Mon, 9 Sep 2024 00:24:08 +0000 Subject: High contrast theme + Icon Improvements (#100) Updated settings icon, rounded the circular play/pause icons, and addition of a new high contrast theme. Would be good to get feedback on the high contrast theme at this stage, as my intention is to use it as the basis for other 2-colour themes. One issue I'm aware of is the charge indicator when recoloured to black is not very legible on the black battery icon. I am planning on adding an additonal outline image that can be recoloured to the background colour to make it stand out more. Happy to fix that in a later PR or I can add it now but it will take a bit of work. Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/100 Co-authored-by: ailurux Co-committed-by: ailurux --- lua/img/pausecirc.png | Bin 7054 -> 8247 bytes lua/img/playcirc.png | Bin 7074 -> 8949 bytes lua/img/settings.png | Bin 5898 -> 12292 bytes lua/settings.lua | 1 + lua/theme_hicon.lua | 273 ++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 274 insertions(+) create mode 100644 lua/theme_hicon.lua (limited to 'lua') diff --git a/lua/img/pausecirc.png b/lua/img/pausecirc.png index d7e944fa..4c6f4fd8 100644 Binary files a/lua/img/pausecirc.png and b/lua/img/pausecirc.png differ diff --git a/lua/img/playcirc.png b/lua/img/playcirc.png index f2e48da7..dc394f3e 100644 Binary files a/lua/img/playcirc.png and b/lua/img/playcirc.png differ diff --git a/lua/img/settings.png b/lua/img/settings.png index 4fc29e51..e6fbecb3 100644 Binary files a/lua/img/settings.png and b/lua/img/settings.png differ diff --git a/lua/settings.lua b/lua/settings.lua index 934d32a2..9b77274d 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -313,6 +313,7 @@ local ThemeSettings = SettingsScreen:new { local themeOptions = {} themeOptions["Dark"] = "/lua/theme_dark.lua" themeOptions["Light"] = "/lua/theme_light.lua" + themeOptions["High Contrast"] = "/lua/theme_hicon.lua" -- Parse theme directory for more themes local theme_dir_iter = filesystem.iterator("/.themes/") diff --git a/lua/theme_hicon.lua b/lua/theme_hicon.lua new file mode 100644 index 00000000..30947c18 --- /dev/null +++ b/lua/theme_hicon.lua @@ -0,0 +1,273 @@ +local lvgl = require("lvgl") +local font = require("font") + +-- local background_color = "#000000" +-- local text_color = "#33b5e5" + +local text_color = "#000000" +local background_color = "#FFFFFF" + +local theme_hicon = { + base = { + {lvgl.PART.MAIN, lvgl.Style { + bg_opa = lvgl.OPA(0), + text_font = font.fusion_12, + }}, + {lvgl.PART.SCROLLBAR, lvgl.Style { + bg_color = text_color, + }}, + }, + root = { + {lvgl.PART.MAIN, lvgl.Style { + bg_opa = lvgl.OPA(100), + bg_color = background_color, -- Root background color + text_color = text_color + }}, + }, + header = { + {lvgl.PART.MAIN, lvgl.Style { + bg_opa = lvgl.OPA(100), + bg_color = background_color, + }}, + }, + pop_up = { + {lvgl.PART.MAIN, lvgl.Style { + bg_opa = lvgl.OPA(100), + bg_color = background_color, + border_color = text_color, + border_width = 1, + }}, + }, + button = { + {lvgl.PART.MAIN, lvgl.Style { + pad_left = 2, + pad_right = 2, + pad_top = 1, + pad_bottom = 1, + bg_color = background_color, + image_recolor_opa = 255, + image_recolor = text_color, + radius = 5, + border_color = text_color, + border_width = 1, + }}, + {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { + bg_opa = lvgl.OPA(100), + bg_color = text_color, + image_recolor_opa = 255, + image_recolor = background_color, + text_color = background_color, + }}, + }, + listbutton = { + {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { + bg_opa = lvgl.OPA(100), + bg_color = text_color, + text_color = background_color, + }}, + }, + bar = { + {lvgl.PART.MAIN, lvgl.Style { + bg_opa = lvgl.OPA(100), + bg_color = background_color, + border_color = text_color, + border_width = 1, + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + }}, + {lvgl.PART.INDICATOR, lvgl.Style { + bg_opa = lvgl.OPA(100), + bg_color = text_color, + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + }}, + }, + slider = { + {lvgl.PART.MAIN, lvgl.Style { + bg_opa = lvgl.OPA(100), + bg_color = background_color, + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + border_color = text_color, + border_width = 1, + height = 8, + }}, + {lvgl.PART.INDICATOR, lvgl.Style { + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + bg_color = text_color, + }}, + {lvgl.PART.KNOB, lvgl.Style { + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + bg_color = background_color, + border_color = text_color, + border_width = 1, + }}, + {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { + bg_color = background_color, + }}, + {lvgl.PART.KNOB | lvgl.STATE.FOCUSED, lvgl.Style { + bg_color = text_color, + }}, + {lvgl.PART.KNOB | lvgl.STATE.EDITED, lvgl.Style { + pad_all = 2, + }}, + {lvgl.PART.INDICATOR | lvgl.STATE.CHECKED, lvgl.Style { + bg_color = text_color, + }}, + }, + scrubber = { + {lvgl.PART.MAIN, lvgl.Style { + bg_opa = lvgl.OPA(100), + bg_color = background_color, + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + border_color = text_color, + border_width = 1, + }}, + {lvgl.PART.INDICATOR, lvgl.Style { + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + bg_color = text_color, + }}, + {lvgl.PART.KNOB, lvgl.Style { + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + bg_color = background_color, + border_color = text_color, + border_width = 1, + }}, + {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { + bg_color = background_color, + }}, + {lvgl.PART.KNOB | lvgl.STATE.FOCUSED, lvgl.Style { + bg_color = text_color, + pad_all = 1, + }}, + {lvgl.PART.KNOB | lvgl.STATE.EDITED, lvgl.Style { + pad_all = 4, + }}, + {lvgl.PART.INDICATOR | lvgl.STATE.CHECKED, lvgl.Style { + bg_color = text_color, + }}, + }, + switch = { + {lvgl.PART.MAIN, lvgl.Style { + bg_opa = lvgl.OPA(100), + width = 18, + height = 10, + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + bg_color = background_color, + border_color = text_color, + border_width = 1, + }}, + {lvgl.PART.INDICATOR, lvgl.Style { + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + bg_color = background_color, + }}, + {lvgl.PART.INDICATOR | lvgl.STATE.CHECKED, lvgl.Style { + bg_opa = lvgl.OPA(100), + bg_color = text_color, + }}, + {lvgl.PART.KNOB, lvgl.Style { + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + bg_opa = lvgl.OPA(100), + bg_color = background_color, + border_color = text_color, + border_width = 1, + }}, + {lvgl.PART.KNOB | lvgl.STATE.FOCUSED, lvgl.Style { + bg_color = text_color, + }}, + }, + dropdown = { + {lvgl.PART.MAIN, lvgl.Style{ + radius = 2, + pad_all = 2, + border_width = 1, + border_color = text_color, + border_side = 15, -- LV_BORDER_SIDE_FULL + bg_color = background_color, + bg_opa = lvgl.OPA(100), + }}, + {lvgl.PART.MAIN | lvgl.STATE.FOCUSED, lvgl.Style { + border_color = text_color, + bg_color = text_color, + text_color = background_color, + }}, + }, + dropdownlist = { + {lvgl.PART.MAIN, lvgl.Style{ + radius = 2, + pad_all = 2, + border_width = 1, + border_color = text_color, + bg_opa = lvgl.OPA(100), + bg_color = background_color + }}, + {lvgl.PART.SELECTED | lvgl.STATE.CHECKED, lvgl.Style { + bg_color = text_color, + text_color = background_color, + }}, + }, + database_indicator = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 255, + image_recolor = text_color, + }}, + }, + settings_title = { + {lvgl.PART.MAIN, lvgl.Style { + pad_top = 2, + pad_bottom = 4, + text_font = font.fusion_10, + text_color = text_color, + }}, + }, + icon_disabled = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 255, + image_recolor = text_color, + }}, + }, + icon_enabled = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 255, + image_recolor = text_color, + }}, + }, + now_playing = { + {lvgl.PART.MAIN, lvgl.Style { + bg_opa = lvgl.OPA(100), + radius = 32767, -- LV_RADIUS_CIRCLE = 0x7fff + border_width = 1, + border_color = text_color, + border_side = 15, -- LV_BORDER_SIDE_FULL + }}, + }, + menu_icon = { + {lvgl.PART.MAIN, lvgl.Style { + pad_all = 4, + radius = 4 + }}, + }, + battery = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 255, + image_recolor = text_color, + }}, + }, + battery_0 = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 255, + image_recolor = text_color, + }}, + }, + battery_charging = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 255, + image_recolor = text_color, + }}, + }, + battery_charge_icon = { + {lvgl.PART.MAIN, lvgl.Style { + image_recolor_opa = 200, + image_recolor = text_color, + }}, + }, +} + +return theme_hicon -- cgit v1.2.3