diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-08-28 10:36:18 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-08-28 10:36:18 +1000 |
| commit | a1327763ab70dbf4996e032dd227de368f78f4ad (patch) | |
| tree | 6d53cd295833e0e7f9ee2a37df3cbabe7f507daf /src/ui/screen_playing.cpp | |
| parent | 8ff93f5467b0eef54d18b35d742de05c8a63da9a (diff) | |
| download | tangara-fw-a1327763ab70dbf4996e032dd227de368f78f4ad.tar.gz | |
Support play/pause toggling
Diffstat (limited to 'src/ui/screen_playing.cpp')
| -rw-r--r-- | src/ui/screen_playing.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ui/screen_playing.cpp b/src/ui/screen_playing.cpp index ce0f71d6..7538d093 100644 --- a/src/ui/screen_playing.cpp +++ b/src/ui/screen_playing.cpp @@ -8,6 +8,7 @@ #include <sys/_stdint.h> #include <memory> +#include "audio_events.hpp" #include "core/lv_event.h" #include "core/lv_obj.h" #include "core/lv_obj_scroll.h" @@ -63,6 +64,10 @@ static void below_fold_focus_cb(lv_event_t* ev) { instance->OnFocusBelowFold(); } +static void play_pause_cb(lv_event_t* ev) { + events::Audio().Dispatch(audio::TogglePlayPause{}); +} + static lv_style_t scrubber_style; auto info_label(lv_obj_t* parent) -> lv_obj_t* { @@ -159,7 +164,10 @@ Playing::Playing(std::weak_ptr<database::Database> db, audio::TrackQueue* queue) LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); play_pause_control_ = control_button(controls_container, LV_SYMBOL_PLAY); + lv_obj_add_event_cb(play_pause_control_, play_pause_cb, LV_EVENT_CLICKED, + NULL); lv_group_add_obj(group_, play_pause_control_); + lv_group_add_obj(group_, control_button(controls_container, LV_SYMBOL_PREV)); lv_group_add_obj(group_, control_button(controls_container, LV_SYMBOL_NEXT)); lv_group_add_obj(group_, |
