Skip to content

Commit 20bc898

Browse files
committed
Archive and Keyboard Updates
1 parent 70f1523 commit 20bc898

File tree

8 files changed

+95
-31
lines changed

8 files changed

+95
-31
lines changed

ReadMe.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ This software is for experimental purposes only and is not meant for any illegal
3535
- Last Synced/Checked OFW, changes in [commits](https://github.com/flipperdevices/flipperzero-firmware/commits/dev): `2023-04-24 06:32 EST`
3636
- Reapply Flipper Scope fixes, Deep Sleep, BLE stack / cubewb updates from OFW successfully without boot loop
3737
- Known Issue: Flipper Scope does not load
38+
- Archive: Allow Folder Favorites [(By Willy-JL)]
39+
- GUI: Extended Keyboard [(By Willy-JL)]
3840

3941
<a name="release">
4042

@@ -103,6 +105,7 @@ $ ./fbt dolphin_ext
103105
- Animations: SubGHZ Scanning image with Pikachu [Thanks to Panzer00Z](https://github.com/Panzer00Z/flipperzero-firmware/blob/3a548ea9bb181c9348d8afb427890c411456134e/assets/icons/SubGhz/Scanning_123x52.png)
104106
- 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.
105107
- [Archive: File Browser Ordering (By Dig03)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/389)
108+
- Archive: Allow Folder Favorites [(By Willy-JL)]
106109
- [Archive: Browser: Context menu to show file content (By askoriy)](https://github.com/DarkFlippers/unleashed-firmware/pull/139)
107110
- Archive: FAPs are now launchable from Archive [By RogueMaster], thanks xMasterX for the suggestion
108111
- Assets: Includes a NFC Level 50 Z3lda Amiibo
@@ -160,6 +163,7 @@ $ ./fbt dolphin_ext
160163
- Tetris, Snake, or Flappy Bird Score For EXP
161164
- Zombiez for every 20 Zombie kills
162165
- Dolphin: SD dolphin manifest updated to weight animations differently
166+
- GUI: Extended Keyboard [(By Willy-JL)]
163167
- 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)
164168
- iButton: iButton.fap loader apps and available as Favorites [Thanks to ESurge](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/336)
165169
- Icon Decode/Encode [(Thanks to PixlEmly)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/55/files)
@@ -181,6 +185,7 @@ $ ./fbt dolphin_ext
181185
- Settings: Custom name with this compile: CUSTOM_FLIPPER_NAME=name ./fbt updater_package [By Unleashed/xMasterX](https://github.com/DarkFlippers/unleashed-firmware)
182186
- Settings: Desktop => [Games Only Mode (By RogueMaster)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/blob/420/GAMES_ONLY.md)
183187
- - [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)
188+
- 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)
184189
- 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)
185190
- Settings: Rename from App [(Thanks to ESurge)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/409)
186191
- Settings: Rename from SD `dolphin/name.txt` [(Thanks to ESurge)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/259)

applications/main/archive/helpers/archive_browser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static inline const char* archive_get_default_path(ArchiveTabEnum tab) {
6262
}
6363

6464
inline bool archive_is_known_app(ArchiveFileTypeEnum type) {
65-
return (type != ArchiveFileTypeFolder && type != ArchiveFileTypeUnknown);
65+
return (type != ArchiveFileTypeUnknown);
6666
}
6767

6868
bool archive_is_item_in_array(ArchiveBrowserViewModel* model, uint32_t idx);

applications/main/archive/helpers/archive_favorites.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ bool archive_favorites_read(void* context) {
164164
need_refresh = true;
165165
}
166166
} else {
167-
if(storage_file_exists(storage, furi_string_get_cstr(buffer))) {
167+
if(storage_common_exists(storage, furi_string_get_cstr(buffer))) {
168168
storage_common_stat(storage, furi_string_get_cstr(buffer), &file_info);
169169
archive_add_file_item(
170170
browser, file_info_is_dir(&file_info), furi_string_get_cstr(buffer));

applications/main/archive/scenes/archive_scene_browser.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ static const char* flipper_app_name[] = {
2121
[ArchiveFileTypeU2f] = "U2F",
2222
[ArchiveFileTypeApplication] = "Applications",
2323
[ArchiveFileTypeUpdateManifest] = "UpdaterApp",
24+
[ArchiveFileTypeFolder] = "Archive",
2425
};
2526

2627
static void archive_loader_callback(const void* message, void* context) {
@@ -152,7 +153,11 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
152153
consumed = true;
153154
break;
154155
case ArchiveBrowserEventFileMenuRun:
155-
if(archive_is_known_app(selected->type)) {
156+
if(selected->type == ArchiveFileTypeFolder) {
157+
archive_switch_tab(browser, TAB_LEFT);
158+
archive_show_file_menu(browser, false);
159+
archive_enter_dir(browser, selected->path);
160+
} else if(archive_is_known_app(selected->type)) {
156161
archive_run_in_app(browser, selected);
157162
archive_show_file_menu(browser, false);
158163
}

applications/main/archive/views/archive_browser_view.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,35 @@ static void render_item_menu(Canvas* canvas, ArchiveBrowserViewModel* model) {
6666
furi_string_set(item_pin, "Unpin");
6767
}
6868

69-
if(selected->type == ArchiveFileTypeFolder) {
69+
if(model->tab_idx == ArchiveTabFavorites) {
70+
//FURI_LOG_D(TAG, "ArchiveTabFavorites");
71+
72+
furi_string_set(item_rename, "Move");
73+
74+
archive_menu_add_item(
75+
menu_array_push_raw(model->context_menu),
76+
item_run,
77+
ArchiveBrowserEventFileMenuRun);
78+
archive_menu_add_item(
79+
menu_array_push_raw(model->context_menu),
80+
item_pin,
81+
ArchiveBrowserEventFileMenuPin);
82+
if(selected->type <= ArchiveFileTypeBadKb) {
83+
archive_menu_add_item(
84+
menu_array_push_raw(model->context_menu),
85+
item_show,
86+
ArchiveBrowserEventFileMenuShow);
87+
}
88+
archive_menu_add_item(
89+
menu_array_push_raw(model->context_menu),
90+
item_rename,
91+
ArchiveBrowserEventFileMenuRename);
92+
} else if(selected->type == ArchiveFileTypeFolder) {
7093
//FURI_LOG_D(TAG, "Directory type");
94+
archive_menu_add_item(
95+
menu_array_push_raw(model->context_menu),
96+
item_pin,
97+
ArchiveBrowserEventFileMenuPin);
7198
archive_menu_add_item(
7299
menu_array_push_raw(model->context_menu),
73100
item_rename,

applications/services/gui/modules/text_input.c

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ typedef struct {
2323
const char* header;
2424
char* text_buffer;
2525
size_t text_buffer_size;
26+
size_t minimum_length;
2627
bool clear_default_text;
2728
FuriString* temp_str;
2829

@@ -101,32 +102,30 @@ static const TextInputKey keyboard_keys_row_3[] = {
101102
};
102103

103104
static const TextInputKey symbol_keyboard_keys_row_1[] = {
104-
{'!', 1, 8},
105-
{'"', 10, 8},
106-
{'#', 19, 8},
107-
{'$', 28, 8},
108-
{'%', 37, 8},
109-
{'&', 46, 8},
110-
{'/', 55, 8},
111-
{'(', 64, 8},
112-
{')', 73, 8},
113-
{'=', 82, 8},
105+
{'!', 2, 8},
106+
{'@', 12, 8},
107+
{'#', 22, 8},
108+
{'$', 32, 8},
109+
{'%', 42, 8},
110+
{'^', 52, 8},
111+
{'&', 62, 8},
112+
{'(', 71, 8},
113+
{')', 81, 8},
114114
{'0', 91, 8},
115115
{'1', 100, 8},
116116
{'2', 110, 8},
117117
{'3', 120, 8},
118118
};
119119

120120
static const TextInputKey symbol_keyboard_keys_row_2[] = {
121-
{'{', 1, 20},
122-
{'}', 10, 20},
123-
{'[', 19, 20},
124-
{']', 28, 20},
125-
{'<', 37, 20},
126-
{'>', 46, 20},
127-
{'\\', 55, 20},
128-
{'@', 64, 20},
129-
{'?', 73, 20},
121+
{'~', 2, 20},
122+
{'+', 12, 20},
123+
{'-', 22, 20},
124+
{'=', 32, 20},
125+
{'[', 42, 20},
126+
{']', 52, 20},
127+
{'{', 62, 20},
128+
{'}', 72, 20},
130129
{BACKSPACE_KEY, 82, 12},
131130
{'4', 100, 20},
132131
{'5', 110, 20},
@@ -290,7 +289,7 @@ static void text_input_view_draw_callback(Canvas* canvas, void* _model) {
290289
canvas_draw_str(canvas, start_pos, 22, "...");
291290
start_pos += 6;
292291
needed_string_width -= 8;
293-
for(uint off = 0;
292+
for(uint32_t off = 0;
294293
!furi_string_empty(str) && canvas_string_width(canvas, cstr) > needed_string_width &&
295294
off < model->cursor_pos;
296295
off++) {
@@ -376,11 +375,16 @@ static void text_input_handle_up(TextInput* text_input, TextInputModel* model) {
376375
UNUSED(text_input);
377376
if(model->selected_row > 0) {
378377
model->selected_row--;
379-
if(model->selected_column >
380-
get_row_size(keyboards[model->selected_keyboard], model->selected_row) - 6 &&
381-
model->selected_row == 0) {
378+
if(model->selected_row == 0 &&
379+
model->selected_column > get_row_size(keyboards[model->selected_keyboard], model->selected_row) - 6) {
382380
model->selected_column = model->selected_column + 1;
383381
}
382+
if(model->selected_row == 1 && model->selected_keyboard == symbol_keyboard.keyboard_index) {
383+
if(model->selected_column > 5)
384+
model->selected_column += 2;
385+
else if(model->selected_column > 1)
386+
model->selected_column += 1;
387+
}
384388
} else {
385389
model->cursor_select = true;
386390
model->clear_default_text = false;
@@ -393,11 +397,16 @@ static void text_input_handle_down(TextInput* text_input, TextInputModel* model)
393397
model->cursor_select = false;
394398
} else if(model->selected_row < keyboard_row_count - 1) {
395399
model->selected_row++;
396-
if(model->selected_column >
397-
get_row_size(keyboards[model->selected_keyboard], model->selected_row) - 4 &&
398-
model->selected_row == 1) {
400+
if(model->selected_row == 1 &&
401+
model->selected_column > get_row_size(keyboards[model->selected_keyboard], model->selected_row) - 4) {
399402
model->selected_column = model->selected_column - 1;
400403
}
404+
if(model->selected_row == 2 && model->selected_keyboard == symbol_keyboard.keyboard_index) {
405+
if(model->selected_column > 7)
406+
model->selected_column -= 2;
407+
else if(model->selected_column > 1)
408+
model->selected_column -= 1;
409+
}
401410
}
402411
}
403412

@@ -441,7 +450,7 @@ static void text_input_handle_ok(TextInput* text_input, TextInputModel* model, I
441450
model->text_buffer, model->validator_text, model->validator_callback_context))) {
442451
model->validator_message_visible = true;
443452
furi_timer_start(text_input->timer, furi_kernel_get_tick_frequency() * 4);
444-
} else if(model->callback != 0 && text_length > 0) {
453+
} else if(model->callback != 0 && text_length >= model->minimum_length) {
445454
model->callback(model->callback_context);
446455
}
447456
} else if(selected == SWITCH_KEYBOARD_KEY) {
@@ -631,6 +640,7 @@ void text_input_reset(TextInput* text_input) {
631640
model->selected_row = 0;
632641
model->selected_column = 0;
633642
model->selected_keyboard = 0;
643+
model->minimum_length = 1;
634644
model->clear_default_text = false;
635645
model->cursor_pos = 0;
636646
model->cursor_select = false;
@@ -681,6 +691,18 @@ void text_input_set_result_callback(
681691
true);
682692
}
683693

694+
void text_input_set_minimum_length(
695+
TextInput* text_input,
696+
size_t minimum_length) {
697+
with_view_model(
698+
text_input->view,
699+
TextInputModel * model,
700+
{
701+
model->minimum_length = minimum_length;
702+
},
703+
true);
704+
}
705+
684706
void text_input_set_validator(
685707
TextInput* text_input,
686708
TextInputValidatorCallback callback,

applications/services/gui/modules/text_input.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ void text_input_set_validator(
7070
TextInputValidatorCallback callback,
7171
void* callback_context);
7272

73+
void text_input_set_minimum_length(
74+
TextInput* text_input,
75+
size_t minimum_length);
76+
7377
TextInputValidatorCallback text_input_get_validator_callback(TextInput* text_input);
7478

7579
void* text_input_get_validator_callback_context(TextInput* text_input);

firmware/targets/f7/api_symbols.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3431,6 +3431,7 @@ Function,+,text_input_get_validator_callback_context,void*,TextInput*
34313431
Function,+,text_input_get_view,View*,TextInput*
34323432
Function,+,text_input_reset,void,TextInput*
34333433
Function,+,text_input_set_header_text,void,"TextInput*, const char*"
3434+
Function,+,text_input_set_minimum_length,void,"TextInput*, size_t"
34343435
Function,+,text_input_set_result_callback,void,"TextInput*, TextInputCallback, void*, char*, size_t, _Bool"
34353436
Function,+,text_input_set_validator,void,"TextInput*, TextInputValidatorCallback, void*"
34363437
Function,-,tga_save,void,const char*

0 commit comments

Comments
 (0)