diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 4220ed76..31fe135a 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -292,20 +292,41 @@ void DisplayApp::Refresh() { return TouchEvents::SwipeLeft; } }; + if (!currentScreen->OnTouchEvent(gesture)) { - if (currentApp == Apps::Clock) { + if (currentApp == Apps::Clock || currentApp == Apps::Music || currentApp == Apps::Calculator || currentApp == Apps::QuickSettings) { switch (gesture) { case TouchEvents::SwipeUp: - LoadNewScreen(Apps::Launcher, DisplayApp::FullRefreshDirections::Up); + if (currentApp == Apps::Clock) { + LoadNewScreen(Apps::Launcher, DisplayApp::FullRefreshDirections::Up); + } break; case TouchEvents::SwipeDown: - LoadNewScreen(Apps::Notifications, DisplayApp::FullRefreshDirections::Down); + if (currentApp == Apps::Clock) { + LoadNewScreen(Apps::Notifications, DisplayApp::FullRefreshDirections::Down); + } break; case TouchEvents::SwipeRight: - LoadNewScreen(Apps::QuickSettings, DisplayApp::FullRefreshDirections::RightAnim); + if (currentApp == Apps::Clock) { + LoadNewScreen(Apps::QuickSettings, DisplayApp::FullRefreshDirections::RightAnim); + } else if (currentApp == Apps::QuickSettings) { + LoadNewScreen(Apps::Calculator, DisplayApp::FullRefreshDirections::RightAnim); + } else if (currentApp == Apps::Calculator) { + LoadNewScreen(Apps::Music, DisplayApp::FullRefreshDirections::RightAnim); + } else { + LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::RightAnim); + } break; case TouchEvents::SwipeLeft: - LoadNewScreen(Apps::Music, DisplayApp::FullRefreshDirections::LeftAnim); + if (currentApp == Apps::Clock) { + LoadNewScreen(Apps::Music, DisplayApp::FullRefreshDirections::LeftAnim); + } else if (currentApp == Apps::Music) { + LoadNewScreen(Apps::Calculator, DisplayApp::FullRefreshDirections::LeftAnim); + } else if (currentApp == Apps::Calculator) { + LoadNewScreen(Apps::QuickSettings, DisplayApp::FullRefreshDirections::LeftAnim); + } else { + LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::LeftAnim); + } break; case TouchEvents::DoubleTap: PushMessageToSystemTask(System::Messages::GoToSleep); @@ -535,7 +556,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio currentScreen = std::make_unique(lvgl); break; case Apps::Music: - currentScreen = std::make_unique(this, systemTask->nimble().music()); + currentScreen = std::make_unique(systemTask->nimble().music()); break; case Apps::Navigation: currentScreen = std::make_unique(systemTask->nimble().navigation()); diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp index fe380763..806132c0 100644 --- a/src/displayapp/screens/Music.cpp +++ b/src/displayapp/screens/Music.cpp @@ -49,7 +49,7 @@ inline void lv_img_set_src_arr(lv_obj_t* img, const lv_img_dsc_t* src_img) { */ -Music::Music(DisplayApp* app, Pinetime::Controllers::MusicService& music) : app {app}, musicService(music) { +Music::Music(Pinetime::Controllers::MusicService& music) : musicService(music) { lv_obj_t* label; lv_style_init(&btn_style); @@ -252,34 +252,19 @@ void Music::OnObjectEvent(lv_obj_t* obj, lv_event_t event) { bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) { switch (event) { - case TouchEvents::SwipeUp: { - if (lv_obj_get_hidden(btnNext)) { - lv_obj_set_hidden(btnNext, false); - lv_obj_set_hidden(btnPrev, false); - lv_obj_set_hidden(btnVolDown, true); - lv_obj_set_hidden(btnVolUp, true); - return true; - } - 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); + lv_obj_set_hidden(btnNext, false); + lv_obj_set_hidden(btnPrev, false); + lv_obj_set_hidden(btnVolDown, true); + lv_obj_set_hidden(btnVolUp, true); return true; } - case TouchEvents::SwipeLeft: { - app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::LeftAnim); - return true; - } - case TouchEvents::SwipeRight: { - app->SetFullRefresh(DisplayApp::FullRefreshDirections::RightAnim); + 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; } default: { diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h index b73072bf..9c5c0945 100644 --- a/src/displayapp/screens/Music.h +++ b/src/displayapp/screens/Music.h @@ -32,7 +32,7 @@ namespace Pinetime { namespace Screens { class Music : public Screen { public: - Music(DisplayApp* app, Pinetime::Controllers::MusicService& music); + Music(Pinetime::Controllers::MusicService& music); ~Music() override;