Page 1 of 1

Suggestions for making GoldenDict e-ink Friendly

PostPosted: Sat Mar 24, 2012 6:16 pm
by crusherjoe2000
GoldenDict is a great program and I use it quite extensively on my Sony e-book reader.

It can be made even better by making it more friendly for e-ink display devices by doing the following:

1. Reduce screen refresh: GoldenDict currently does a animated scrolling when jumping between dictionaries. This looks nice on regular LCD screens but introduces some slow screen refresh on e-ink devices. It would be great if there can be an option to turn it off by jumping to the next dictionary directly. This can be done quite easily by passing a parameter to gdNextArticle() and gdPreviousArticle() so that if it is set to true, jump directly instead of doing the incremental animated scrolling.

2. Making use of the next page/previous page keys on the Sony and Nook e-book reader to allow full page scrolling. Once again, this is to reduce slow screen flicker. Here is the code to do it (lifted off the aardict-android project):

public static final int NOOK_KEY_PREV_LEFT = 92;
public static final int NOOK_KEY_NEXT_LEFT = 93;
public static final int NOOK_KEY_PREV_RIGHT = 94;
public static final int NOOK_KEY_NEXT_RIGHT = 95;

// [TST] Mon Feb 27 00:23:07 2012
// d:/ebook/sony_backup/EbookReader/smali/com/sony/drbd/ebook/reader/Constants.smali
protected static final int SONY_SCANCODE_PREVKEY = 105; // 0x69
protected static final int SONY_SCANCODE_NEXTKEY = 106; // 0x70

.....

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() != KeyEvent.ACTION_DOWN) {
// Use Key down rather than up so that we can hold it
// down to repeat
return super.dispatchKeyEvent(event);
}
int keyCode = event.getKeyCode();
Log.w(TAG, "dispatchKeyEvent("+ keyCode +", "+ event.getScanCode()+")");
if (keyCode == 0) {
int scanCode = event.getScanCode();
if (scanCode == SONY_SCANCODE_PREVKEY) {
keyCode = NOOK_KEY_PREV_LEFT:
}
else if (event.getScanCode() == SONY_SCANCODE_NEXTKEY) {
keyCode = NOOK_KEY_NEXT_LEFT:
}
}

switch (keyCode) {
// D:\android\docs\reference\android\view\KeyEvent.html
case KeyEvent.KEYCODE_BACK:
goBack();
break;
case NOOK_KEY_PREV_LEFT:
case NOOK_KEY_PREV_RIGHT:
case KeyEvent.KEYCODE_VOLUME_UP:
articleView.pageUp(false);
break;
case KeyEvent.KEYCODE_VOLUME_DOWN:
case NOOK_KEY_NEXT_LEFT:
case NOOK_KEY_NEXT_RIGHT:
articleView.pageDown(false);
break;
default:
return super.dispatchKeyEvent(event);
}
return true;
}

Thank you for your consideration,

ST

Re: Suggestions for making GoldenDict e-ink Friendly

PostPosted: Sat Mar 24, 2012 7:06 pm
by ikm
Thanks, I'll consider adding that.

Re: Suggestions for making GoldenDict e-ink Friendly

PostPosted: Wed Mar 28, 2012 2:00 am
by crusherjoe2000
Hi,

Thank you for the quick reply. The following information may also be useful to you (also lifted off aarddict):

MANUFACTURER = getBuildField("MANUFACTURER");
MODEL = getBuildField("MODEL");
DEVICE = getBuildField("DEVICE");

EINK_NOOK = MANUFACTURER.toLowerCase().contentEquals("barnesandnoble")&&
MODEL.contentEquals("NOOK") &&
DEVICE.toLowerCase().contentEquals("zoom2");
EINK_SONY = MANUFACTURER.toLowerCase().contentEquals("sony") &&
MODEL.contentEquals("PRS-T1");
EINK_SCREEN = EINK_SONY || EINK_NOOK;

private static String getBuildField(String fieldName) {
try {
return (String)Build.class.getField(fieldName).get(null);
} catch (Exception e) {
Log.e("aarddict",
"Exception while trying to check Build." + fieldName);
return "";
}
}


Regards,
ST

Re: Suggestions for making GoldenDict e-ink Friendly

PostPosted: Wed Mar 28, 2012 6:47 am
by ikm
I believe NOOKs are not exclusively e-ink - some models use color TFT displays. I wonder whether a more precise check is needed. In any case, this is also useful, thanks.

Re: Suggestions for making GoldenDict e-ink Friendly

PostPosted: Sun Jul 21, 2013 7:24 am
by vjjustin
Can you please consider adding these changes into Goldendict?
The scrolling looks very bad in the eink screen.

It will be suffice to add it just as an option (in case you are worried about nook tablets etc.) .

Re: Suggestions for making GoldenDict e-ink Friendly

PostPosted: Sun Sep 22, 2013 9:06 pm
by crafunzio
Hello,
I second that request. Thanks!