1
0
Fork 0

Add IME default action on long press hash.

* also removed some debug messages
This commit is contained in:
Clam 2014-03-30 20:38:12 +11:00
parent 2e16566185
commit fedd835ba5

View file

@ -115,7 +115,7 @@ public class TraditionalT9 extends InputMethodService implements
@Override @Override
public boolean onEvaluateInputViewShown() { public boolean onEvaluateInputViewShown() {
Log.d("T9.onEvaluateInputViewShown", "whatis"); //Log.d("T9.onEvaluateInputViewShown", "whatis");
//Log.d("T9.onEval", "fullscreen?: " + isFullscreenMode() + " isshow?: " + isInputViewShown() + " isrequestedshow?: " + isShowInputRequested()); //Log.d("T9.onEval", "fullscreen?: " + isFullscreenMode() + " isshow?: " + isInputViewShown() + " isrequestedshow?: " + isShowInputRequested());
if (mEditing == EDITING_NOSHOW) { if (mEditing == EDITING_NOSHOW) {
return false; return false;
@ -255,7 +255,6 @@ public class TraditionalT9 extends InputMethodService implements
mLangsAvailable = LangHelper.buildLangs(pref.getString("pref_lang_support", null)); mLangsAvailable = LangHelper.buildLangs(pref.getString("pref_lang_support", null));
mLang = sanitizeLang(pref.getInt("last_lang", 0)); mLang = sanitizeLang(pref.getInt("last_lang", 0));
Log.d("onStartInput", "lang: " + mLang);
updateCandidates(); updateCandidates();
//TODO: Check if "restarting" variable will make things faster/more effecient //TODO: Check if "restarting" variable will make things faster/more effecient
@ -396,7 +395,6 @@ public class TraditionalT9 extends InputMethodService implements
// Log.d("onFinishInput", "When is this called?"); // Log.d("onFinishInput", "When is this called?");
Editor prefedit = pref.edit(); Editor prefedit = pref.edit();
prefedit.putInt("last_lang", mLang); prefedit.putInt("last_lang", mLang);
Log.d("onFinishInput", "last_lang: " + mLang);
prefedit.commit(); prefedit.commit();
if (mEditing == EDITING) { if (mEditing == EDITING) {
commitTyped(); commitTyped();
@ -564,6 +562,7 @@ public class TraditionalT9 extends InputMethodService implements
if (interfacehandler != null) { if (interfacehandler != null) {
interfacehandler.setPressed(keyCode, true); interfacehandler.setPressed(keyCode, true);
} }
case KeyEvent.KEYCODE_FOCUS:
// pass-through // pass-through
case KeyEvent.KEYCODE_0: case KeyEvent.KEYCODE_0:
case KeyEvent.KEYCODE_1: case KeyEvent.KEYCODE_1:
@ -627,7 +626,10 @@ public class TraditionalT9 extends InputMethodService implements
switch (keyCode) { switch (keyCode) {
case KeyEvent.KEYCODE_POUND: case KeyEvent.KEYCODE_POUND:
commitReset(); commitReset();
// do default action or insert new line
if (!sendDefaultEditorAction(true)) {
onText("\n"); onText("\n");
}
return true; return true;
case KeyEvent.KEYCODE_STAR: case KeyEvent.KEYCODE_STAR:
if (mKeyMode != MODE_NUM) { if (mKeyMode != MODE_NUM) {
@ -778,6 +780,7 @@ public class TraditionalT9 extends InputMethodService implements
case KeyEvent.KEYCODE_9: case KeyEvent.KEYCODE_9:
case KeyEvent.KEYCODE_POUND: case KeyEvent.KEYCODE_POUND:
case KeyEvent.KEYCODE_STAR: case KeyEvent.KEYCODE_STAR:
case KeyEvent.KEYCODE_FOCUS:
// if (!isInputViewShown()){ // if (!isInputViewShown()){
// Log.d("onKeyUp", "showing window."); // Log.d("onKeyUp", "showing window.");
// //showWindow(true); // //showWindow(true);
@ -890,6 +893,10 @@ public class TraditionalT9 extends InputMethodService implements
break; break;
case KeyEvent.KEYCODE_SOFT_RIGHT: case KeyEvent.KEYCODE_SOFT_RIGHT:
nextKeyMode(); nextKeyMode();
break;
case KeyEvent.KEYCODE_FOCUS:
// do IME action
break; break;
default: default:
if (keyCode >= KeyEvent.KEYCODE_0 && keyCode <= KeyEvent.KEYCODE_9) { if (keyCode >= KeyEvent.KEYCODE_0 && keyCode <= KeyEvent.KEYCODE_9) {