From c1aa4b0d4ac05fa212ab467bd633712da407ca74 Mon Sep 17 00:00:00 2001 From: DrEverr Date: Fri, 5 Aug 2022 20:28:09 +0200 Subject: [PATCH 1/2] Change default keyboard to Uppercase --- applications/gui/modules/text_input.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/applications/gui/modules/text_input.c b/applications/gui/modules/text_input.c index c043c3c3c11..13e51451687 100644 --- a/applications/gui/modules/text_input.c +++ b/applications/gui/modules/text_input.c @@ -18,6 +18,7 @@ typedef struct { char* text_buffer; size_t text_buffer_size; bool clear_default_text; + bool defualt_keyboard; TextInputCallback callback; void* callback_context; @@ -230,7 +231,8 @@ static void text_input_view_draw_callback(Canvas* canvas, void* _model) { canvas_set_color(canvas, ColorBlack); } - if(text_length == 0 && char_is_lowercase(keys[column].text)) { + if(model->defualt_keyboard || + (text_length == 0 && char_is_lowercase(keys[column].text))) { canvas_draw_glyph( canvas, keyboard_origin_x + keys[column].x, @@ -301,6 +303,10 @@ static void text_input_handle_ok(TextInput* text_input, TextInputModel* model, b char selected = get_selected_char(model); uint8_t text_length = strlen(model->text_buffer); + if(model->defualt_keyboard) { + model->defualt_keyboard = false; + } + if(shift) { selected = char_to_uppercase(selected); } @@ -480,6 +486,7 @@ void text_input_reset(TextInput* text_input) { model->selected_row = 0; model->selected_column = 0; model->clear_default_text = false; + model->defualt_keyboard = true; model->text_buffer = NULL; model->text_buffer_size = 0; model->callback = NULL; From c9348435213df8b7cc30c409bdedce34e1db168b Mon Sep 17 00:00:00 2001 From: DrEverr Date: Fri, 5 Aug 2022 23:02:43 +0200 Subject: [PATCH 2/2] Deleted default_keyboard parameter --- applications/gui/modules/text_input.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/applications/gui/modules/text_input.c b/applications/gui/modules/text_input.c index 13e51451687..711f28a326b 100644 --- a/applications/gui/modules/text_input.c +++ b/applications/gui/modules/text_input.c @@ -18,7 +18,6 @@ typedef struct { char* text_buffer; size_t text_buffer_size; bool clear_default_text; - bool defualt_keyboard; TextInputCallback callback; void* callback_context; @@ -231,7 +230,7 @@ static void text_input_view_draw_callback(Canvas* canvas, void* _model) { canvas_set_color(canvas, ColorBlack); } - if(model->defualt_keyboard || + if(model->clear_default_text || (text_length == 0 && char_is_lowercase(keys[column].text))) { canvas_draw_glyph( canvas, @@ -303,10 +302,6 @@ static void text_input_handle_ok(TextInput* text_input, TextInputModel* model, b char selected = get_selected_char(model); uint8_t text_length = strlen(model->text_buffer); - if(model->defualt_keyboard) { - model->defualt_keyboard = false; - } - if(shift) { selected = char_to_uppercase(selected); } @@ -486,7 +481,6 @@ void text_input_reset(TextInput* text_input) { model->selected_row = 0; model->selected_column = 0; model->clear_default_text = false; - model->defualt_keyboard = true; model->text_buffer = NULL; model->text_buffer_size = 0; model->callback = NULL;