Skip to content

Commit

Permalink
Archive and Keyboard Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
RogueMaster committed Apr 24, 2023
1 parent 70f1523 commit 20bc898
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 31 deletions.
5 changes: 5 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ This software is for experimental purposes only and is not meant for any illegal
- Last Synced/Checked OFW, changes in [commits](https://github.com/flipperdevices/flipperzero-firmware/commits/dev): `2023-04-24 06:32 EST`
- Reapply Flipper Scope fixes, Deep Sleep, BLE stack / cubewb updates from OFW successfully without boot loop
- Known Issue: Flipper Scope does not load
- Archive: Allow Folder Favorites [(By Willy-JL)]
- GUI: Extended Keyboard [(By Willy-JL)]

<a name="release">

Expand Down Expand Up @@ -103,6 +105,7 @@ $ ./fbt dolphin_ext
- Animations: SubGHZ Scanning image with Pikachu [Thanks to Panzer00Z](https://github.com/Panzer00Z/flipperzero-firmware/blob/3a548ea9bb181c9348d8afb427890c411456134e/assets/icons/SubGhz/Scanning_123x52.png)
- Animations: Trimmed out the Flipper animations. `/ext/dolphin` folder on your Flipper should now be managed by you! [Copy this folder (RM Select)](https://github.com/RogueMaster/awesome-flipperzero-withModules/tree/rogue_main/dolphin-RMselect) or [this folder (RM minimal)](https://github.com/RogueMaster/awesome-flipperzero-withModules/tree/rogue_main/dolphin-minimal) if you don't want to do the work but want more animations.
- [Archive: File Browser Ordering (By Dig03)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/389)
- Archive: Allow Folder Favorites [(By Willy-JL)]
- [Archive: Browser: Context menu to show file content (By askoriy)](https://github.com/DarkFlippers/unleashed-firmware/pull/139)
- Archive: FAPs are now launchable from Archive [By RogueMaster], thanks xMasterX for the suggestion
- Assets: Includes a NFC Level 50 Z3lda Amiibo
Expand Down Expand Up @@ -160,6 +163,7 @@ $ ./fbt dolphin_ext
- Tetris, Snake, or Flappy Bird Score For EXP
- Zombiez for every 20 Zombie kills
- Dolphin: SD dolphin manifest updated to weight animations differently
- GUI: Extended Keyboard [(By Willy-JL)]
- iButton: [Fixed issue when loading iButton keys or U2F token from Archive app #382 (By ESurge)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/382)
- iButton: iButton.fap loader apps and available as Favorites [Thanks to ESurge](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/336)
- Icon Decode/Encode [(Thanks to PixlEmly)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/55/files)
Expand All @@ -181,6 +185,7 @@ $ ./fbt dolphin_ext
- Settings: Custom name with this compile: CUSTOM_FLIPPER_NAME=name ./fbt updater_package [By Unleashed/xMasterX](https://github.com/DarkFlippers/unleashed-firmware)
- Settings: Desktop => [Games Only Mode (By RogueMaster)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/GAMES_ONLY.md)
- - [UP UP DOWN DOWN LEFT RIGHT LEFT RIGHT FROM CLOCK](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/GAMES_ONLY.md) (FULL LIST OF GAMES ONLY CONTROLS)
- Settings: External instead of internal for all except notifications [(By Willy-JL)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/applications/notification/notification_settings_app.c)
- Settings: LCD Timeout Options Added: 10s+90s+2min+5min+10min [(By RogueMaster)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/applications/notification/notification_settings_app.c)
- Settings: Rename from App [(Thanks to ESurge)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/409)
- Settings: Rename from SD `dolphin/name.txt` [(Thanks to ESurge)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/259)
Expand Down
2 changes: 1 addition & 1 deletion applications/main/archive/helpers/archive_browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static inline const char* archive_get_default_path(ArchiveTabEnum tab) {
}

inline bool archive_is_known_app(ArchiveFileTypeEnum type) {
return (type != ArchiveFileTypeFolder && type != ArchiveFileTypeUnknown);
return (type != ArchiveFileTypeUnknown);
}

bool archive_is_item_in_array(ArchiveBrowserViewModel* model, uint32_t idx);
Expand Down
2 changes: 1 addition & 1 deletion applications/main/archive/helpers/archive_favorites.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ bool archive_favorites_read(void* context) {
need_refresh = true;
}
} else {
if(storage_file_exists(storage, furi_string_get_cstr(buffer))) {
if(storage_common_exists(storage, furi_string_get_cstr(buffer))) {
storage_common_stat(storage, furi_string_get_cstr(buffer), &file_info);
archive_add_file_item(
browser, file_info_is_dir(&file_info), furi_string_get_cstr(buffer));
Expand Down
7 changes: 6 additions & 1 deletion applications/main/archive/scenes/archive_scene_browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ static const char* flipper_app_name[] = {
[ArchiveFileTypeU2f] = "U2F",
[ArchiveFileTypeApplication] = "Applications",
[ArchiveFileTypeUpdateManifest] = "UpdaterApp",
[ArchiveFileTypeFolder] = "Archive",
};

static void archive_loader_callback(const void* message, void* context) {
Expand Down Expand Up @@ -152,7 +153,11 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
consumed = true;
break;
case ArchiveBrowserEventFileMenuRun:
if(archive_is_known_app(selected->type)) {
if(selected->type == ArchiveFileTypeFolder) {
archive_switch_tab(browser, TAB_LEFT);
archive_show_file_menu(browser, false);
archive_enter_dir(browser, selected->path);
} else if(archive_is_known_app(selected->type)) {
archive_run_in_app(browser, selected);
archive_show_file_menu(browser, false);
}
Expand Down
29 changes: 28 additions & 1 deletion applications/main/archive/views/archive_browser_view.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,35 @@ static void render_item_menu(Canvas* canvas, ArchiveBrowserViewModel* model) {
furi_string_set(item_pin, "Unpin");
}

if(selected->type == ArchiveFileTypeFolder) {
if(model->tab_idx == ArchiveTabFavorites) {
//FURI_LOG_D(TAG, "ArchiveTabFavorites");

furi_string_set(item_rename, "Move");

archive_menu_add_item(
menu_array_push_raw(model->context_menu),
item_run,
ArchiveBrowserEventFileMenuRun);
archive_menu_add_item(
menu_array_push_raw(model->context_menu),
item_pin,
ArchiveBrowserEventFileMenuPin);
if(selected->type <= ArchiveFileTypeBadKb) {
archive_menu_add_item(
menu_array_push_raw(model->context_menu),
item_show,
ArchiveBrowserEventFileMenuShow);
}
archive_menu_add_item(
menu_array_push_raw(model->context_menu),
item_rename,
ArchiveBrowserEventFileMenuRename);
} else if(selected->type == ArchiveFileTypeFolder) {
//FURI_LOG_D(TAG, "Directory type");
archive_menu_add_item(
menu_array_push_raw(model->context_menu),
item_pin,
ArchiveBrowserEventFileMenuPin);
archive_menu_add_item(
menu_array_push_raw(model->context_menu),
item_rename,
Expand Down
76 changes: 49 additions & 27 deletions applications/services/gui/modules/text_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ typedef struct {
const char* header;
char* text_buffer;
size_t text_buffer_size;
size_t minimum_length;
bool clear_default_text;
FuriString* temp_str;

Expand Down Expand Up @@ -101,32 +102,30 @@ static const TextInputKey keyboard_keys_row_3[] = {
};

static const TextInputKey symbol_keyboard_keys_row_1[] = {
{'!', 1, 8},
{'"', 10, 8},
{'#', 19, 8},
{'$', 28, 8},
{'%', 37, 8},
{'&', 46, 8},
{'/', 55, 8},
{'(', 64, 8},
{')', 73, 8},
{'=', 82, 8},
{'!', 2, 8},
{'@', 12, 8},
{'#', 22, 8},
{'$', 32, 8},
{'%', 42, 8},
{'^', 52, 8},
{'&', 62, 8},
{'(', 71, 8},
{')', 81, 8},
{'0', 91, 8},
{'1', 100, 8},
{'2', 110, 8},
{'3', 120, 8},
};

static const TextInputKey symbol_keyboard_keys_row_2[] = {
{'{', 1, 20},
{'}', 10, 20},
{'[', 19, 20},
{']', 28, 20},
{'<', 37, 20},
{'>', 46, 20},
{'\\', 55, 20},
{'@', 64, 20},
{'?', 73, 20},
{'~', 2, 20},
{'+', 12, 20},
{'-', 22, 20},
{'=', 32, 20},
{'[', 42, 20},
{']', 52, 20},
{'{', 62, 20},
{'}', 72, 20},
{BACKSPACE_KEY, 82, 12},
{'4', 100, 20},
{'5', 110, 20},
Expand Down Expand Up @@ -290,7 +289,7 @@ static void text_input_view_draw_callback(Canvas* canvas, void* _model) {
canvas_draw_str(canvas, start_pos, 22, "...");
start_pos += 6;
needed_string_width -= 8;
for(uint off = 0;
for(uint32_t off = 0;
!furi_string_empty(str) && canvas_string_width(canvas, cstr) > needed_string_width &&
off < model->cursor_pos;
off++) {
Expand Down Expand Up @@ -376,11 +375,16 @@ static void text_input_handle_up(TextInput* text_input, TextInputModel* model) {
UNUSED(text_input);
if(model->selected_row > 0) {
model->selected_row--;
if(model->selected_column >
get_row_size(keyboards[model->selected_keyboard], model->selected_row) - 6 &&
model->selected_row == 0) {
if(model->selected_row == 0 &&
model->selected_column > get_row_size(keyboards[model->selected_keyboard], model->selected_row) - 6) {
model->selected_column = model->selected_column + 1;
}
if(model->selected_row == 1 && model->selected_keyboard == symbol_keyboard.keyboard_index) {
if(model->selected_column > 5)
model->selected_column += 2;
else if(model->selected_column > 1)
model->selected_column += 1;
}
} else {
model->cursor_select = true;
model->clear_default_text = false;
Expand All @@ -393,11 +397,16 @@ static void text_input_handle_down(TextInput* text_input, TextInputModel* model)
model->cursor_select = false;
} else if(model->selected_row < keyboard_row_count - 1) {
model->selected_row++;
if(model->selected_column >
get_row_size(keyboards[model->selected_keyboard], model->selected_row) - 4 &&
model->selected_row == 1) {
if(model->selected_row == 1 &&
model->selected_column > get_row_size(keyboards[model->selected_keyboard], model->selected_row) - 4) {
model->selected_column = model->selected_column - 1;
}
if(model->selected_row == 2 && model->selected_keyboard == symbol_keyboard.keyboard_index) {
if(model->selected_column > 7)
model->selected_column -= 2;
else if(model->selected_column > 1)
model->selected_column -= 1;
}
}
}

Expand Down Expand Up @@ -441,7 +450,7 @@ static void text_input_handle_ok(TextInput* text_input, TextInputModel* model, I
model->text_buffer, model->validator_text, model->validator_callback_context))) {
model->validator_message_visible = true;
furi_timer_start(text_input->timer, furi_kernel_get_tick_frequency() * 4);
} else if(model->callback != 0 && text_length > 0) {
} else if(model->callback != 0 && text_length >= model->minimum_length) {
model->callback(model->callback_context);
}
} else if(selected == SWITCH_KEYBOARD_KEY) {
Expand Down Expand Up @@ -631,6 +640,7 @@ void text_input_reset(TextInput* text_input) {
model->selected_row = 0;
model->selected_column = 0;
model->selected_keyboard = 0;
model->minimum_length = 1;
model->clear_default_text = false;
model->cursor_pos = 0;
model->cursor_select = false;
Expand Down Expand Up @@ -681,6 +691,18 @@ void text_input_set_result_callback(
true);
}

void text_input_set_minimum_length(
TextInput* text_input,
size_t minimum_length) {
with_view_model(
text_input->view,
TextInputModel * model,
{
model->minimum_length = minimum_length;
},
true);
}

void text_input_set_validator(
TextInput* text_input,
TextInputValidatorCallback callback,
Expand Down
4 changes: 4 additions & 0 deletions applications/services/gui/modules/text_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ void text_input_set_validator(
TextInputValidatorCallback callback,
void* callback_context);

void text_input_set_minimum_length(
TextInput* text_input,
size_t minimum_length);

TextInputValidatorCallback text_input_get_validator_callback(TextInput* text_input);

void* text_input_get_validator_callback_context(TextInput* text_input);
Expand Down
1 change: 1 addition & 0 deletions firmware/targets/f7/api_symbols.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3431,6 +3431,7 @@ Function,+,text_input_get_validator_callback_context,void*,TextInput*
Function,+,text_input_get_view,View*,TextInput*
Function,+,text_input_reset,void,TextInput*
Function,+,text_input_set_header_text,void,"TextInput*, const char*"
Function,+,text_input_set_minimum_length,void,"TextInput*, size_t"
Function,+,text_input_set_result_callback,void,"TextInput*, TextInputCallback, void*, char*, size_t, _Bool"
Function,+,text_input_set_validator,void,"TextInput*, TextInputValidatorCallback, void*"
Function,-,tga_save,void,const char*
Expand Down

0 comments on commit 20bc898

Please sign in to comment.