laid down main frame work. Need to add app class

This commit is contained in:
tofasthacker 2023-09-24 22:17:11 -04:00
parent 09f7306e31
commit 21e86c4220
3 changed files with 21 additions and 14 deletions

View File

@ -535,7 +535,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
currentScreen = std::make_unique<Screens::Paddle>(lvgl); currentScreen = std::make_unique<Screens::Paddle>(lvgl);
break; break;
case Apps::Music: case Apps::Music:
currentScreen = std::make_unique<Screens::Music>(systemTask->nimble().music()); currentScreen = std::make_unique<Screens::Music>(this, systemTask->nimble().music());
break; break;
case Apps::Navigation: case Apps::Navigation:
currentScreen = std::make_unique<Screens::Navigation>(systemTask->nimble().navigation()); currentScreen = std::make_unique<Screens::Navigation>(systemTask->nimble().navigation());

View File

@ -47,7 +47,9 @@ inline void lv_img_set_src_arr(lv_obj_t* img, const lv_img_dsc_t* src_img) {
* *
* TODO: Investigate Apple Media Service and AVRCPv1.6 support for seamless integration * TODO: Investigate Apple Media Service and AVRCPv1.6 support for seamless integration
*/ */
Music::Music(Pinetime::Controllers::MusicService& music) : musicService(music) {
Music::Music(DisplayApp* app, Pinetime::Controllers::MusicService& music) : app {app}, musicService(music) {
lv_obj_t* label; lv_obj_t* label;
lv_style_init(&btn_style); lv_style_init(&btn_style);
@ -251,14 +253,6 @@ void Music::OnObjectEvent(lv_obj_t* obj, lv_event_t event) {
bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) { bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
switch (event) { switch (event) {
case TouchEvents::SwipeUp: { case TouchEvents::SwipeUp: {
lv_obj_set_hidden(btnVolDown, false);
lv_obj_set_hidden(btnVolUp, false);
lv_obj_set_hidden(btnNext, true);
lv_obj_set_hidden(btnPrev, true);
return true;
}
case TouchEvents::SwipeDown: {
if (lv_obj_get_hidden(btnNext)) { if (lv_obj_get_hidden(btnNext)) {
lv_obj_set_hidden(btnNext, false); lv_obj_set_hidden(btnNext, false);
lv_obj_set_hidden(btnPrev, false); lv_obj_set_hidden(btnPrev, false);
@ -266,14 +260,26 @@ bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
lv_obj_set_hidden(btnVolUp, true); lv_obj_set_hidden(btnVolUp, true);
return true; return true;
} }
return false; else{
lv_obj_set_hidden(btnVolDown, false);
lv_obj_set_hidden(btnVolUp, false);
lv_obj_set_hidden(btnNext, true);
lv_obj_set_hidden(btnPrev, true);
}
return true;
}
case TouchEvents::SwipeDown: {
app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down);
return true;
} }
case TouchEvents::SwipeLeft: { case TouchEvents::SwipeLeft: {
musicService.event(Controllers::MusicService::EVENT_MUSIC_NEXT); app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::LeftAnim);
return true; return true;
} }
case TouchEvents::SwipeRight: { case TouchEvents::SwipeRight: {
musicService.event(Controllers::MusicService::EVENT_MUSIC_PREV); app->SetFullRefresh(DisplayApp::FullRefreshDirections::RightAnim);
return true; return true;
} }
default: { default: {

View File

@ -18,6 +18,7 @@
#pragma once #pragma once
#include <FreeRTOS.h> #include <FreeRTOS.h>
#include "displayapp/DisplayApp.h"
#include <lvgl/src/lv_core/lv_obj.h> #include <lvgl/src/lv_core/lv_obj.h>
#include <string> #include <string>
#include "displayapp/screens/Screen.h" #include "displayapp/screens/Screen.h"
@ -31,7 +32,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class Music : public Screen { class Music : public Screen {
public: public:
Music(Pinetime::Controllers::MusicService& music); Music(DisplayApp* app, Pinetime::Controllers::MusicService& music);
~Music() override; ~Music() override;