From dfd9c10589d25a966c7e2e4dedab57c59a1987fd Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Sun, 27 Nov 2022 01:15:14 +0100 Subject: Eliminate skin updates in between activities 1) Adds way to pop activity without refreshing the skin at the same time. Activities are sometimes popped in immediate succession, or one activity is popped before another one is pushed right away. This can lead to the UI appearing glitchy, due to an activity only appearing for a split-second, which is especially noticeable with complex skins that change the dimensions of the UI viewport depending on the current activity To fix this, prevent superfluous skin updates * when switching between: - WPS and browser - WPS and Playlist Catalogue - WPS and playlist - WPS and Settings/System/Plugins * when accessing Track Info or when displaying bookmarks using the context menu on the WPS * when switching from QuickScreen to Shortcuts Menu 2) The playlist viewer activity was pushed & popped redundantly by playlist_view. ---- NB: Behavior has remained unchanged in all instances of the code where pop_current_activity() has been replaced by pop_current_activity(ACTIVITY_REFRESH_NOW). Change-Id: I56b517b8c9dba823a9fed3a3f558d7469dcea9fd --- apps/onplay.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'apps/onplay.c') diff --git a/apps/onplay.c b/apps/onplay.c index f2dbf8b3bf..7ea6b9035b 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -144,6 +144,15 @@ static bool clipboard_clip(struct clipboard *clip, const char *path, /* interface function. */ /* ----------------------------------------------------------------------- */ + +static int bookmark_load_menu_wrapper(void) +{ + if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ + pop_current_activity(ACTIVITY_REFRESH_DEFERRED); /* when called from ctxt menu */ + + return bookmark_load_menu(); +} + static int bookmark_menu_callback(int action, const struct menu_item_ex *this_item, struct gui_synclist *this_list); @@ -153,7 +162,7 @@ MENUITEM_FUNCTION(bookmark_create_menu_item, 0, bookmark_menu_callback, Icon_Bookmark); MENUITEM_FUNCTION(bookmark_load_menu_item, 0, ID2P(LANG_BOOKMARK_MENU_LIST), - bookmark_load_menu, NULL, + bookmark_load_menu_wrapper, NULL, bookmark_menu_callback, Icon_Bookmark); MAKE_ONPLAYMENU(bookmark_menu, ID2P(LANG_BOOKMARK_MENU), bookmark_menu_callback, Icon_Bookmark, @@ -462,7 +471,18 @@ static bool save_playlist(void) return false; } -extern struct menu_item_ex view_cur_playlist; /* from playlist_menu.c */ +static int wps_view_cur_playlist(void) +{ + if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ + pop_current_activity(ACTIVITY_REFRESH_DEFERRED); /* when called from ctxt menu */ + + playlist_viewer_ex(NULL, NULL); + + return 0; +} + +MENUITEM_FUNCTION(wps_view_cur_playlist_item, 0, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), + wps_view_cur_playlist, NULL, NULL, Icon_NOICON); MENUITEM_FUNCTION(search_playlist_item, 0, ID2P(LANG_SEARCH_IN_PLAYLIST), search_playlist, NULL, NULL, Icon_Playlist); MENUITEM_FUNCTION(playlist_save_item, 0, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), @@ -473,7 +493,7 @@ MENUITEM_FUNCTION(playing_time_item, 0, ID2P(LANG_PLAYING_TIME), playing_time, NULL, NULL, Icon_Playlist); MAKE_ONPLAYMENU( wps_playlist_menu, ID2P(LANG_PLAYLIST), NULL, Icon_Playlist, - &view_cur_playlist, &search_playlist_item, + &wps_view_cur_playlist_item, &search_playlist_item, &playlist_save_item, &reshuffle_item, &playing_time_item ); @@ -1499,6 +1519,9 @@ MENUITEM_FUNCTION(view_cue_item, 0, ID2P(LANG_BROWSE_CUESHEET), static int browse_id3_wrapper(void) { + if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* get rid of parent activity */ + pop_current_activity(ACTIVITY_REFRESH_DEFERRED); /* when called from ctxt menu */ + if (browse_id3(audio_current_track(), playlist_get_display_index(), playlist_amount())) @@ -1954,7 +1977,9 @@ int onplay(char* file, int attr, int from, bool hotkey) else menu = &tree_onplay_menu; menu_selection = do_menu(menu, NULL, NULL, false); - pop_current_activity(); + + if (get_current_activity() == ACTIVITY_CONTEXTMENU) /* Activity may have been */ + pop_current_activity(ACTIVITY_REFRESH_NOW); /* popped already by menu item */ switch (menu_selection) { -- cgit v1.2.3