responsive ui for not implemented features in lock menu (#648)

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
its your bedtime 2021-08-16 23:50:49 +03:00 committed by GitHub
parent 69f4858168
commit e1d80d5402
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

View File

@ -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) {

View File

@ -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--;
}
}
}

View File

@ -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;