Thanks for the bug report. These are two different bugs. One is trivial to fix (the behaviour of the back button within KOReader). The other one I don't know but looks fishy.
Let me explain.
Typical android apps are made by different activities. Think about a mail client: it can have an activity to search received mails, an activity to display your inbox and an activity to compose a new mail. It also can call activities outside the program (ie: to see a link on your browser).
Android manages these activities in a stack and the behaviour of the back button is to go to the previous element on the stack. So if you click a button to compose an email and press the back button you are going to end on the activity where you pressed the button. The same for links. If you click on a link that sends you to another application and press back you'll end on the previous app, where you clicked the link.
Now how KOReader works. KOReader is one big program with a single activity. That would mean that a back button will put you on the activity that started KOReader (the launcher or a file manager, for example). We inhibit the stardard behaviour by intercepting back button events and processing them within the program, so it will never move you to the previous activity on the stack, because that activity is not KOReader.
I'm aware that the back button logic doesn't work as intended in Android. It worked at some point of time but not anymore. That's the part that's easy to fix.
But, what happens when you open an external dict in KOReader?. Then, for the first time, KOReader has two activities on the stack (KOReader and the dict activity). In that context KOReader has no focus and can't process any input events. So if you click on the back button the expected behaviour would be the same: it moves you to the previous activity on the stack. That's KOReader. it seems that, when you press the back button on Goldendict, it moves you to two times back on the stack. I cannot explain this with my knowledge but sound like a nasty bug I'm not sure we can fix.
You probably can reproduce the issue by open other kind of activities from KOReader and returning back to it. When you press on a external link and it opens on your browser the back behaviour on your browser should match what you see on dictionaries: on sane devices it returns back to the previous activity. On your onyx it will return two times.
|