Mobileread
Screen navigation in Android Koreader
#1  Pajamaman 11-26-2019, 10:20 PM
I'm running Koreader on a Nook GL3. It runs very well.

However, the way screen navigation is configured appears to be different on Android than on the Kindle/Kobo version. On a kindle, I edited the default.lua file to customize navigation. However, the default.lua file does not appear to exist on the Android version. Instead there is a file called settings.reader.lua.

In the Kindle default.lua file, I edited these lines specifically:

DTAP_ZONE_MENU = {x = 1/8, y = 0, w = 3/4, h = 1/8}
DTAP_ZONE_CONFIG = {x = 1/8, y = 7/8, w = 3/4, h = 1/8}
DTAP_ZONE_MINIBAR = {x = 0, y = 31/32, w = 1, h = 1/32}
DTAP_ZONE_FORWARD = {x = 1/4, y = 0, w = 3/4, h = 1}
DTAP_ZONE_BACKWARD = {x = 0, y = 0, w = 1/4, h = 1}

I particularly altered how the menus and the page forward work.

I cannot find anything like these lines in the Android settings.reader.lua that refer to menu tap and page forward tap control. Can someone tell me how it works on Android? Is there another file?
Reply 

#2  pazos 11-27-2019, 09:14 AM
Lua files are stored on application private data path under
Code
/data/data
or
Code
/data/user/x
and thus not easily modificable. To solve that we keep a bit of info on the shared storage under the folder koreader. That allows us to keep settings and other data even when the app is uninstalled.

In short: create a new file called
Code
defaults.persistent.lua
inside the koreader folder and copy there the things you want to overwrite. You can use https://github.com/koreader/koreader/blob/master/defaults.lua as a template.
Reply 

#3  Pajamaman 11-27-2019, 10:14 AM
Ah, so it's exactly the same on Android, I just have to create the file and amend it. That's great news. I feared the screen nav options had been totally overhauled for the Android version, and I just got the Unix version exactly as I like it. I'll test everything and post my versions for other to use once it's done. Many thanks.
Reply 

#4  Norbi24 12-01-2019, 11:40 AM
Quote pazos
In short: create a new file called
Code
defaults.persistent.lua
inside the koreader folder and copy there the things you want to overwrite. You can use https://github.com/koreader/koreader/blob/master/defaults.lua as a template.
@Pazos, Thanks also for this tip, and allow me just one idea - wouldn't you mind to make the same also with the dictionaries.lua file ?
Simply at first try to load it from koreader folder (or koreader/android ?), and if not found, use the default one from /data/data/org.koreader.launcher/files/frontend/device/android/discionaries.lua ...

This would make experimenting with 3rd party dictionary apps much more easy

Thanks, Norbert
Reply 

#5  pazos 12-01-2019, 12:51 PM
Quote Norbi24
@Pazos, Thanks also for this tip, and allow me just one idea - wouldn't you mind to make the same also with the dictionaries.lua file ?
Simply at first try to load it from koreader folder (or koreader/android ?), and if not found, use the default one from /data/data/org.koreader.launcher/files/frontend/device/android/discionaries.lua ...

This would make experimenting with 3rd party dictionary apps much more easy

Thanks, Norbert
Sounds nice but I'm not interested .

IMO the list of dicts is not something worth custom settings. It takes less than 1 millisecond to check if each app of the list is installed and enabled, and that check is only performed once during the lifetime of the application.

Your best bet is to request specific dict apps or rebuild KO yourself with the changes you need. The current implementation, albeit very basic, should be able to open most of 3rd party applications. Some of them need custom intents and they need a modification in https://github.com/koreader/android-luajit-launcher/blob/master/app/src/org/koreader/launcher/IntentUtils.kt and thus require a rebuild to work.

Feel free to open a new ticket on the issue tracker if you wish. It might be possible to override the dict list without rebuilding somehow, but I have no idea.

Aaand, if you manage to get a new dict working with KO please give us feedback so we can add it to the list bundled with the application and other users can benefit too. Thanks!
Reply 

#6  Norbi24 12-01-2019, 03:25 PM
Quote pazos
Sounds nice but I'm not interested .
Aaand, if you manage to get a new dict working with KO please give us feedback so we can add it to the list bundled with the application and other users can benefit too. Thanks!
I am adding my dictionary by simply copying my modified dictionaries.lua to the corresponding location per adb shell ... like this:

{ "Aard2", "Aard2", false, "itkach.aard2", "aard2" },
...
{ "HandyLexEsSk", "Lingea Handylex Plus (ES-SK)", false, "com.lingea.handylex.spskh2", "send" },
{ "HandyLexEnSk", "Lingea Handylex Plus (EN-SK)", false, "com.lingea.handylex.enskh2", "send" },
{ "HandyLexGeSk", "Lingea Handylex Plus (GE-SK)", false, "com.lingea.handylex.geskh2", "send" },

