Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > KOReader

Notices

Reply
 
Thread Tools Search this Thread
Old 06-12-2020, 10:23 AM   #1
Pajamaman
Wizard
Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.
 
Pajamaman's Avatar
 
Posts: 1,788
Karma: 6447888
Join Date: May 2016
Location: Quebec, QC
Device: Nook, Onyx
Back button problems in Android

I am running 2019.11 on both an Nook GL3 and a Onyx Nova Pro. I have Goldendict configured with both.

1) Back button from Goldendict

On the Onyx, when I look up a word from Koreader and go to Goldendict, when I do a Back button (the only way to get back), I go back to Koreader, but also exit and get dumped out of Koreader. This happens no matter how I set the Back button in the Navigation menu. This means I cannot use a dictionary in Koreader on the Onyx.

On the Nook, this does not happen. I use Back to exit from Goldendict and it exits goldendict but stays in Koreader.

2) When I do a Back button in the file manager in Koreader in both the Onyx and the Nook, I get dumped out of Koreader. Again, no matter the navigation setting.

So I guess the Back function is just generally flaky in Android.

Last edited by Pajamaman; 06-12-2020 at 11:23 AM.
Pajamaman is offline   Reply With Quote
Old 06-12-2020, 11:22 AM   #2
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 10,493
Karma: 18151936
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW & PW2; Kobo H2O & Forma
Obvious answer is obvious: try with a version that's not 7 months old.
NiLuJe is offline   Reply With Quote
Advert
Old 06-12-2020, 11:44 AM   #3
pazos
cosiñeiro
pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.
 
Posts: 506
Karma: 440552
Join Date: Apr 2014
Device: BQ Cervantes 4
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.
pazos is offline   Reply With Quote
Old 06-12-2020, 12:25 PM   #4
Pajamaman
Wizard
Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.
 
Pajamaman's Avatar
 
Posts: 1,788
Karma: 6447888
Join Date: May 2016
Location: Quebec, QC
Device: Nook, Onyx
I'll try to test it.

So it probably won't make any difference installing the latest stable versions? If I do update, can I just install the apk, or do I have to clear out the old version?

Thanks for both your replies. I'll look into it.
Pajamaman is offline   Reply With Quote
Old 06-12-2020, 12:49 PM   #5
pazos
cosiñeiro
pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.
 
Posts: 506
Karma: 440552
Join Date: Apr 2014
Device: BQ Cervantes 4
Ok, I did a quick test with the android backend to figure out if we're intercepting the back button events. It seems to work fine (see attachment)

Code:
diff --git a/examples/helloWorld/main_loop.lua b/examples/helloWorld/main_loop.lua
index b887551..07830c4 100644
--- a/examples/helloWorld/main_loop.lua
+++ b/examples/helloWorld/main_loop.lua
@@ -38,9 +38,9 @@ local function processEvent(event)
         local action = android.lib.AKeyEvent_getAction(event)
         if code == C.AKEYCODE_BACK then
             -- finish the program with the back key.
-            android.notification("bye!")
-            utils.sleep(1)
-            finish()
+            android.notification("hey you pressed back key. Nothing happens!")
+            --utils.sleep(1)
+            --finish()
         elseif action == C.AKEY_EVENT_ACTION_DOWN then
             -- show a "pressed" notification with key code
             android.notification("Pressed key "..code)
So probably the issue is how we're handling it within the frontend and not the platform code per se.


Quote:
Originally Posted by Pajamaman View Post
I'll try to test it.

So it probably won't make any difference installing the latest stable versions? If I do update, can I just install the apk, or do I have to clear out the old version?

Thanks for both your replies. I'll look into it.
You can update without deleting the old version. For downgrading the program you need to delete the apk first. In any case you won't loose your settings as they're stored in /sdcard/koreader or similar (do not remove this folder)
Attached Thumbnails
Click image for larger version

Name:	2020-06-12_18-45.png
Views:	17
Size:	13.5 KB
ID:	179876  
pazos is offline   Reply With Quote
Advert
Old 06-12-2020, 01:08 PM   #6
pazos
cosiñeiro
pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.
 
Posts: 506
Karma: 440552
Join Date: Apr 2014
Device: BQ Cervantes 4
Opened a ticket to keep the issue tracked: https://github.com/koreader/koreader/issues/6263
pazos is offline   Reply With Quote
Old 06-12-2020, 05:03 PM   #7
Pajamaman
Wizard
Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.
 
Pajamaman's Avatar
 
