gh4a
gh4a copied to clipboard
Opening a notification closes all other activities of the app
As the issue title says, tapping on an OctoDroid notification opens the Notifications screen but also closes all the other open activities of the app. I find this behavior very annoying, especially when you're writing a comment or a new issue since everything you've written will be lost. The problem lies here: https://github.com/slapperwan/gh4a/blob/6e0a8ed0fa75f204c23e2175fd785f2a0291f9b7/app/src/main/java/com/gh4a/worker/NotificationHandlingService.java#L97-L99
Since the HomeActivity is always the root activity of the stack, FLAG_ACTIVITY_CLEAR_TOP will cause all other activities to be destroyed and removed from the back stack.
I see two possible solutions here:
- open the Notifications screen in a new task (using
FLAG_ACTIVITY_MULTIPLE_TASKinstead ofFLAG_ACTIVITY_CLEAR_TOP) - open the Notifications list in a dedicated activity that gets opened normally (on top of the existing back stack), so that the user can quickly go back to what they were doing before they opened the notification
Both seem rather ugly. I do not want to allow multiple instances for the home (launcher) activity, because that way navigation becomes confusing (which instance is opened when opening the launcher again?). Having notifications in a separate activity also doesn't fit the home activity navigation model at all. Unfortunately, I can't think of a good solution for that issue either. One basically would have to detach the activity stack of the old home activity (excluding home itself) into a new task, but I don't think that's possible.