Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nfc: add basic Mifare DESFire support #1024

Merged
merged 17 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions applications/desktop/scenes/desktop_scene_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ static void desktop_scene_main_interact_animation_callback(void* context) {
desktop->view_dispatcher, DesktopAnimationEventInteractAnimation);
}

#ifdef APP_ARCHIVE
static void desktop_switch_to_app(Desktop* desktop, const FlipperApplication* flipper_app) {
furi_assert(desktop);
furi_assert(flipper_app);
Expand All @@ -65,6 +66,7 @@ static void desktop_switch_to_app(Desktop* desktop, const FlipperApplication* fl

furi_thread_start(desktop->scene_thread);
}
#endif

void desktop_scene_main_callback(DesktopEvent event, void* context) {
Desktop* desktop = (Desktop*)context;
Expand Down
20 changes: 11 additions & 9 deletions applications/gui/modules/text_box.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,18 @@ static void text_box_insert_endline(Canvas* canvas, TextBoxModel* model) {
const char* str = model->text;
size_t line_num = 0;

const size_t text_width = 140;
const size_t text_width = 120;

while(str[i] != '\0') {
char symb = str[i++];
if(symb != '\n') {
line_width += canvas_glyph_width(canvas, symb) + 1;
if(line_width > text_width) {
size_t glyph_width = canvas_glyph_width(canvas, symb);
if(line_width + glyph_width > text_width) {
line_num++;
line_width = 0;
string_push_back(model->text_formatted, '\n');
}
line_width += glyph_width;
} else {
line_num++;
line_width = 0;
Expand All @@ -94,18 +95,19 @@ static void text_box_insert_endline(Canvas* canvas, TextBoxModel* model) {
static void text_box_view_draw_callback(Canvas* canvas, void* _model) {
TextBoxModel* model = _model;

if(!model->formatted) {
text_box_insert_endline(canvas, model);
model->formatted = true;
}

canvas_clear(canvas);
elements_slightly_rounded_frame(canvas, 0, 0, 124, 64);
if(model->font == TextBoxFontText) {
canvas_set_font(canvas, FontSecondary);
} else if(model->font == TextBoxFontHex) {
canvas_set_font(canvas, FontKeyboard);
}

if(!model->formatted) {
text_box_insert_endline(canvas, model);
model->formatted = true;
}

elements_slightly_rounded_frame(canvas, 0, 0, 124, 64);
elements_multiline_text(canvas, 3, 11, model->text_pos);
elements_scrollbar(canvas, model->scroll_pos, model->scroll_num);
}
Expand Down