Closed hssm closed 9 years ago
Cighir, you are right, this has been solved in Cool Reader and recently also in Aard
Dictionary (Offline Wikipedia), the annoying flashing is gone.
Device detection for e-ink screens
https://github.com/aarddict/android/blob/master/src/aarddict/android/DeviceInfo.java
useAnimation = false;
N2EpdController.setGL16Mode(2); // force full screen refresh when changing articles
https://github.com/aarddict/android/blob/master/src/aarddict/android/ArticleViewActivity.java
Please implement and show on Android Market that AnkiDroid is not only the best flashcard
app but also e-ink friendly!
Reported by Bardo.Mueller
on 2012-02-07 22:34:38
Thanks for your research Bardo :-)
Most of the developers don't have e-ink devices and are thus more motivated to work
on other things, but good news: AnkiDroid is open source!
You seem very motivated and could become a great force in AnkiDroid, just install the
Android SDK, learn Java, and you can make it happen :-)
Java programming is not really difficult, just be prepared to spend a few days studying
patiently AnkiDroid's code and Aardict's code. We are ready to help you if you have
any question.
Here is how to get started in less than a day:
https://code.google.com/p/ankidroid/wiki/Contribution#Source_code
In parallel, could you please investigate what is the purpose of each of the methods
in the class below? This class has zero documentation, having it documented would probably
help a lot.
http://code.google.com/p/apv/source/browse/pdfview/src/cx/hell/android/lib/pagesview/N2EpdController.java
Reported by nicolas.raoul
on 2012-02-08 08:13:27
Nicolas,
when trying to import into the Eclipse workspace via
Import/General/Existing Projects into Workspace/Select archive File
nicolas-raoul-Anki-Android-v0.7-1084-gcadaff0.zip
I get "No projects are found to import"
Can you help out?
My understanding of the N2EpdController.java is rudimentary at best.
It works by controlling the refresh behavior to avoid black flashing.
In the above Aardict it was simply included and the command N2EpdController.setGL16Mode(2);
executed after the creation of the view. That's basically it and should work in AnkiDroid
as well.
Reported by Bardo.Mueller
on 2012-02-09 11:04:13
Importing worked well for me. Try to extract first. Select existing source and enter
into extracted directory.
I didn't try to modify the code. But in CoolReader there is a class with overridden
View method, where the N2EpdController.setGL16mode is called, or depending on menu
option.
On the other hand, ankiDroid has a different method of creating the view, with templates,
and I don't know if you can setup there this method.
Now, I wish I had tried to simply call N2EpdController.setGL16Mode inside ankiDroid
main constructor. Just for testing...
Good luck with patching!
Reported by cighir.victor
on 2012-02-09 12:33:29
Bardo: As Victor said, you have to uncompress the ZIP first, then "existing source".
Reported by nicolas.raoul
on 2012-02-09 14:36:21
Ok, got AnkiDroid compiled now.
Started with inserting N2EpdController commands before possible page updates.
Appears to help, appears to have less "action" before settling on final display.
What still is visible is a short time of intermediate black screen.
- Does anyone know if the background can be made transparent instead like
View.setBackgroundColor(0x00000000); ?
- Another "animation" appearing on e-ink is that there is an intermediate inverted
display. Is this programmatic and could be turned off?
- Page refreshes are full page at the moment. Could this be changed to half the screen
or even printed area?
I guess things would get easier if I would better understand the code - or if developers
would have an e-ink device at hand.
At the moment my testing cycle is slow because I did not yet succeed in testing with
adb on the device.
Reported by Bardo.Mueller
on 2012-02-09 22:25:26
Whao, congratulations Bardo, great to know that the first results are coming that fast
:-)
Keep up the good work!
Do not hesitate to post your work on Git regularly, or just zip the code and post it
here from time to time, so that we can merge it and many people can test it.
Reported by nicolas.raoul
on 2012-02-09 23:27:02
Started
I'm really happy to that you started work on this issue! Keep up the good work Bardo!
Thank you for taking time for this!
You could try setting different refresh modes.
Check out http://forum.xda-developers.com/showthread.php?t=1183173 post #1 ; post #17
describes all update methods, maybe you could try those.
Maybe this can help a little to understand https://github.com/geometer/FBReaderJ-alex/blob/master/src/org/geometerplus/android/fbreader/EPDView.java
Good luck!
Reported by cighir.victor
on 2012-02-10 09:33:57
@Nicolas et al.
I see at the moments two effects more annoying than the actual page refresh:
- when showing the answer below, the question + separator shift.
- before showing the new question, the old question becomes shortly inverted
The relevant code should be in
https://github.com/nicolas-raoul/Anki-Android/blob/master/src/com/ichi2/anki/Reviewer.java
Any idea where this could happen?
Reported by Bardo.Mueller
on 2012-02-11 10:10:02
Pls find enclosed a first version to make AnkiDroid doing better on e-ink devices.
All changes are in Reviewer.java / MyWebView
Normal e-ink operation is slow, display updates result in black intermediate flashes,
for scrolling there are multiple flashes. Compared to ebook readers, learning with
flash cards needs more frequent page turns .
In order to control the refresh behavior, WebView and other classes in E-ink devices
have an added parameter. Since so far e-ink Androids only (?) exist as rooted versions
of bookshop frontends (Kindle, Nook, Sony, ..), there is no official documentation
available.
This is how it works: the code tries to inject the update parameter with a wanted value
by try/catch (no need to identify the device first). The original idea is due to hberntsen
on http://www.mobileread.com/forums/showthread.php?t=165376&page=2
The fast e-ink mode results in fast display updates, but leaves some ghosting (leftovers
from previous contents), plus the contrast is somewhat reduced.
It appears that it leaves only ghosting from not fast mode, so a clear before entering
fast mode might fix it.
No big deal for the reviewer's Q/A display, but might want to revert for other AnkiDroid
screens.
At the moment, the fast e-ink mode only gets reset when running a stock (Sony PRS-T1
for me, I guess it is the same for the Nook) application.
I tried to reset the fast e-ink mode in closeReviewer, but this resulted in no fast
e-ink mode at all.
This is where I would need your help: where is the best place to reset the update mode?
Have fun!
Reported by Bardo.Mueller
on 2012-02-12 11:05:44
Hi
http://code.google.com/p/apv/source/detail?r=638914bf8d739f4ab66bd13fd6e4749a560cb32c
This is the implementation of the nook partial refresh support on APV PDF Viewer, maybe
it helps.
I tried your apk but the reviewer screen didn't refresh. If you need a tester I can
help you.
Thanks
Reported by salsichad2
on 2012-02-13 04:22:35
Thanks for testing, salsich!
What device are you using? Can you give further info what exactly you see or don't
see?
I will try to figure out this evening.
Reported by Bardo.Mueller
on 2012-02-13 06:07:41
Nook color
That is the bug:
http://code.google.com/p/ankidroid/issues/detail?id=762
Norbert fixed the last time.
Reported by salsichad2
on 2012-02-13 11:31:37
The changes I addressed should only make a difference on an e-ink device (Sony PRS-T1
or Nook Touch, but not Nook Color).
Can it be that I downloaded a code version where "your" bug was not yet fixed? Can
you point to a repository with this fix?
Reported by Bardo.Mueller
on 2012-02-13 14:31:56
Sorry, I have both, my test was in Nook Touch.
Reported by salsichad2
on 2012-02-13 14:34:24
https://github.com/nicolas-raoul/Anki-Android/commit/8bd1415c7329f016ce178f6c5bd286226da680f9
https://github.com/nicolas-raoul/Anki-Android/commit/136ba543c1eb45e66a10c79ff2e16cc7b67e4105
Reported by salsichad2
on 2012-02-13 14:40:07
The code I compiled already had the fixes added.
From the bug description I am a bit confused: is it a gesture problem, does the device
FC or just doesn'nt shot anything/only the question?
I made progress on the moving question and separator line when displaying the answer.
Part of the fix is to fake display the answer already when posing the question, but
with color=backgroundcolor. Then also user settable font and button appears to influence
the move. Best results where obtained when leaving everything at 100%.
Reported by Bardo.Mueller
on 2012-02-13 19:43:00
You can see what is happening in that video:
http://www.youtube.com/watch?v=x5VO-vv624c
but now, sometimes the screen goes all white, sametimes only the answer, sometimes
Q&A blink in the screen.
Reported by salsichad2
on 2012-02-13 19:59:19
The thumbs-up was for Norbert and nicolas.raoul!
Reported by salsichad2
on 2012-02-13 20:03:20
(salsichad2: Thumbs up for me? I did absolutely nothing!)
Reported by nicolas.raoul
on 2012-02-13 23:49:16
those interested in fast e-ink mode on Nook Touch might try
hberntsens norefreshenabler
http://www.mobileread.com/forums/showthread.php?t=165376&page=2 (version 2 did not
work for me)
Run the app first, then start AnkiDroid and you know how fast it can be.
If this app gets you in fast e-ink mode, then my code should work with Nook in principle
and the error must lie elsewhere.
Reported by Bardo.Mueller
on 2012-02-14 00:00:07
I could not install the NoRefreshEnabler.apk. "There is a ploblem parsing the package".
Reported by salsichad2
on 2012-02-14 00:11:50
So the Nook does not augment its WebView classes by an updateparameter as does the Sony.
N2EpdController is supposed to work on both, I will try to make it work on my Sony.
Reported by Bardo.Mueller
on 2012-02-14 07:21:58
It looks like the nook and the prs-t1 have different methods of changing the display
mode. The nook has a EpdController class in its android framework, the prs-t1 does
not have that class so N2EpdController does not work on the prs-t1.
My NoRefreshEnabler should not work on the nook because the nook does not have the
extra methods available that sony added in the android view class.
Reported by hberntsen
on 2012-02-14 09:19:00
Hi hbertsen, thanks for joining!
Aargh, it was even in the log:
W / System.err (2497): java.lang.ClassNotFoundException: android.hardware.EpdController
W / System.err (2497): java.lang.ClassNotFoundException: android.hardware.EpdController
Now the big question: can we combine the two approaches into one WebView derived class?
Reported by Bardo.Mueller
on 2012-02-14 09:43:34
@hbertsen
is it possible to write a norefreshenabler_nook using EpdController?
Reported by Bardo.Mueller
on 2012-02-14 14:00:15
It should be possible to make one webview class. Add mehods to the webview class to
set the update mode. The webview class should then do the rest. For the nook it looks
like the N2EpdController class is designed for changing the display modes. You have
to call that class in the webview.
I don't own a nook, you can change my norefreshenabler by adding the N2EpdController
and call the right method.
Reported by hberntsen
on 2012-02-14 14:12:52
Pls find enclosed a modification of hberntsen's norefreshenabler which should work both
on PRS-T1 and Nook Touch e-ink devices.
This is a proof of concept only, working here means devices should be switched to A2
mode (which I prefer for AnkiDroid because it is the fastest).
Although both devices use the same Freescale chip with onboard EPD controller, their
driver is different. I thought to be able to write a common driver but I am not yet
there.
The code already uses automatic device recognition, which works on PRS-T1 and *should*
work on Nook (I don't have one). So if the display does not change, we should verify
the deviceinfo code. Just let me know.
Reported by Bardo.Mueller
on 2012-02-16 23:10:45
I could not install on nook. The same "There is a problem parsing the package".
Reported by salsichad2
on 2012-02-16 23:21:01
echoes from the web on "There is a problem parsing the package"
- Did you enable 3rd party installation first?
- Once I moved .apk's to system/app, using Root Explorer, they installed just fine,
using Package Installer.
Reported by Bardo.Mueller
on 2012-02-16 23:44:43
- Did you enable 3rd party installation first?
Yes
- Once I moved .apk's to system/app, using Root Explorer, they installed just fine,
using Package Installer.
Same error for me.
Is the apk compiled for android 2.1 ?
Reported by salsichad2
on 2012-02-16 23:54:38
It is compiled against 2.2, will try later with 2.1
is this a general restriction for Nook Touch?
Reported by Bardo.Mueller
on 2012-02-17 05:59:54
I'm really not sure. But that is the nook's android version.
Could you open a tread on XDA forum asking for testers?
Reported by salsichad2
on 2012-02-17 16:05:33
here comes compile against 2.1
I think you make a good beta tester.
I had to change some function names, see
http://stackoverflow.com/questions/3000131/android-ndk-r4-san-angeles-problem
Reported by Bardo.Mueller
on 2012-02-17 18:08:09
Thanks.
Still the same "There is a problem parsing the package" error.
Reported by salsichad2
on 2012-02-17 18:42:02
Posted on
http://forum.xda-developers.com/showthread.php?p=22650831
Reported by Bardo.Mueller
on 2012-02-17 20:51:55
Hi
You posted the thread 2 times on XDA App forum.
Can I add a thread on development forum? I think we will have better chance there.
Reported by salsichad2
on 2012-02-18 00:06:19
I could not wai:
http://forum.xda-developers.com/showthread.php?t=1503015
Reported by salsichad2
on 2012-02-18 00:15:23
In the meantime, I compared to Mnemododo (Mnemosyne on Android) and compiled the sources
from
http://www.tbrk.org/software/mnemogogo-devel.html
Surprise: nice, clean interface and displaying smoothly on e-ink, all without any e-ink
specific driver in the code. Especially no multiple flicker when changing cards.
I guess by proper separation of data prep and display the display part of Mnemododo
can be implemented in Ankidroid.
Reported by Bardo.Mueller
on 2012-02-20 07:46:13
Thanks Bardo, great news!
Here is how Mnemogogo implemented its review interface:
http://tbrk.org/cgi-bin/hgwebdir.cgi/mnemododo/file/78c1e2dc4a3b/res/layout/main.xml
http://tbrk.org/cgi-bin/hgwebdir.cgi/mnemododo/file/78c1e2dc4a3b/src/org/tbrk/mnemododo/LoadCardTask.java
Full source: http://tbrk.org/cgi-bin/hgwebdir.cgi/mnemododo/file/78c1e2dc4a3b
Not sure what differs from AnkiDroid's implementation... let's find out :-)
Reported by nicolas.raoul
on 2012-02-20 08:01:44
Nicolas,
Mnemododo:
LoadCardTask.java contains all the append html = data prep part, the display is then
done in MnemododoMain.java
164 private Handler handler = new Handler();
165 private Animation buttonAnimation;
166 private Runnable makeViewVisible = new Runnable() {
167 public void run() {
168 if (hidden_view != null) {
169 hidden_view.setVisibility(View.VISIBLE);
170 if (buttonAnimation != null) {
171 hidden_view.startAnimation(buttonAnimation);
172 }
173 }
174 }
175 };
AnkiDroid:
I need your help on these questions:
- where does the actual display action happen?
- is the base mechanism different for question/anwer?
Differences between Mnemododo and Ankidroid:
Mnemododo uses just html, AnkiDroid a FrameLayout mCardContainer to organize views?
Mnemododo uses Handler / Runnable, Ankidroid not, influence on display timing?
My knowledge of Android is not sufficient to answer these questions. And you possibly
do not see the difference if not on an e-ink screen. Just think what might cause the
difference in making one flashing the screen and the other not.
Reported by Bardo.Mueller
on 2012-02-20 10:46:52
1. all basics should be all in reviewer.java
2. the card container is just there for theming issues and animations.
3. It's a framelayout because the webview is created in code (it needs to be recreated
if using a custom font due a memory leak bug in android)
Reported by NorbertNagold
on 2012-02-20 11:47:39
We are going to remove support for Android 2.1 in release 2.5, so this issue is irrelevant
now
Reported by perceptualchaos2
on 2015-02-16 07:50:06
Reported by perceptualchaos2
on 2015-02-16 07:50:24
Done
Originally reported on Google Code with ID 971
Reported by
cighir.victor
on 2012-01-28 13:24:09