You may want to create link to another post from the single.html. In that case, you’ll need to modify the history and screen transitions behavior.
The code below detects a post to post navigation and modifies the history accordingly. It is already there by default in Q theme for Android. What you’ll need to add is a “last history action” memory to it (see highlighted lines), so that the correct screen transition can be triggered:
//Memorize last history action to be able to run the corresponding transition: var last_history_action = ''; // @desc Catch if we're going to a single and coming from a single (it is the case when clicking on a post in the last posts widget at the bottom of a post) // Update properly the history stack App.filter( 'make-history', function( history_action, history_stack, queried_screen, current_screen, previous_screen ) { if( queried_screen.screen_type === 'single' && current_screen.screen_type === 'single' ) { if ( ( queried_screen.item_id !== previous_screen.item_id ) ) { // Going to a single to another single that is not the one we came from history_action = 'push'; } else { // Going back to the previous single history_action = 'pop'; } } //Memorize last history action: last_history_action = history_action; // Return the proper history action return history_action; });
Then, thanks to this last_history_action memory, we can trigger the correct “previous” or “next” screen transitions when going from a single to another single:
// Handle screen transitions when going from a single and coming to a single: App.filter( 'transition-direction', function( transition, current_screen, next_screen ){ if( current_screen.screen_type === 'single' && next_screen.screen_type === 'single' ) { if ( last_history_action === 'push' ) { transition = 'next-screen'; } else { transition = 'previous-screen'; } } return transition; });
Your “single to single” links should now behave nicely 🙂