Skip to content
This repository has been archived by the owner on Nov 25, 2019. It is now read-only.

support Sony PRS-T1 hardware buttons #30

Open
bardo84 opened this issue Jan 16, 2012 · 1 comment
Open

support Sony PRS-T1 hardware buttons #30

bardo84 opened this issue Jan 16, 2012 · 1 comment

Comments

@bardo84
Copy link

bardo84 commented Jan 16, 2012

Page Turn Buttons on Rooted PRS-T1
..
The page turn arrows are, to the Android system, buttons 105 and 106 and are mapped as DPAD_LEFT and DPAD_RIGHT. The Sony apps are written in such a way that these "keyboard" commands have meaning. Most other apps don't give them a roll or at least a useful one, though someone has been kind enough to tweak FBReader to use them (see the Rooting and Modding Wiki).
..
Source: http://www.mobileread.com/forums/showthread.php?t=163458

@bardo84
Copy link
Author

bardo84 commented Jan 19, 2012

The PRS-T1 page turn arrows are, to the Android system, buttons 105 and 106 and are mapped as DPAD_LEFT and DPAD_RIGHT. So the following code: (thnx NdrU!!) should be adapted accordingly.

@OverRide
public boolean dispatchKeyEvent(KeyEvent event) {
int action = event.getAction();
int keyCode = event.getKeyCode();
WebView scrollView = (WebView) findViewById(R.id.ch01);
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_UP:
if (action == KeyEvent.ACTION_DOWN) {
scrollView.pageUp(false);
}
return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
if (action == KeyEvent.ACTION_DOWN) {
scrollView.pageDown(false);
}
return true;
default:
return super.dispatchKeyEvent(event);
}
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant