Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ void DisplayApp::Refresh() {
case FullRefreshDirections::RightAnim:
returnDirection = FullRefreshDirections::LeftAnim;
break;
case FullRefreshDirections::Left:
returnDirection = FullRefreshDirections::Right;
break;
case FullRefreshDirections::Right:
returnDirection = FullRefreshDirections::Left;
break;
default:
returnDirection = FullRefreshDirections::None;
break;
Expand Down Expand Up @@ -416,6 +422,10 @@ void DisplayApp::Refresh() {
return TouchEvents::SwipeRight;
case DisplayApp::FullRefreshDirections::RightAnim:
return TouchEvents::SwipeLeft;
case DisplayApp::FullRefreshDirections::Left:
return TouchEvents::SwipeRight;
case DisplayApp::FullRefreshDirections::Right:
return TouchEvents::SwipeLeft;
}
};
if (!currentScreen->OnTouchEvent(gesture)) {
Expand All @@ -430,6 +440,11 @@ void DisplayApp::Refresh() {
case TouchEvents::SwipeRight:
LoadNewScreen(Apps::QuickSettings, DisplayApp::FullRefreshDirections::RightAnim);
break;
case TouchEvents::SwipeLeft:
if (previousApp != Apps::None) {
LoadNewScreen(previousApp, DisplayApp::FullRefreshDirections::LeftAnim);
}
break;
case TouchEvents::DoubleTap:
PushMessageToSystemTask(System::Messages::GoToSleep);
break;
Expand All @@ -438,6 +453,10 @@ void DisplayApp::Refresh() {
}
} else if (gesture == LoadDirToReturnSwipe(appStackDirections.Top())) {
LoadPreviousScreen();
} else if (gesture == TouchEvents::SwipeRight && currentApp != Apps::QuickSettings) {
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::RightAnim);
appStackDirections.Reset();
returnAppStack.Reset();
}
} else {
lvgl.CancelTap();
Expand All @@ -458,6 +477,8 @@ void DisplayApp::Refresh() {
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::Up);
} else if (currentApp == Apps::QuickSettings) {
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::LeftAnim);
} else if (currentApp == previousApp) {
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::RightAnim);
} else {
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::Down);
}
Expand Down Expand Up @@ -498,7 +519,10 @@ void DisplayApp::Refresh() {
}
}

void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction) {
void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction, bool setPrevious) {
if (setPrevious) {
previousApp = app;
}
nextApp = app;
nextDirection = direction;
}
Expand Down
4 changes: 3 additions & 1 deletion src/displayapp/DisplayApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace Pinetime {
void Start(System::BootErrors error);
void PushMessage(Display::Messages msg);

void StartApp(Apps app, DisplayApp::FullRefreshDirections direction);
void StartApp(Apps app, DisplayApp::FullRefreshDirections direction, bool setPrevious = false);

void SetFullRefresh(FullRefreshDirections direction);

Expand Down Expand Up @@ -118,7 +118,9 @@ namespace Pinetime {
std::unique_ptr<Screens::Screen> currentScreen;

Apps currentApp = Apps::None;
Apps previousApp = Apps::None;
Apps returnToApp = Apps::None;

FullRefreshDirections returnDirection = FullRefreshDirections::None;
TouchEvents returnTouchEvent = TouchEvents::None;

Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/screens/Tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ void Tile::OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId) {
return;
}

app->StartApp(apps[buttonId], DisplayApp::FullRefreshDirections::Up);
app->StartApp(apps[buttonId], DisplayApp::FullRefreshDirections::Up, true);
running = false;
}