Improve gesture consistency across the firmware
This commit is contained in:
parent
395590d2d8
commit
86d180a855
3 changed files with 24 additions and 6 deletions
|
@ -113,9 +113,15 @@ void Metronome::OnEvent(lv_obj_t* obj, lv_event_t event) {
|
||||||
lv_label_set_text_fmt(bpmValue, "%03d", bpm);
|
lv_label_set_text_fmt(bpmValue, "%03d", bpm);
|
||||||
}
|
}
|
||||||
tappedTime = xTaskGetTickCount();
|
tappedTime = xTaskGetTickCount();
|
||||||
|
allowExit = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case LV_EVENT_RELEASED:
|
||||||
|
case LV_EVENT_PRESS_LOST:
|
||||||
|
if (obj == bpmTap) {
|
||||||
|
allowExit = false;
|
||||||
|
}
|
||||||
case LV_EVENT_CLICKED: {
|
case LV_EVENT_CLICKED: {
|
||||||
if (obj == playPause) {
|
if (obj == playPause) {
|
||||||
metronomeStarted = !metronomeStarted;
|
metronomeStarted = !metronomeStarted;
|
||||||
|
@ -135,3 +141,11 @@ void Metronome::OnEvent(lv_obj_t* obj, lv_event_t event) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Metronome::OnTouchEvent(TouchEvents event) {
|
||||||
|
if (event == TouchEvents::SwipeDown && allowExit) {
|
||||||
|
running = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace Pinetime {
|
||||||
~Metronome() override;
|
~Metronome() override;
|
||||||
void Refresh() override;
|
void Refresh() override;
|
||||||
void OnEvent(lv_obj_t* obj, lv_event_t event);
|
void OnEvent(lv_obj_t* obj, lv_event_t event);
|
||||||
|
bool OnTouchEvent(TouchEvents event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TickType_t startTime = 0;
|
TickType_t startTime = 0;
|
||||||
|
@ -25,6 +26,7 @@ namespace Pinetime {
|
||||||
uint8_t counter = 1;
|
uint8_t counter = 1;
|
||||||
|
|
||||||
bool metronomeStarted = false;
|
bool metronomeStarted = false;
|
||||||
|
bool allowExit = false;
|
||||||
|
|
||||||
lv_obj_t *bpmArc, *bpmTap, *bpmValue;
|
lv_obj_t *bpmArc, *bpmTap, *bpmValue;
|
||||||
lv_obj_t *bpbDropdown, *currentBpbText;
|
lv_obj_t *bpbDropdown, *currentBpbText;
|
||||||
|
|
|
@ -277,13 +277,15 @@ bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case TouchEvents::SwipeDown: {
|
case TouchEvents::SwipeDown: {
|
||||||
|
if (lv_obj_get_hidden(btnNext)) {
|
||||||
lv_obj_set_hidden(btnNext, false);
|
lv_obj_set_hidden(btnNext, false);
|
||||||
lv_obj_set_hidden(btnPrev, false);
|
lv_obj_set_hidden(btnPrev, false);
|
||||||
|
|
||||||
lv_obj_set_hidden(btnVolDown, true);
|
lv_obj_set_hidden(btnVolDown, true);
|
||||||
lv_obj_set_hidden(btnVolUp, true);
|
lv_obj_set_hidden(btnVolUp, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
case TouchEvents::SwipeLeft: {
|
case TouchEvents::SwipeLeft: {
|
||||||
musicService.event(Controllers::MusicService::EVENT_MUSIC_NEXT);
|
musicService.event(Controllers::MusicService::EVENT_MUSIC_NEXT);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue