From 49b877470d07e74b3168117975f2540f47531010 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Sat, 15 Apr 2023 20:19:25 +0200 Subject: PictureFlow: Add ability to go to last album After launch, PictureFlow always goes to the currently playing album, or to a selected album, if applicable. Which is probably a useful default, but not always wanted. You can now get back to the album you were looking at when PictureFlow was last closed, or when the sorting was last changed. Change-Id: Iba3e0d5388f6b49534d09fe0224b0dbfa65d5f1d --- apps/plugins/pictureflow/pictureflow.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'apps/plugins/pictureflow/pictureflow.c') diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index 87db58aa34..9896ca45bf 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c @@ -3241,7 +3241,10 @@ static bool sort_albums(int new_sorting, bool from_settings) if(!rb->strcmp(pf_idx.album_names + album_idx, current_album_name) && !rb->strcmp(pf_idx.artist_names + artist_idx, current_album_artist)) + { set_current_slide(i); + pf_cfg.last_album = i; + } } return true; } @@ -3651,6 +3654,7 @@ static int settings_menu(void) */ enum { PF_SHOW_TRACKS_WHILE_BROWSING, + PF_GOTO_LAST_ALBUM, PF_GOTO_WPS, #if PF_PLAYBACK_CAPABLE PF_MENU_CLEAR_PLAYLIST, @@ -3664,7 +3668,7 @@ enum { static int main_menu(void) { int selection = 0; - int result; + int result, curr_album; #if LCD_DEPTH > 1 rb->lcd_set_foreground(N_BRIGHT(255)); @@ -3672,6 +3676,7 @@ static int main_menu(void) MENUITEM_STRINGLIST(main_menu, "PictureFlow Main Menu", NULL, ID2P(LANG_SHOW_TRACKS_WHILE_BROWSING), + ID2P(LANG_GOTO_LAST_ALBUM), ID2P(LANG_GOTO_WPS), #if PF_PLAYBACK_CAPABLE ID2P(LANG_CLEAR_PLAYLIST), @@ -3692,6 +3697,24 @@ static int main_menu(void) } show_tracks_while_browsing = true; return 0; + case PF_GOTO_LAST_ALBUM: + if (pf_state == pf_scrolling) + curr_album = target; + else + curr_album = center_index; + + if (pf_state == pf_show_tracks) + free_borrowed_tracks(); + if (pf_state == pf_show_tracks || + pf_state == pf_cover_in || + pf_state == pf_cover_out) + skip_animation_to_idle_state(); + + set_current_slide(pf_cfg.last_album); + pf_cfg.last_album = curr_album; + + pf_state = pf_idle; + return 0; case PF_GOTO_WPS: /* WPS */ return -2; #if PF_PLAYBACK_CAPABLE @@ -4848,7 +4871,10 @@ enum plugin_status plugin_start(const void *parameter) ret = file_id3 ? pictureflow_main(file) : pictureflow_main(NULL); if ( ret == PLUGIN_OK || ret == PLUGIN_GOTO_WPS) { - pf_cfg.last_album = center_index; + if (pf_state == pf_scrolling) + pf_cfg.last_album = target; + else + pf_cfg.last_album = center_index; if (configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, CONFIG_VERSION)) { -- cgit v1.2.3