Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes an issue I had when using CustomTabs for external links, likely the same as #961. When closing the browser after opening a link, I was being sent back to the app launcher, when I expected to go back to the screen in Read You where I clicked the link. After some research, I found that according to https://developer.android.com/guide/topics/manifest/activity-element#lmode, the
singleInstance
launch mode does not allow launching other activities into MainActivity's Task. The CustomTabs activity would launch under a new foreground task, causing Android to destroy the original MainActivity task to free resources, which led to the observed behavior.Changing MainActivity's launch mode to
singleTop
allows the CustomTabs to launch in the same task, keeping MainActivity alive and enabling the back button to function as expected.Since this change affects how intents are handled, this PR also includes an override for onNewIntent to properly handle incoming feed links, as required by the
singleTop
mode according to the documentation. This works better than the listener used before, where adding a feed when the app was not already open did not open the subscribe dialog, but now it does. Notifications apparently work the same as before becauseFLAG_ACTIVITY_NEW_TASK || FLAG_ACTIVITY_CLEAR_TASK
is used in NotificationHelper's intents.