From e1d80d5402d8b19de7e5a448dc20bc83a50e7bfc Mon Sep 17 00:00:00 2001 From: its your bedtime <23366927+itsyourbedtime@users.noreply.github.com> Date: Mon, 16 Aug 2021 23:50:49 +0300 Subject: [PATCH] responsive ui for not implemented features in lock menu (#648) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: あく --- applications/dolphin/dolphin.c | 8 ++++++++ applications/dolphin/dolphin_views.c | 13 +++++++++++-- applications/dolphin/dolphin_views.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/applications/dolphin/dolphin.c b/applications/dolphin/dolphin.c index 705ed808..b7133b9a 100644 --- a/applications/dolphin/dolphin.c +++ b/applications/dolphin/dolphin.c @@ -180,6 +180,12 @@ static void lock_menu_callback(void* context, uint8_t index) { break; default: + // wip message + with_view_model( + dolphin->view_lockmenu, (DolphinViewLockMenuModel * model) { + model->hint_timeout = HINT_TIMEOUT_H; + return true; + }); break; } } @@ -199,6 +205,8 @@ bool dolphin_view_lockmenu_input(InputEvent* event, void* context) { DolphinViewLockMenuModel* model = view_get_model(dolphin->view_lockmenu); + model->hint_timeout = 0; // clear hint timeout + if(event->key == InputKeyUp) { model->idx = CLAMP(model->idx - 1, 2, 0); } else if(event->key == InputKeyDown) { diff --git a/applications/dolphin/dolphin_views.c b/applications/dolphin/dolphin_views.c index 8953fe3a..953671e7 100644 --- a/applications/dolphin/dolphin_views.c +++ b/applications/dolphin/dolphin_views.c @@ -63,7 +63,7 @@ void dolphin_view_idle_main_draw(Canvas* canvas, void* model) { canvas_draw_icon_animation(canvas, 0, -3, m->animation); } - if(m->hint_timeout > 0) { + if(m->hint_timeout) { m->hint_timeout--; if(m->locked) { canvas_draw_icon(canvas, 13, 5, &I_LockPopup_100x49); @@ -98,10 +98,19 @@ void dolphin_view_lockmenu_draw(Canvas* canvas, void* model) { if(m->door_left_x == -57) { for(uint8_t i = 0; i < 3; ++i) { canvas_draw_str_aligned( - canvas, 64, 13 + (i * 17), AlignCenter, AlignCenter, Lockmenu_Items[i]); + canvas, + 64, + 13 + (i * 17), + AlignCenter, + AlignCenter, + (m->hint_timeout && m->idx == i) ? "Not implemented" : Lockmenu_Items[i]); if(m->idx == i) elements_frame(canvas, 15, 5 + (i * 17), 98, 15); } } + + if(m->hint_timeout) { + m->hint_timeout--; + } } } diff --git a/applications/dolphin/dolphin_views.h b/applications/dolphin/dolphin_views.h index 8987d829..2f91b69a 100644 --- a/applications/dolphin/dolphin_views.h +++ b/applications/dolphin/dolphin_views.h @@ -41,6 +41,8 @@ typedef struct { int8_t door_left_x; int8_t door_right_x; uint8_t exit_timeout; + uint8_t hint_timeout; + bool locked; } DolphinViewLockMenuModel;