Dear MobileRead community,
I really miss the old full-scale progress bar. I even wrote feedback to Amazon and asked them to return it. Meanwhile I am waiting for them to take actions, I gathered some thoughts.
I hope for your help! Let's finish this together
Goal: to write a KUAL extension that non-intrusively draws full progress bar line with chapter marks (both level 1 and level 2) on each page turn (every-page turn script example is
Showtime).
By 'non-intrusive' I mean that it should be more like an overlay written as a script, rather than Java-Bytecode patch.
Hoping that methods of getting book info stay the same, this extension should be compatible with future updates.
Script outline is given below. I only half-finished drawing script, due to lack of experience in bash.
Attached an example of such a progress bar (drawn in fbink manually)
Spoiler:
Initial conditions:
- define/determine screen size
Once book is open:
- get book size (location/pages) (value)
- get chapter count, level 1 and level 2 (values)
- get chapter sizes, level 1 and level 2 (vectors)
- get current position
- draw progress bar with fbink
Every Page turn:
- get current position
- redraw
Drawing method:
1) Draw 100%-width of light-gray progress bar
Code:
fbink -t regular=/usr/java/lib/fonts/Baskerville-Regular.ttf,size=7,top=1415,bottom=0,left=350,right=0 -B GRAYC " "
2) Draw in loop 1%-width parts up to read percent dark-gray progress bar (from i=0 to read_percent)
Code:
fbink -t regular=/usr/java/lib/fonts/Baskerville-Regular.ttf,size=7,top=1415,bottom=0,left=350,right=50 -B GRAY7 " "
3) Draw in loop up to number of level 1 chapters
Code:
fbink -t regular=/usr/java/lib/fonts/Baskerville-Regular.ttf,size=7,top=1415,bottom=0,left=350,right=50 -O "|"
4) Draw in loop up to number of level 2 chapters
Code:
fbink -t regular=/usr/java/lib/fonts/Baskerville-Regular.ttf,size=7,top=1415,bottom=0,left=390,right=50 -O "·"
So for PW3 (1072x1440, 300 dpi) I have my progress bar located from 350th pixel up to 950th pixel. Each 1% refers to 6 pixels. In the first fbink command there are 101 spaces (somehow fbink doesn't draw with command of " " (1 space), but " " (2 spaces) command produces in fact 1 space), so in fact each 6 pixels is 1% of the book length.
I hope that for other resolutions it should be trivial to scale down/up.
For now I am really stuck with:
— Getting info about current opened book
— Getting pages/locations, chapters info
Where do I even start?
I remember that native booklet is in Java, but I don't know how to extract working values from there.