Change gestures in Music app and added quick ring

This commit is contained in:
tofasthacker 2023-09-26 21:39:20 -04:00
parent 21e86c4220
commit 163eaf5ab4
3 changed files with 39 additions and 33 deletions

View File

@ -292,20 +292,41 @@ void DisplayApp::Refresh() {
return TouchEvents::SwipeLeft; return TouchEvents::SwipeLeft;
} }
}; };
if (!currentScreen->OnTouchEvent(gesture)) { if (!currentScreen->OnTouchEvent(gesture)) {
if (currentApp == Apps::Clock) { if (currentApp == Apps::Clock || currentApp == Apps::Music || currentApp == Apps::Calculator || currentApp == Apps::QuickSettings) {
switch (gesture) { switch (gesture) {
case TouchEvents::SwipeUp: case TouchEvents::SwipeUp:
LoadNewScreen(Apps::Launcher, DisplayApp::FullRefreshDirections::Up); if (currentApp == Apps::Clock) {
LoadNewScreen(Apps::Launcher, DisplayApp::FullRefreshDirections::Up);
}
break; break;
case TouchEvents::SwipeDown: case TouchEvents::SwipeDown:
LoadNewScreen(Apps::Notifications, DisplayApp::FullRefreshDirections::Down); if (currentApp == Apps::Clock) {
LoadNewScreen(Apps::Notifications, DisplayApp::FullRefreshDirections::Down);
}
break; break;
case TouchEvents::SwipeRight: 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; break;
case TouchEvents::SwipeLeft: 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; break;
case TouchEvents::DoubleTap: case TouchEvents::DoubleTap:
PushMessageToSystemTask(System::Messages::GoToSleep); PushMessageToSystemTask(System::Messages::GoToSleep);
@ -535,7 +556,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>(this, systemTask->nimble().music()); currentScreen = std::make_unique<Screens::Music>(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

@ -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_obj_t* label;
lv_style_init(&btn_style); 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) { bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
switch (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: { 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; return true;
} }
case TouchEvents::SwipeLeft: { case TouchEvents::SwipeUp: {
app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::LeftAnim); lv_obj_set_hidden(btnVolDown, false);
return true; lv_obj_set_hidden(btnVolUp, false);
}
case TouchEvents::SwipeRight: { lv_obj_set_hidden(btnNext, true);
app->SetFullRefresh(DisplayApp::FullRefreshDirections::RightAnim); lv_obj_set_hidden(btnPrev, true);
return true; return true;
} }
default: { default: {

View File

@ -32,7 +32,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class Music : public Screen { class Music : public Screen {
public: public:
Music(DisplayApp* app, Pinetime::Controllers::MusicService& music); Music(Pinetime::Controllers::MusicService& music);
~Music() override; ~Music() override;