kiwix / kiwix-android

Kiwix for Android
https://android.kiwix.org
GNU General Public License v3.0
890 stars 447 forks source link

Unusual behaviour on pressing back button #1881

Closed sonusourav closed 4 years ago

sonusourav commented 4 years ago

Describe the bug

In some Zim files, on pressing back button lands on the home screen while in some others it exits the app. I can't guess the pattern in which case first happens and in which case second happens.

Expected behavior

In all cases, it should be the same. Either the app should exit or home screen should appear.

P.S.: It would be better if home screen appears.

Steps to reproduce the behavior: Case is random so not necessary it would work on following the steps.

  1. Open zim files and press back button and observe.

Screenshots

Link

Environment

macgills commented 4 years ago

It should exit the app to keep the behaviour we have had unless @kelson42 wants to chime in and say it should return to the home screen to select a zim.

What is probably happening is 2 instances of MainActivity are created somehow, this should be easy to detect.

Frans-Lukas commented 4 years ago

@macgills What is the intended way of navigating back to the zim browser from an opened zim file? The only consistent way I have used is to close all tabs.

macgills commented 4 years ago

Open a new tab from the + in tabswitcher, this presents the list for you to choose a new book or the same book. Choosing a new book will close all the tabs that were open of another book

Frans-Lukas commented 4 years ago

@macgills Okay! I did not know about the + button, thanks.

kelson42 commented 4 years ago

@macgills @Frans-Lukas In any case, the behaviour should be consistent. IMO should come back to home screen and then exit if back called an other time.

Frans-Lukas commented 4 years ago

@kelson42 I agree when comparing with how a browser handles back navigation as well as Googles recommendation:

"Every app you build has a fixed start destination. This is the first screen the user sees when they launch your app from the launcher. ... This is also the last screen they see before exiting the app. [using back navigation]" https://developer.android.com/guide/navigation/navigation-principles

sonusourav commented 4 years ago

@kelson42 So, should I proceed with bringing the user to home screen instead of directly escaping?

macgills commented 4 years ago

Lets go home screen (aka list of books under the kiwix banner) then, I never really knew why it worked how it did anyway.