[FL-3060] New MFC Bruteforce animation (#2190)

* Change the wording in the headers
* Add support for text in the progress bar
* New MFC key bruteforce screen
* Typo fix
* nfc: rename Flipper Dict to System Dict
* elements: fix types
* Display the correct key attack sector

Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Astra
2022-12-27 11:14:03 +02:00
committed by GitHub
parent 08eb666f7b
commit ded7e727d0
15 changed files with 130 additions and 23 deletions

View File

@@ -17,6 +17,7 @@ extern "C" {
typedef enum {
ColorWhite = 0x00,
ColorBlack = 0x01,
ColorXOR = 0x02,
} Color;
/** Fonts enumeration */

View File

@@ -41,6 +41,31 @@ void elements_progress_bar(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width,
canvas_draw_box(canvas, x + 1, y + 1, progress_length, height - 2);
}
void elements_progress_bar_with_text(
Canvas* canvas,
uint8_t x,
uint8_t y,
uint8_t width,
float progress,
const char* text) {
furi_assert(canvas);
furi_assert((progress >= 0.0f) && (progress <= 1.0f));
uint8_t height = 11;
uint8_t progress_length = roundf(progress * (width - 2));
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_box(canvas, x + 1, y + 1, progress_length, height - 2);
canvas_set_color(canvas, ColorXOR);
canvas_set_font(canvas, FontSecondary);
canvas_draw_str_aligned(canvas, x + width / 2, y + 2, AlignCenter, AlignTop, text);
}
void elements_scrollbar_pos(
Canvas* canvas,
uint8_t x,

View File

@@ -31,6 +31,23 @@ extern "C" {
*/
void elements_progress_bar(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, float progress);
/** Draw progress bar with text.
*
* @param canvas Canvas instance
* @param x progress bar position on X axis
* @param y progress bar position on Y axis
* @param width progress bar width
* @param progress progress (0.0 - 1.0)
* @param text text to draw
*/
void elements_progress_bar_with_text(
Canvas* canvas,
uint8_t x,
uint8_t y,
uint8_t width,
float progress,
const char* text);
/** Draw scrollbar on canvas at specific position.
*
* @param canvas Canvas instance