Fix ui nits for playback screen

The top bar now updates properly when starting playback, and the
upcoming list items no longer marquee.
custom
jacqueline 2 years ago
parent ad74a45921
commit b0aa9ab391
  1. 4
      src/ui/include/ui_fsm.hpp
  2. 1
      src/ui/screen_playing.cpp
  3. 19
      src/ui/ui_fsm.cpp

@ -49,8 +49,8 @@ class UiState : public tinyfsm::Fsm<UiState> {
void react(const tinyfsm::Event& ev) {} void react(const tinyfsm::Event& ev) {}
virtual void react(const system_fsm::BatteryStateChanged&); virtual void react(const system_fsm::BatteryStateChanged&);
virtual void react(const audio::PlaybackStarted&){}; virtual void react(const audio::PlaybackStarted&);
virtual void react(const audio::PlaybackFinished&){}; virtual void react(const audio::PlaybackFinished&);
virtual void react(const audio::PlaybackUpdate&) {} virtual void react(const audio::PlaybackUpdate&) {}
virtual void react(const audio::QueueUpdate&) {} virtual void react(const audio::QueueUpdate&) {}

@ -99,6 +99,7 @@ auto Playing::control_button(lv_obj_t* parent, char* icon) -> lv_obj_t* {
auto Playing::next_up_label(lv_obj_t* parent, const std::string& text) auto Playing::next_up_label(lv_obj_t* parent, const std::string& text)
-> lv_obj_t* { -> lv_obj_t* {
lv_obj_t* button = lv_list_add_btn(parent, NULL, text.c_str()); lv_obj_t* button = lv_list_add_btn(parent, NULL, text.c_str());
lv_label_set_long_mode(lv_obj_get_child(button, -1), LV_LABEL_LONG_DOT);
lv_obj_add_event_cb(button, below_fold_focus_cb, LV_EVENT_FOCUSED, this); lv_obj_add_event_cb(button, below_fold_focus_cb, LV_EVENT_FOCUSED, this);
lv_group_add_obj(group_, button); lv_group_add_obj(group_, button);
return button; return button;

@ -91,6 +91,14 @@ void UiState::react(const system_fsm::BatteryStateChanged&) {
UpdateTopBar(); UpdateTopBar();
} }
void UiState::react(const audio::PlaybackStarted&) {
UpdateTopBar();
}
void UiState::react(const audio::PlaybackFinished&) {
UpdateTopBar();
}
void UiState::UpdateTopBar() { void UiState::UpdateTopBar() {
auto battery_state = sServices->battery().State(); auto battery_state = sServices->battery().State();
bool has_queue = sServices->track_queue().GetCurrent().has_value(); bool has_queue = sServices->track_queue().GetCurrent().has_value();
@ -260,18 +268,17 @@ void Playing::exit() {
} }
void Playing::react(const audio::PlaybackStarted& ev) { void Playing::react(const audio::PlaybackStarted& ev) {
vTaskPrioritySet(NULL, 0);
UpdateTopBar(); UpdateTopBar();
sPlayingScreen->OnTrackUpdate(); sPlayingScreen->OnTrackUpdate();
} }
void Playing::react(const audio::PlaybackUpdate& ev) {
sPlayingScreen->OnPlaybackUpdate(ev.seconds_elapsed, ev.seconds_total);
}
void Playing::react(const audio::PlaybackFinished& ev) { void Playing::react(const audio::PlaybackFinished& ev) {
UpdateTopBar(); UpdateTopBar();
vTaskPrioritySet(NULL, 10); sPlayingScreen->OnTrackUpdate();
}
void Playing::react(const audio::PlaybackUpdate& ev) {
sPlayingScreen->OnPlaybackUpdate(ev.seconds_elapsed, ev.seconds_total);
} }
void Playing::react(const audio::QueueUpdate& ev) { void Playing::react(const audio::QueueUpdate& ev) {

Loading…
Cancel
Save