mirror of
https://git.wetfence.xyz/RandyTheSilly/jellyPod.git
synced 2026-10-26 15:29:57 -04:00
Track row index history
This commit is contained in:
1 parent
93ec947e7d
commit
e2136a65e1
1 file changed
+7
-3
+7
-3
@@ -16,7 +16,7 @@ typedef struct {
|
||||
bool using_search;
|
||||
char subscope_search[255]; // TODO tighten and only store first character
|
||||
char subscope_artist[255];
|
||||
// const char *subscope_album; // future use
|
||||
uint16_t scroll_row[NAV_SCOPE_ALBUM_TRACKS + 1]; // last selected row per scope
|
||||
} History;
|
||||
|
||||
// constants
|
||||
@@ -117,8 +117,11 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||
append_to_subscope_history();
|
||||
}
|
||||
|
||||
// when moving deeper start at the top, otherwise restore the row the user left off on
|
||||
uint16_t scroll_row = moving_deeper ? 0 : s_nav_history.scroll_row[s_current_menu_scope];
|
||||
s_nav_history.scroll_row[s_current_menu_scope] = scroll_row;
|
||||
menu_layer_reload_data(s_menu_layer);
|
||||
menu_layer_set_selected_index(s_menu_layer, MenuIndex(0, 0), MenuRowAlignTop, false);
|
||||
menu_layer_set_selected_index(s_menu_layer, MenuIndex(0, scroll_row), MenuRowAlignTop, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -164,7 +167,7 @@ static void to_pkjs_move_back() {
|
||||
// return to main menu
|
||||
s_current_menu_scope = NAV_SCOPE_MAIN;
|
||||
menu_layer_reload_data(s_menu_layer);
|
||||
menu_layer_set_selected_index(s_menu_layer, MenuIndex(0, 0), MenuRowAlignTop, false);
|
||||
menu_layer_set_selected_index(s_menu_layer, MenuIndex(0, s_nav_history.scroll_row[NAV_SCOPE_MAIN]), MenuRowAlignTop, false);
|
||||
} else {
|
||||
// otherwise determine last subscope and go to previous scope
|
||||
switch (s_current_menu_scope) {
|
||||
@@ -212,6 +215,7 @@ static void menu_draw_row(GContext *ctx, const Layer *cell_layer, MenuIndex *cel
|
||||
}
|
||||
|
||||
static void menu_select_click(struct MenuLayer *menu_layer, MenuIndex *clicked_index, void *context) {
|
||||
s_nav_history.scroll_row[s_current_menu_scope] = clicked_index->row;
|
||||
switch (s_current_menu_scope) {
|
||||
case NAV_SCOPE_MAIN:
|
||||
switch (clicked_index->row) {
|
||||
|
||||
Reference in new issue
Block a user