Merge pull request 'UI tweaks' (#229) from schrockwell/tangara-fw:ui-tweaks-pr into main

Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/229
custom
cooljqln 3 months ago
commit 28846b989b
  1. 1
      .gitignore
  2. 6
      lua/main_menu.lua
  3. 2
      lua/playing.lua
  4. 14
      lua/settings.lua

1
.gitignore vendored

@ -12,6 +12,7 @@ sdkconfig.old
.vscode .vscode
compile_commands.json compile_commands.json
warnings.txt warnings.txt
.DS_Store
doc/ doc/

@ -56,7 +56,6 @@ return widgets.MenuScreen:new {
now_playing:onClicked(function() backstack.push(playing:new()) end) now_playing:onClicked(function() backstack.push(playing:new()) end)
local has_focus = false
local track_duration = nil local track_duration = nil
self.bindings = self.bindings + { self.bindings = self.bindings + {
@ -72,7 +71,6 @@ return widgets.MenuScreen:new {
now_playing:add_flag(lvgl.FLAG.HIDDEN) now_playing:add_flag(lvgl.FLAG.HIDDEN)
return return
else else
has_focus = true
now_playing:clear_flag(lvgl.FLAG.HIDDEN) now_playing:clear_flag(lvgl.FLAG.HIDDEN)
end end
title:set { text = track.title } title:set { text = track.title }
@ -140,6 +138,10 @@ return widgets.MenuScreen:new {
local function hide_no_indexes() local function hide_no_indexes()
no_indexes_container:add_flag(lvgl.FLAG.HIDDEN) no_indexes_container:add_flag(lvgl.FLAG.HIDDEN)
indexes_list:clear_flag(lvgl.FLAG.HIDDEN) indexes_list:clear_flag(lvgl.FLAG.HIDDEN)
if indexes[1] then
indexes[1].object:focus()
end
end end
local function update_visible_indexes() local function update_visible_indexes()

@ -276,7 +276,7 @@ return screen:new {
if queue.loading:get() then if queue.loading:get() then
title:set { text = "Loading..." } title:set { text = "Loading..." }
else else
title:set{text=""} title:set{ text = "Not Playing" }
end end
album:set{text=""} album:set{text=""}
artist:set{text=""} artist:set{text=""}

@ -93,6 +93,7 @@ settings.BluetoothSettings = SettingsScreen:new {
local enabled = enable_sw:enabled() local enabled = enable_sw:enabled()
bluetooth.enabled:set(enabled) bluetooth.enabled:set(enabled)
end) end)
enable_sw:focus()
self.bindings = self.bindings + { self.bindings = self.bindings + {
bluetooth.enabled:bind(function(en) bluetooth.enabled:bind(function(en)
@ -232,6 +233,7 @@ settings.HeadphonesSettings = SettingsScreen:new {
local selection = volume_chooser:get('selected') + 1 local selection = volume_chooser:get('selected') + 1
volume.limit_db:set(limits[selection]) volume.limit_db:set(limits[selection])
end) end)
volume_chooser:focus()
theme.set_subject(self.content:Label { theme.set_subject(self.content:Label {
text = "Left/Right balance", text = "Left/Right balance",
@ -304,6 +306,7 @@ settings.DisplaySettings = SettingsScreen:new {
brightness:onevent(lvgl.EVENT.VALUE_CHANGED, function() brightness:onevent(lvgl.EVENT.VALUE_CHANGED, function()
display.brightness:set(brightness:value()) display.brightness:set(brightness:value())
end) end)
brightness:focus()
self.bindings = self.bindings + { self.bindings = self.bindings + {
display.brightness:bind(function(b) display.brightness:bind(function(b)
@ -372,6 +375,8 @@ settings.ThemeSettings = SettingsScreen:new {
backstack.reset(main_menu:new()) backstack.reset(main_menu:new())
end end
end) end)
theme_chooser:focus()
end end
} }
@ -419,6 +424,8 @@ settings.InputSettings = SettingsScreen:new {
controls.scheme:set(scheme) controls.scheme:set(scheme)
end) end)
controls_chooser:focus()
theme.set_subject(self.content:Label { theme.set_subject(self.content:Label {
text = "Scroll Sensitivity", text = "Scroll Sensitivity",
}, "settings_title") }, "settings_title")
@ -483,6 +490,7 @@ settings.MassStorageSettings = SettingsScreen:new {
end end
bind_switch() bind_switch()
end) end)
enable_sw:focus()
self.bindings = self.bindings + { self.bindings = self.bindings + {
usb.msc_enabled:bind(bind_switch), usb.msc_enabled:bind(bind_switch),
@ -560,6 +568,7 @@ settings.DatabaseSettings = SettingsScreen:new {
update:onClicked(function() update:onClicked(function()
database.update() database.update()
end) end)
update:focus()
self.bindings = self.bindings + { self.bindings = self.bindings + {
database.auto_update:bind(function(en) database.auto_update:bind(function(en)
@ -841,10 +850,11 @@ settings.Root = widgets.MenuScreen:new {
end) end)
end end
item:add_style(styles.list_item) item:add_style(styles.list_item)
return item
end end
local audio_section = section("Audio") local audio_section = section("Audio")
submenu("Bluetooth", settings.BluetoothSettings, audio_section) local first_item = submenu("Bluetooth", settings.BluetoothSettings, audio_section)
submenu("Headphones", settings.HeadphonesSettings) submenu("Headphones", settings.HeadphonesSettings)
section("Interface") section("Interface")
@ -863,6 +873,8 @@ settings.Root = widgets.MenuScreen:new {
submenu("Firmware", settings.FirmwareSettings) submenu("Firmware", settings.FirmwareSettings)
submenu("Licenses", settings.LicensesScreen) submenu("Licenses", settings.LicensesScreen)
submenu("Regulatory", settings.RegulatoryScreen) submenu("Regulatory", settings.RegulatoryScreen)
first_item:focus()
end end
} }

Loading…
Cancel
Save