From 5d028b1260db02780f9b926d869310bbc4084137 Mon Sep 17 00:00:00 2001 From: tofasthacker Date: Tue, 26 Sep 2023 21:39:20 -0400 Subject: [PATCH] Change gestures in Music app and added quick ring --- src/displayapp/DisplayApp.cpp | 65 +++++++++++++++++++++++++++++--- src/displayapp/screens/Music.cpp | 25 ++++-------- 2 files changed, 66 insertions(+), 24 deletions(-) diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 78a25a46..b91741ad 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -310,20 +310,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); @@ -568,7 +589,39 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio currentScreen.reset(userWatchFaces[0].create(controllers)); } break; - } + case Apps::Twos: + currentScreen = std::make_unique(); + break; + case Apps::Paint: + currentScreen = std::make_unique(lvgl, motorController); + break; + case Apps::Paddle: + currentScreen = std::make_unique(lvgl); + break; + case Apps::Music: + currentScreen = std::make_unique(systemTask->nimble().music()); + break; + case Apps::Navigation: + currentScreen = std::make_unique(systemTask->nimble().navigation()); + break; + case Apps::HeartRate: + currentScreen = std::make_unique(heartRateController, *systemTask); + break; + case Apps::Metronome: + currentScreen = std::make_unique(motorController, *systemTask); + break; + /* Weather debug app + case Apps::Weather: + currentScreen = std::make_unique(this, systemTask->nimble().weather()); + break; + */ + case Apps::Steps: + currentScreen = std::make_unique(motionController, settingsController); + break; + // My Apps + case Apps::Calculator: + currentScreen = std::make_unique(); + break; } currentApp = app; } diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp index 0763da0f..6e17a3f2 100644 --- a/src/displayapp/screens/Music.cpp +++ b/src/displayapp/screens/Music.cpp @@ -250,6 +250,13 @@ void Music::OnObjectEvent(lv_obj_t* obj, lv_event_t event) { bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) { switch (event) { + case TouchEvents::SwipeDown: { + 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::SwipeUp: { lv_obj_set_hidden(btnVolDown, false); lv_obj_set_hidden(btnVolUp, false); @@ -258,24 +265,6 @@ bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) { lv_obj_set_hidden(btnPrev, true); return true; } - case TouchEvents::SwipeDown: { - 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; - } - return false; - } - case TouchEvents::SwipeLeft: { - musicService.event(Controllers::MusicService::EVENT_MUSIC_NEXT); - return true; - } - case TouchEvents::SwipeRight: { - musicService.event(Controllers::MusicService::EVENT_MUSIC_PREV); - return true; - } default: { return false; }