[FL-1461] Update progressbar UI (IR bruteforce) (#997)

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Albert Kharisov 2022-02-16 15:29:28 +04:00 committed by GitHub
parent b8b42d0bef
commit 97c9a2229f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 22 deletions

View file

@ -37,30 +37,15 @@ void elements_progress_bar(
furi_assert(canvas);
furi_assert(total > 0);
uint8_t height = 9;
uint8_t marker_width = 7;
furi_assert(width > marker_width);
uint8_t progress_length = ((float)progress / total) * (width - marker_width - 2);
uint8_t progress_length = roundf(((float)progress / total) * (width - 2));
// rframe doesnt work if (radius * 2) > any rect side, so write manually
uint8_t x_max = x + width - 1;
uint8_t y_max = y + height - 1;
canvas_draw_line(canvas, x + 3, y, x_max - 3, y);
canvas_draw_line(canvas, x_max - 3, y, x_max, y + 3);
canvas_draw_line(canvas, x_max, y + 3, x_max, y_max - 3);
canvas_draw_line(canvas, x_max, y_max - 3, x_max - 3, y_max);
canvas_draw_line(canvas, x_max - 3, y_max, x + 3, y_max);
canvas_draw_line(canvas, x + 3, y_max, x, y_max - 3);
canvas_draw_line(canvas, x, y_max - 3, x, y + 3);
canvas_draw_line(canvas, x, y + 3, x + 3, y);
canvas_set_color(canvas, ColorWhite);
canvas_draw_box(canvas, x + 1, y + 1, width - 2, height - 2);
canvas_set_color(canvas, ColorBlack);
canvas_draw_rframe(canvas, x, y, width, height, 3);
canvas_draw_rbox(canvas, x + 1, y + 1, marker_width + progress_length, height - 2, 3);
canvas_invert_color(canvas);
canvas_draw_dot(canvas, x + progress_length + 3, y + 2);
canvas_draw_dot(canvas, x + progress_length + 4, y + 2);
canvas_draw_dot(canvas, x + progress_length + 5, y + 3);
canvas_draw_dot(canvas, x + progress_length + 6, y + 4);
canvas_invert_color(canvas);
canvas_draw_box(canvas, x + 1, y + 1, progress_length, height - 2);
}
void elements_scrollbar_pos(

View file

@ -52,7 +52,7 @@ void popup_brut_draw_callback(Canvas* canvas, void* context) {
canvas_draw_line(canvas, x_max - 1, y_max - 2, x_max - 3, y_max - 2);
elements_progress_bar(
canvas, x + 4, y + 19, x_max - 8, popup_brut->progress, popup_brut->progress_max);
canvas, x + 4, y + 19, x_max - 7, popup_brut->progress, popup_brut->progress_max);
canvas_set_font(canvas, FontSecondary);
canvas_draw_str(canvas, x + 15, y + 12, "Sending ...");