Improve gesture consistency across the firmware
This commit is contained in:
parent
395590d2d8
commit
86d180a855
|
@ -113,9 +113,15 @@ 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;
|
||||
}
|
||||
case LV_EVENT_CLICKED: {
|
||||
if (obj == playPause) {
|
||||
metronomeStarted = !metronomeStarted;
|
||||
|
@ -135,3 +141,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;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,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;
|
||||
|
@ -25,6 +26,7 @@ namespace Pinetime {
|
|||
uint8_t counter = 1;
|
||||
|
||||
bool metronomeStarted = false;
|
||||
bool allowExit = false;
|
||||
|
||||
lv_obj_t *bpmArc, *bpmTap, *bpmValue;
|
||||
lv_obj_t *bpbDropdown, *currentBpbText;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user