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;
}
};
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<Screens::Paddle>(lvgl);
break;
case Apps::Music:
currentScreen = std::make_unique<Screens::Music>(this, systemTask->nimble().music());
currentScreen = std::make_unique<Screens::Music>(systemTask->nimble().music());
break;
case Apps::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_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: {

View File

@ -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;