mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-14 03:08:36 -07:00
Refactor BadKB app structure
This commit is contained in:
@@ -1,13 +1,20 @@
|
||||
#include "../bad_kb_app_i.h"
|
||||
#include "bad_kb_view.h"
|
||||
#include "../helpers/ducky_script.h"
|
||||
#include "../bad_kb_app.h"
|
||||
#include <toolbox/path.h>
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
#include <xtreme/xtreme.h>
|
||||
#include <bt/bt_service/bt_i.h>
|
||||
|
||||
#define MAX_NAME_LEN 64
|
||||
|
||||
struct BadKb {
|
||||
View* view;
|
||||
BadKbButtonCallback callback;
|
||||
void* context;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char file_name[MAX_NAME_LEN];
|
||||
char layout[MAX_NAME_LEN];
|
||||
@@ -44,6 +51,8 @@ static void bad_kb_draw_callback(Canvas* canvas, void* _model) {
|
||||
canvas_draw_str(
|
||||
canvas, 2, 8 + canvas_current_font_height(canvas), furi_string_get_cstr(disp_str));
|
||||
|
||||
furi_string_reset(disp_str);
|
||||
|
||||
canvas_draw_icon(canvas, 22, 24, &I_UsbTree_48x22);
|
||||
|
||||
if((state == BadKbStateIdle) || (state == BadKbStateDone) ||
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <gui/view.h>
|
||||
#include "../helpers/ducky_script.h"
|
||||
|
||||
typedef struct BadKb BadKb;
|
||||
typedef void (*BadKbButtonCallback)(InputKey key, void* context);
|
||||
|
||||
typedef struct {
|
||||
View* view;
|
||||
BadKbButtonCallback callback;
|
||||
void* context;
|
||||
} BadKb;
|
||||
|
||||
typedef struct BadKbState BadKbState;
|
||||
|
||||
BadKb* bad_kb_alloc();
|
||||
|
||||
void bad_kb_free(BadKb* bad_kb);
|
||||
|
||||
Reference in New Issue
Block a user