azuwis

[mod] Use volume up/down keys as d-pad left/right when soft keyboard is shown

9 posts in this topic

Htc ime mod has a very useful feature for android phones without d-pad and track ball, use volume keys to move cursor.

But unfortunately I can't take benefit of it because htc ime does not support my native language.

After looking around android source code, I figured out how to implement that myself.

With this framework.jar, when soft keyboard is shown, volume up/down will generate d-pad left/right key events, so you can move cursor in any input box, even when selecting text. It should work with any ime, and should not conflict if ime handle volume keys itself.

The framework.jar is modified for 1.100.39.EMEA.GEN1_A21E_A rom, I have no idea whether it will work with other roms(I guess not).

Unpack the zip, use the following command to flash:

adb remount

adb pull /system/framework/framework.jar framework.jar

adb push framework-mod.jar /system/framework/framework.jar

adb reboot
Here is the patch against android's base framework android-2.1_r2.1p2 branch http://android.git.kernel.org/?p=platform/...5111dda41187332
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java

index 5499bba..315cc01 100644

--- a/core/java/android/inputmethodservice/InputMethodService.java

+++ b/core/java/android/inputmethodservice/InputMethodService.java

@@ -1600,6 +1600,20 @@ public class InputMethodService extends AbstractInputMethodService {

			 }

			 return false;

		 }

+

+		if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {

+				if(isInputViewShown()) {

+						sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_LEFT);

+						return true;

+				}

+		}

+		if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {

+				if(isInputViewShown()) {

+						sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_RIGHT);

+						return true;

+				}

+		}

+

		 return doMovementKey(keyCode, event, MOVEMENT_DOWN);

	 }


@@ -1645,6 +1659,12 @@ public class InputMethodService extends AbstractInputMethodService {

				 && !event.isCanceled()) {

			 return handleBack(true);

		 }

+

+		if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {

+				if(isInputViewShown()) {

+						return true;

+				}

+		}


		 return doMovementKey(keyCode, event, MOVEMENT_UP);

	 }

The patch and modified deassemble code(smali) are also provided in the zip pack.

framework_mod.zip

Update:

add mod for Froyo/E FRF91 framework-mod-froyo.zip

Edited by azuwis
0

Share this post


Link to post
Share on other sites

Great, can it working with xian latest rom ?

Edited by fantong
0

Share this post


Link to post
Share on other sites

Wait did you built this from source or did you modify the smali? Just wondering...

0

Share this post


Link to post
Share on other sites
Wait did you built this from source or did you modify the smali? Just wondering...

build aosp framework.jar, baksmali both acer's and aosp's framework.jar, compare smali files, replace onKeyDown and onKeyUp function of acer's InputMethodServices.smali

0

Share this post


Link to post
Share on other sites

I asked because I wasn't sure.

I wont be flashing this one in particular though... I'm on LCR... The feature is nice in itself though :angry:

0

Share this post


Link to post
Share on other sites
I asked because I wasn't sure.

I wont be flashing this one in particular though... I'm on LCR... The feature is nice in itself though :angry:

Vache said next LCR release will include this.

In fact, I can provide one for LCR. But I need to test it before publish, and I don't want to flash the phone right now.

If you want, I can give you one for testing.

0

Share this post


Link to post
Share on other sites

Actually I'm way more interested in getting the volume rockers to skip music than this feature since I'm on HTC IME all the time. But this is neat for people who are on other IMEs.

0

Share this post


Link to post
Share on other sites
Actually I'm way more interested in getting the volume rockers to skip music than this feature since I'm on HTC IME all the time. But this is neat for people who are on other IMEs.

Maybe this can be implemented by modifying Music Mod(http://github.com/eliotstocker/android_packages_apps_Music/tree/eclair)

Or make a feature request to the Music Mod author?

Edited by azuwis
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

MoDaCo is part of the MoDaCo.network, © Paul O'Brien 2002-2016. MoDaCo uses IntelliTxt technology.