Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve gesture consistency across the firmware #720

Merged
merged 2 commits into from
Dec 30, 2021
Merged
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
2 changes: 1 addition & 1 deletion src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
break;
case Apps::FlashLight:
currentScreen = std::make_unique<Screens::FlashLight>(this, *systemTask, brightnessController);
ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None);
ReturnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::StopWatch:
currentScreen = std::make_unique<Screens::StopWatch>(this, *systemTask);
Expand Down
15 changes: 15 additions & 0 deletions src/displayapp/screens/Metronome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,16 @@ void Metronome::OnEvent(lv_obj_t* obj, lv_event_t event) {
lv_label_set_text_fmt(bpmValue, "%03d", bpm);
}
tappedTime = xTaskGetTickCount();
allowExit = true;
}
break;
}
case LV_EVENT_RELEASED:
case LV_EVENT_PRESS_LOST:
if (obj == bpmTap) {
allowExit = false;
}
break;
case LV_EVENT_CLICKED: {
if (obj == playPause) {
metronomeStarted = !metronomeStarted;
Expand All @@ -135,3 +142,11 @@ void Metronome::OnEvent(lv_obj_t* obj, lv_event_t event) {
break;
}
}

bool Metronome::OnTouchEvent(TouchEvents event) {
if (event == TouchEvents::SwipeDown && allowExit) {
running = false;
return true;
}
return false;
}
2 changes: 2 additions & 0 deletions src/displayapp/screens/Metronome.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace Pinetime {
~Metronome() override;
void Refresh() override;
void OnEvent(lv_obj_t* obj, lv_event_t event);
bool OnTouchEvent(TouchEvents event) override;

private:
TickType_t startTime = 0;
Expand All @@ -24,6 +25,7 @@ namespace Pinetime {
uint8_t counter = 1;

bool metronomeStarted = false;
bool allowExit = false;

lv_obj_t *bpmArc, *bpmTap, *bpmValue;
lv_obj_t *bpbDropdown, *currentBpbText;
Expand Down
14 changes: 8 additions & 6 deletions src/displayapp/screens/Music.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,14 @@ bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return true;
}
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;
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);
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/screens/settings/QuickSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
if (object == btn2 && event == LV_EVENT_CLICKED) {

running = false;
app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::None);
app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::Up);

} else if (object == btn1 && event == LV_EVENT_CLICKED) {

Expand Down