Posts: 1,788
Karma: 6447888
Join Date: May 2016
Location: Quebec, QC
Device: Nook, Onyx
Thanks for all your help Pazos. It appears to be a problem specific to the Onyx as it does not occur on the Nook. I would have expected disabling the back button under Koreader navigation settings would have blocked it, but no matter what I set it to, it throws me out. I guess I'll be reading French on the Nook
Pajamaman is offline   Reply With Quote
Old 06-14-2020, 09:11 AM   #8
pazos
cosiñeiro
pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.
 
Posts: 506
Karma: 440552
Join Date: Apr 2014
Device: BQ Cervantes 4
Hi Pajamaman!

The issue you reported is there in all (android) devices. Pressing the back button while in the file manager will push you out of the program without a prompt, ignoring user settings.

Sadly is not the easiest thing to debug as it just happens on android and happens without a good reason

While the bug is not fixed we can add the simplest workaround: a way to ignore the back button completely. This is not optimal as it disables "back key navigation" but you can still navigate if you setup a gesture of your like and assign the "Back" action to it.

It will be available soon, hopefully before 2020.06, under Settings gear -> navigation -> ignore back button completely (or something similar).
Attached Thumbnails
Click image for larger version

Name:	2020-06-14_15-04.png
Views:	13
Size:	51.0 KB
ID:	179898  
pazos is offline   Reply With Quote
Old 06-14-2020, 10:47 AM   #9
Pajamaman
Wizard
Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.
 
Pajamaman's Avatar
 
Posts: 1,788
Karma: 6447888
Join Date: May 2016
Location: Quebec, QC
Device: Nook, Onyx
If you can remove the back button function from koreader, I would greatly appreciate it. I don't see why it needs to be there. Koreader can be exited via the menu, and the same is true for navigating the tree in the file manager. Maybe I am missing something.

But the back button is the only way to navigate back from external apps, and particularly dictionaries, so this is a big issue and a deal breaker. Dictionary navigation is a key functionality in an e-reader

Thanks for your help, as always! If Koreader was in java or some form of C, I would take a look. But I don't have time at the moment to learn lua.

FYI

I did a test calling web pages from Koreader via two ebooks. Interesting results. Hopefully this is clear.

Case 1: Open Ebook 1. Go to Web page 1 from url link. Do a Back out of the browser, it returns to koreader, then drops me out of koreader. All with one back button press.

Case 2: Open Ebook 2. Go to Web page 2 from url link. Do a Back out of the browser, it returns to koreader, and _stays_ in koreader. It does not drop me out and stays in ebook 2. As one would expect with intended functionality.

Then it gets interesting...

Case 3:

Repeat Case 2: Open Ebook 2. Go to Web page 2 from url link. Do a Back out of the browser, it returns to koreader, and _stays_ in koreader. It does not drop me out.

Then open ebook 1 via koreader menu.

Repeat Case 1: Case 1: Open Ebook 1. Go to Web page 1 from url link. Do a Back out of the browser, it returns to koreader (ebook 1 is open), then exits book 1, but opens ebook 2!

tldr;

The ghost second back button action doesn't drop me out of koreader, but drops me into the previously opened book that does not show the bug!

Last edited by Pajamaman; 06-14-2020 at 11:03 AM.
Pajamaman is offline   Reply With Quote
Old 06-14-2020, 11:09 AM   #10
pazos
cosiñeiro
pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.
 
Posts: 506
Karma: 440552
Join Date: Apr 2014
Device: BQ Cervantes 4
Quote:
Originally Posted by Pajamaman View Post
If you can remove the back button function from koreader, I would greatly appreciate it. I don't see why it needs to be there. Koreader can be exited via the menu, and the same is true for navigating the tree in the file manager. Maybe I am missing something.
Back key is needed on devices without touchscreen. It will allow you to pop out of a given menu or return back to the previous page in a book, for example.

Given that KOReader works as-is on different devices there's no need to make more splits than needed: a back key is a back key in all platforms. The same for events: a back event is a back event in all platforms.

Here we're addressing the oddities of a single platform: android, by adding a special option for that platform that allow users to disable the back key completely, but that don't prevent the usage of back events via gestures.

Is the back key needed to use the program on a touchscreen android device?. Probably not, but it shouldn't be treated differently than in other platforms. At the end of the day is just another "back key".

Quote:
Originally Posted by Pajamaman View Post
FYI (...)
Your device seems to be replaying key events that happens in other applications. Anyways, you can avoid it (in KOReader) by disabling the back button completely (as stated in the previous post):

Here is a test build for you (it is signed with my keys so you need to uninstall the apk first): https://www.dropbox.com/s/j5zm1oa1vc...-test.apk?dl=0

With that apk installed and the new option enabled you shouldn't reproduce any of the issues mentioned in this post.
pazos is offline   Reply With Quote
Old 06-14-2020, 11:31 AM   #11
pazos
cosiñeiro
pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.
 
