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 11-26-2019, 10:20 PM   #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: 2,826
Karma: 10700629
Join Date: May 2016
Location: Canada
Device: Onyx Nova
Screen navigation in Android Koreader

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?
Pajamaman is offline   Reply With Quote
Old 11-27-2019, 09:14 AM   #2
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: 1,261
Karma: 2189337
Join Date: Apr 2014
Device: BQ Cervantes 4
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...r/defaults.lua as a template.
pazos is offline   Reply With Quote
Old 11-27-2019, 10:14 AM   #3
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: 2,826
Karma: 10700629
Join Date: May 2016
Location: Canada
Device: Onyx Nova
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.
Pajamaman is offline   Reply With Quote
Old 12-01-2019, 11:40 AM   #4
Norbi24
Connoisseur
Norbi24 doesn't litterNorbi24 doesn't litter
 
Posts: 64
Karma: 144
Join Date: Aug 2019
Device: Tolino Vision HD4, BOOX Poke2
Quote:
Originally Posted by pazos View Post
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...r/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
Norbi24 is offline   Reply With Quote
Old 12-01-2019, 12:51 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: 1,261
Karma: 2189337
Join Date: Apr 2014
Device: BQ Cervantes 4
Quote:
Originally Posted by Norbi24 View Post
@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-...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!
pazos is offline   Reply With Quote
Old 12-01-2019, 03:25 PM   #6
Norbi24
Connoisseur
Norbi24 doesn't litterNorbi24 doesn't litter
 
Posts: 64
Karma: 144
Join Date: Aug 2019
Device: Tolino Vision HD4, BOOX Poke2
Quote:
Originally Posted by pazos View Post
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 (:-)
Norbi24 is offline   Reply With Quote
Old 12-01-2019, 04:47 PM   #7
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: 1,261
Karma: 2189337
Join Date: Apr 2014
Device: BQ Cervantes 4
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.
pazos is offline   Reply With Quote
Old 12-02-2019, 01:22 AM   #8
Norbi24
Connoisseur
Norbi24 doesn't litterNorbi24 doesn't litter
 
Posts: 64
Karma: 144
Join Date: Aug 2019
Device: Tolino Vision HD4, BOOX Poke2
@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

Last edited by Norbi24; 12-02-2019 at 04:03 AM.
Norbi24 is offline   Reply With Quote
Old 12-02-2019, 02:42 PM   #9
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: 1,261
Karma: 2189337
Join Date: Apr 2014
Device: BQ Cervantes 4
Quote:
Originally Posted by Norbi24 View Post
@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-...ncher/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" },
pazos is offline   Reply With Quote
Old 12-02-2019, 05:19 PM   #10
Norbi24
Connoisseur
Norbi24 doesn't litterNorbi24 doesn't litter
 
Posts: 64
Karma: 144
Join Date: Aug 2019
Device: Tolino Vision HD4, BOOX Poke2
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 ...
Norbi24 is offline   Reply With Quote
Old 12-02-2019, 07:51 PM   #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: 1,261
Karma: 2189337
Join Date: Apr 2014
Device: BQ Cervantes 4
Quote:
Originally Posted by Norbi24 View Post
it looks that the generic-send would work with the the most of my dictionaries...

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 ...
It all depends on the apps you installed. Most apps use send as it was the first intent available (an intent is a kind of IPC used in Android to communicate between apps). Wikipedia handles all of them, Kiwix just text processing, Colordict handles its own intent but handles send too... The list is very looong.

I agree with you in including the option to show the app picker and let the use choose, but "Choose Available Dictionary on First Translate" is innacurate as we just start an activity that can handle plain text. It could be whatsapp, gmail, sms or any other app, not just dictionaries. It also implies that the option is just shown once and that's only true if the user checks "use always".

The name should be related to the original "intention" of the intent. Something like "share text with another application".
As everything is related to dict lookups and 3rd party apps we can dismiss "text/lookup" and "(with another) application" and just use "share", "send" and "process".

I'm open to suggestions. I will open a new issue on github and ping you there
pazos is offline   Reply With Quote
Old 12-03-2019, 08:55 AM   #12
Norbi24
Connoisseur
Norbi24 doesn't litterNorbi24 doesn't litter
 
Posts: 64
Karma: 144
Join Date: Aug 2019
Device: Tolino Vision HD4, BOOX Poke2
Quote:
Originally Posted by pazos View Post
I agree with you in including the option to show the app picker and let the use choose, but "Choose Available Dictionary on First Translate" is innacurate as we just start an activity that can handle plain text. It could be whatsapp, gmail, sms or any other app, not just dictionaries. It also implies that the option is just shown once and that's only true if the user checks "use always".

The name should be related to the original "intention" of the intent. Something like "share text with another application".
As everything is related to dict lookups and 3rd party apps we can dismiss "text/lookup" and "(with another) application" and just use "share", "send" and "process".

I'm open to suggestions. I will open a new issue on github and ping you there
@Pazos, I understand your motivation, but in my eyes you are too technical - what the average Koreader user knows about intents, sharing, picker etc.
I bet that even experienced programmers without Android experience would have problems.
Imagine user clicks on Dictionary settings to setup a dictonary, and would see the option "share text with another application": or even three options "share", "send" and "process", what would he think ?
Therefore I tried to formulate something which would at least roughly describe, what is to be expected

But this is only my opinion, I'd wait what you guys do with the git issue
Norbi24 is offline   Reply With Quote
Old 12-03-2019, 10:43 AM   #13
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: 1,261
Karma: 2189337
Join Date: Apr 2014
Device: BQ Cervantes 4
@Norbi24: because I'm still thinking about the naming I ended up implementing your initial suggestion in https://github.com/koreader/koreader/pull/5664. It took me two minutes. That's less work than thinking about a proper name

I hope you'll find it nice
pazos is offline   Reply With Quote
Old 12-03-2019, 04:50 PM   #14
Norbi24
Connoisseur
Norbi24 doesn't litterNorbi24 doesn't litter
 
Posts: 64
Karma: 144
Join Date: Aug 2019
Device: Tolino Vision HD4, BOOX Poke2

I have just pulled you PR for this directories.lua overload, compiled and it works great !
Then I tried also to pull your PR for generic format of the line with nil
but that still doesn't work (but admitably I perhaps did something wrong as it is in the subproject luajit-launcher ... I pulled it there to a new branch, then checked it out .. nor sure if this is a right way
I will wait until it gets commited into the master and then try again, I am pretty new with git (:-(
Norbi24 is offline   Reply With Quote
Old 12-09-2019, 03:28 PM   #15
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: 1,261
Karma: 2189337
Join Date: Apr 2014
Device: BQ Cervantes 4
@Norbi24: it should work on latest nightly. Feel free to add a couple of examples to https://github.com/koreader/koreader...ips-and-tricks under a new section customize dictionary apps
pazos 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
KOreader on Android Ken Maltby KOReader 486 03-21-2024 06:00 PM
Koreader zoom and navigation DanCa KOReader 5 12-14-2020 03:25 PM
DX(G) Primitive fpt server android and Koreader HoanPiTa Kindle Developer's Corner 2 07-21-2019 11:54 AM
KoReader on android background image mystika1 KOReader 1 02-09-2019 05:30 AM
Folder navigation and/or customisable sleep screen and/or reading stats chlorine Which one should I buy? 10 10-16-2017 01:50 PM


All times are GMT -4. The time now is 09:45 AM.


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