These are dictonaries from the Czech company Lingea and work fine, the only problem is that they do not have one app with one namespace where you later load some dictonary data like apparently all the free dic apps, they have a separate app for each language combination - above I had to add 3 lines for slovak-spanisch, english and german, so this is also the reason why I haven't already posted it as I would have needed to add several dozens of lines for all of their lang combinations ... and I have the same experience with the german PONS dictionaries ...
The only way as how to resolve this would be apparently to filter out dynamically all apps with the sent intent or so and let the user select ...
If I would have some experience with LUA, I would have tried it but at the moment this would be too much work for me ... therefore I thought that perhaps moving dictonaries.lua to koreader folder would be a good step into the right direction for those like me (:-)
Reply 

#7  pazos 12-01-2019, 04:47 PM
Oo!

For these kind of apps you could use

Code
{ "GenericSend", "Choose app (send)", false, "org.whatever", "picker-send" },
The app picker will show all the apps that can manage send intents. Just make sure you don't check the "use always". At the end the apps you're using will show first in the app picker.

The same for picker-search and picker-text for other kind of intents.
Reply 

#8  Norbi24 12-02-2019, 01:22 AM
@Pazos,
This looks good, I was experimenting with the namespace "org.whatever" and see that I have to enter there there the full namespace of one of my dict apps (like com.lingea.handylex.spskh2) but then as I select a word and go for translation it offers anyway all apps with the send intent ... not only that application ... perfect

Then on first translation I haver to select the dict from the list, and If I choose always,
it stays selected ... the only drawback is that once I do not want it anymore, I have to go to Android settings and remove the def. settings from the dict app



EDIT:

I tried this type of line by misusing the namespace fo koreader as it is apparently only used here to make the line selectable in the dict selection dialogue:
{ "GenericSend", "Choose Dict App (on first translate action)", false, "org.koreader.launcher", "picker-send" },
and it works fine - wouldn't it be a nice candidate for PR ?

I can build a version locally, install it on my Smartphone and test again with following dict apps:
PONS, RAE, LEO, LINGEA, and perhaps I can shortly purchase also something from Langenscheid and try also that ... if you are interested in
Reply 

#9  pazos 12-02-2019, 02:42 PM
Quote Norbi24
@Pazos,
This looks good, I was experimenting with the namespace "org.whatever" and see that I have to enter there there the full namespace of one of my dict apps (like com.lingea.handylex.spskh2) but then as I select a word and go for translation it offers anyway all apps with the send intent ... not only that application ... perfect

Then on first translation I haver to select the dict from the list, and If I choose always,
it stays selected ... the only drawback is that once I do not want it anymore, I have to go to Android settings and remove the def. settings from the dict app



EDIT:

I tried this type of line by misusing the namespace fo koreader as it is apparently only used here to make the line selectable in the dict selection dialogue:
{ "GenericSend", "Choose Dict App (on first translate action)", false, "org.koreader.launcher", "picker-send" },
and it works fine - wouldn't it be a nice candidate for PR ?

I can build a version locally, install it on my Smartphone and test again with following dict apps:
PONS, RAE, LEO, LINGEA, and perhaps I can shortly purchase also something from Langenscheid and try also that ... if you are interested in
Thanks for the feedback. I made some minor changes in the backend to make this less hacky. See https://github.com/koreader/android-luajit-launcher/pull/200

Of course it is a good candidate for a PR but we need some kind of naming convention and I'm not sure which to use. Anyways with the new backend behaviour generic intents can be triggered with the following "dicts" in the dict list:

Code
{ "Send", "Generic send", false, nil, "send" },
{ "Search", "Generic search", false, nil, "search" },
{ "Text", "Generic text processing", false, nil, "text" },
Reply 

#10  Norbi24 12-02-2019, 05:19 PM
Ok, so if namespace is nil, you would execute the "picker-x", clear.
I am playing still with the older syntax as I do not have your PR and it looks that the generic-send would work with the the most of my dictionaries:

PONS, LINGEA,LEO, COLORDICT, DICT.CC, ABBY LINGVO, GoogleTranslate
(in fact everything I have except for RAE), probably also Langenscheid and DUDEN would, but their cheepest vocabulary costs 15.9E and at the moment I do not want to buy them ...

generic-search only lists ColorDict nothing more.
generic-text only GoogleTranslate and app having "a" in the icon (do not know anymore what it is, appears to be able to load some Collins dictionaries)

I personally would vote for adding a line for the first option into dictionaries.lua and give it a display name like:

"Choose Available Dictionary on First Translate"

this could be intuitive, as if then user selects a word to translate he would ge a list of his dicts ...
Reply 

  Next »  Last »  (1/2)
Today's Posts | Search this Thread | Login | Register