Posts: 506
Karma: 440552
Join Date: Apr 2014
Device: BQ Cervantes 4
Quote:
Originally Posted by Pajamaman View Post
Thanks for your help, as always! If Koreader was in java or some form of C, I would take a look. But I don't have time at the moment to learn lua.
You are welcome

By the way, if you really know some Java / C, you can learn lua in a few hours. That wouldn't mean learning the entire app in a few hours, since KOReader implements its own everything (framebuffer drivers, user interface toolkit, event system, input handling, platform code, device abstraction ... ). lua is not the difficult part of it.

And we do have a lot of C/C++ code in https://github.com/koreader/koreader-base. Just happens that most of it is used via LuaJIT ffi.

The same for the android backend and C/Kotlin: https://github.com/koreader/android-luajit-launcher
pazos is offline   Reply With Quote
Old 06-14-2020, 11:54 AM   #12
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 10,493
Karma: 18151936
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW & PW2; Kobo H2O & Forma
Yup, you can pretty much think of Lua as are-bones C without pointers and with limited typing (essentially, everything is either a double or a string, and the only complex structure is the table, which is essentially an array/list and a hashmap/dict rolled into one, inside which everything can coexist) .

If you have a specific query/interest, we'll be happy to point you in the right direction, because as @pazos mentioned, the biggest hurdle is likely knowing what's responsible for something in particular, rather than the programming language(s) .

Last edited by NiLuJe; 06-14-2020 at 11:59 AM.
NiLuJe is offline   Reply With Quote
Old 06-14-2020, 11:57 AM   #13
Pajamaman
Wizard
Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.
 
Pajamaman's Avatar
 
Posts: 1,788
Karma: 6447888
Join Date: May 2016
Location: Quebec, QC
Device: Nook, Onyx
Quote:
Originally Posted by NiLuJe View Post
Yup, you can pretty much think of Lua as are-bones C without pointers and with limited typing (essentially, everything's a double or a table) .
But..but..I love pointers
Pajamaman is offline   Reply With Quote
Old 06-14-2020, 12:00 PM   #14
Pajamaman
Wizard
Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.
 
Pajamaman's Avatar
 
Posts: 1,788
Karma: 6447888
Join Date: May 2016
Location: Quebec, QC
Device: Nook, Onyx
Quote:
Originally Posted by pazos View Post
Back key is needed on devices without touchscreen. It will allow you to pop out of a given menu or return back to the previous page in a book, for example.

Given that KOReader works as-is on different devices there's no need to make more splits than needed: a back key is a back key in all platforms. The same for events: a back event is a back event in all platforms.

Here we're addressing the oddities of a single platform: android, by adding a special option for that platform that allow users to disable the back key completely, but that don't prevent the usage of back events via gestures.

Is the back key needed to use the program on a touchscreen android device?. Probably not, but it shouldn't be treated differently than in other platforms. At the end of the day is just another "back key".



Your device seems to be replaying key events that happens in other applications. Anyways, you can avoid it (in KOReader) by disabling the back button completely (as stated in the previous post):

Here is a test build for you (it is signed with my keys so you need to uninstall the apk first): https://www.dropbox.com/s/j5zm1oa1vc...-test.apk?dl=0

With that apk installed and the new option enabled you shouldn't reproduce any of the issues mentioned in this post.
I will test it later. Many thanks !
Pajamaman is offline   Reply With Quote
Old 06-16-2020, 08:59 AM   #15
Pajamaman
Wizard
Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.Pajamaman ought to be getting tired of karma fortunes by now.
 
Pajamaman's Avatar
 
Posts: 1,788
Karma: 6447888
Join Date: May 2016
Location: Quebec, QC
Device: Nook, Onyx
Pazos, I tested it on the Onyx, and it works. Back-ing out of goldendict no longer drops out of koreader. It remains in Koreader, which is the functionality I required.

FYI when in Koreader, the back button still leaves Koreader, even if back button disabled.

But this version works fine for my uses. Much appreciated. Thanks for going to the trouble of changing and compiling it for me
Pajamaman is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Android] CC Android missing Settings button mobamoba Calibre Companion 4 10-25-2017 03:56 PM
Back button gabaldini Calibre 2 12-30-2016 10:15 AM
[PB622] Problems with back button in the browser marmistrz PocketBook 0 09-08-2013 10:57 AM
Back Button? dandichka Calibre 5 07-05-2012 12:19 PM
PRS-T1 How can I use back button as power button? younghere Sony Reader 1 03-12-2012 06:37 PM


All times are GMT -4. The time now is 12:43 PM.


MobileRead.com is a privately owned, operated and funded community.