Hopefully fix bug and fixed UI mishap:
* This hopefully fixes #7 somewhat properly. * Also fixed weird settings UI when moved from Preferences
This commit is contained in:
parent
84d8ead7ad
commit
d3b10a47bf
4 changed files with 67 additions and 58 deletions
|
|
@ -68,7 +68,8 @@
|
||||||
<string name="pref_restore_nofile">Error: Backup file not found.</string>
|
<string name="pref_restore_nofile">Error: Backup file not found.</string>
|
||||||
<string name="pref_nuke_warn">Warning: This will delete your entire dictionary. Do you wish to continue?</string>
|
<string name="pref_nuke_warn">Warning: This will delete your entire dictionary. Do you wish to continue?</string>
|
||||||
<string name="pref_nuke_title">Nuke IME dictionary</string>
|
<string name="pref_nuke_title">Nuke IME dictionary</string>
|
||||||
<string name="pref_reloadKeys">Force reload of key overrides</string>
|
<string name="pref_reloadKeys">Reload KeyMap</string>
|
||||||
|
<string name="pref_reloadKeysSum" translatable="false">Force reload of key mapping overrides</string>
|
||||||
|
|
||||||
<string name="hello_world">Hello world!</string>
|
<string name="hello_world">Hello world!</string>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,5 +26,5 @@
|
||||||
<Setting title="@string/pref_nukedict" id="nukedict"/>
|
<Setting title="@string/pref_nukedict" id="nukedict"/>
|
||||||
<Setting title="@string/pref_backupdict" id="backupdict"/>
|
<Setting title="@string/pref_backupdict" id="backupdict"/>
|
||||||
<Setting title="@string/pref_restoredict" id="restoredict"/>
|
<Setting title="@string/pref_restoredict" id="restoredict"/>
|
||||||
<Setting title="@string/pref_reloadKeys" id="reloadKeys"/>
|
<Setting title="@string/pref_reloadKeys" summary="@string/pref_reloadKeysSum" id="reloadKeys"/>
|
||||||
</Settings>
|
</Settings>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import android.content.res.Resources;
|
||||||
import android.inputmethodservice.InputMethodService;
|
import android.inputmethodservice.InputMethodService;
|
||||||
import android.inputmethodservice.KeyboardView;
|
import android.inputmethodservice.KeyboardView;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
@ -86,6 +87,8 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
private static final int[] MODE_CYCLE = { MODE_LANG, MODE_TEXT, MODE_NUM };
|
private static final int[] MODE_CYCLE = { MODE_LANG, MODE_TEXT, MODE_NUM };
|
||||||
private int mKeyMode;
|
private int mKeyMode;
|
||||||
|
|
||||||
|
private InputConnection currentInputConnection = null;
|
||||||
|
|
||||||
private Toast modeNotification = null;
|
private Toast modeNotification = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -181,9 +184,8 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
awintent.putExtra("org.nyanya.android.traditionalt9.word", mComposing.toString());
|
awintent.putExtra("org.nyanya.android.traditionalt9.word", mComposing.toString());
|
||||||
awintent.putExtra("org.nyanya.android.traditionalt9.lang", mLang.id);
|
awintent.putExtra("org.nyanya.android.traditionalt9.lang", mLang.id);
|
||||||
clearState();
|
clearState();
|
||||||
InputConnection ic = getCurrentInputConnection();
|
currentInputConnection.setComposingText("", 0);
|
||||||
ic.setComposingText("", 0);
|
currentInputConnection.finishComposingText();
|
||||||
ic.finishComposingText();
|
|
||||||
updateCandidates();
|
updateCandidates();
|
||||||
//onFinishInput();
|
//onFinishInput();
|
||||||
mWordFound = true;
|
mWordFound = true;
|
||||||
|
|
@ -217,6 +219,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
//Log.d("onStartInput", "attribute.inputType: " + attribute.inputType +
|
//Log.d("onStartInput", "attribute.inputType: " + attribute.inputType +
|
||||||
// " restarting? " + restarting);
|
// " restarting? " + restarting);
|
||||||
//Utils.printFlags(attribute.inputType);
|
//Utils.printFlags(attribute.inputType);
|
||||||
|
currentInputConnection = getCurrentInputConnection();
|
||||||
|
|
||||||
if (attribute.inputType == 0) {
|
if (attribute.inputType == 0) {
|
||||||
mLang = null;
|
mLang = null;
|
||||||
|
|
@ -399,7 +402,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
private void finish() {
|
private void finish() {
|
||||||
// Log.d("finish", "why?");
|
// Log.d("finish", "why?");
|
||||||
// Clear current composing text and candidates.
|
// Clear current composing text and candidates.
|
||||||
pickSelectedCandidate(getCurrentInputConnection());
|
pickSelectedCandidate(currentInputConnection);
|
||||||
clearState();
|
clearState();
|
||||||
// updateCandidates();
|
// updateCandidates();
|
||||||
|
|
||||||
|
|
@ -436,7 +439,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
int candidatesStart, int candidatesEnd) {
|
int candidatesStart, int candidatesEnd) {
|
||||||
super.onUpdateSelection(oldSelStart, oldSelEnd, newSelStart, newSelEnd, candidatesStart,
|
super.onUpdateSelection(oldSelStart, oldSelEnd, newSelStart, newSelEnd, candidatesStart,
|
||||||
candidatesEnd);
|
candidatesEnd);
|
||||||
|
if (mKeyMode == MODE_TEXT) { return; } // stops the ghost fast-type commit
|
||||||
// If the current selection in the text view changes, we should
|
// If the current selection in the text view changes, we should
|
||||||
// clear whatever candidate text we have.
|
// clear whatever candidate text we have.
|
||||||
if ((mComposing.length() > 0 || mComposingI.length() > 0)
|
if ((mComposing.length() > 0 || mComposingI.length() > 0)
|
||||||
|
|
@ -444,9 +447,8 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
mComposing.setLength(0);
|
mComposing.setLength(0);
|
||||||
mComposingI.setLength(0);
|
mComposingI.setLength(0);
|
||||||
updateCandidates();
|
updateCandidates();
|
||||||
InputConnection ic = getCurrentInputConnection();
|
if (currentInputConnection != null) {
|
||||||
if (ic != null) {
|
currentInputConnection.finishComposingText();
|
||||||
ic.finishComposingText();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -499,7 +501,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
|
|
||||||
} else if (keyCode == KeyMap.DEL) {// Special handling of the delete key: if we currently are
|
} else if (keyCode == KeyMap.DEL) {// Special handling of the delete key: if we currently are
|
||||||
// composing text for the user, we want to modify that instead
|
// composing text for the user, we want to modify that instead
|
||||||
// of let the application to the delete itself.
|
// of let the application do the delete itself.
|
||||||
// if (mComposing.length() > 0) {
|
// if (mComposing.length() > 0) {
|
||||||
onKey(keyCode, null);
|
onKey(keyCode, null);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -720,16 +722,15 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
/**
|
/**
|
||||||
* Helper function to commit any text being composed in to the editor.
|
* Helper function to commit any text being composed in to the editor.
|
||||||
*/
|
*/
|
||||||
|
// private void commitTyped() { commitTyped(getCurrentInputConnection()); }
|
||||||
private void commitTyped() {
|
private void commitTyped() {
|
||||||
commitTyped(getCurrentInputConnection());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void commitTyped(InputConnection ic) {
|
|
||||||
if (interfacehandler != null) {
|
if (interfacehandler != null) {
|
||||||
interfacehandler.midButtonUpdate(false);
|
interfacehandler.midButtonUpdate(false);
|
||||||
interfacehandler.showNotFound(false);
|
interfacehandler.showNotFound(false);
|
||||||
}
|
}
|
||||||
pickSelectedCandidate(ic);
|
|
||||||
|
pickSelectedCandidate(currentInputConnection);
|
||||||
|
|
||||||
clearState();
|
clearState();
|
||||||
updateCandidates();
|
updateCandidates();
|
||||||
setCandidatesViewShown(false);
|
setCandidatesViewShown(false);
|
||||||
|
|
@ -744,7 +745,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
if (attr != null && mCapsMode != CAPS_ALL) {
|
if (attr != null && mCapsMode != CAPS_ALL) {
|
||||||
int caps = 0;
|
int caps = 0;
|
||||||
if (attr.inputType != InputType.TYPE_NULL) {
|
if (attr.inputType != InputType.TYPE_NULL) {
|
||||||
caps = getCurrentInputConnection().getCursorCapsMode(attr.inputType);
|
caps = currentInputConnection.getCursorCapsMode(attr.inputType);
|
||||||
}
|
}
|
||||||
// mInputView.setShifted(mCapsLock || caps != 0);
|
// mInputView.setShifted(mCapsLock || caps != 0);
|
||||||
// Log.d("updateShift", "caps: " + caps);
|
// Log.d("updateShift", "caps: " + caps);
|
||||||
|
|
@ -768,15 +769,12 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
* I'll have to onText
|
* I'll have to onText
|
||||||
*/
|
*/
|
||||||
private void keyDownUp(int keyEventCode) {
|
private void keyDownUp(int keyEventCode) {
|
||||||
InputConnection ic = getCurrentInputConnection();
|
currentInputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, keyEventCode));
|
||||||
KeyEvent kv = KeyEvent.changeFlags(new KeyEvent(KeyEvent.ACTION_DOWN, keyEventCode),
|
currentInputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, keyEventCode));
|
||||||
KeyEvent.FLAG_SOFT_KEYBOARD);
|
}
|
||||||
ic.sendKeyEvent(kv);
|
private void keyDownUp(String keys) {
|
||||||
kv = KeyEvent.changeFlags(new KeyEvent(KeyEvent.ACTION_UP, keyEventCode),
|
currentInputConnection.sendKeyEvent(new KeyEvent(SystemClock.uptimeMillis(), keys, 0, 0));
|
||||||
KeyEvent.FLAG_SOFT_KEYBOARD);
|
|
||||||
ic.sendKeyEvent(kv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Implementation of KeyboardViewListener
|
// Implementation of KeyboardViewListener
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -824,15 +822,14 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onText(CharSequence text) {
|
public void onText(CharSequence text) {
|
||||||
InputConnection ic = getCurrentInputConnection();
|
if (currentInputConnection == null)
|
||||||
if (ic == null)
|
|
||||||
return;
|
return;
|
||||||
ic.beginBatchEdit();
|
currentInputConnection.beginBatchEdit();
|
||||||
if (mComposing.length() > 0 || mComposingI.length() > 0) {
|
if (mComposing.length() > 0 || mComposingI.length() > 0) {
|
||||||
commitTyped(ic);
|
commitTyped();
|
||||||
}
|
}
|
||||||
ic.commitText(text, 1);
|
currentInputConnection.commitText(text, 1);
|
||||||
ic.endBatchEdit();
|
currentInputConnection.endBatchEdit();
|
||||||
updateShiftKeyState(getCurrentInputEditorInfo());
|
updateShiftKeyState(getCurrentInputEditorInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -934,6 +931,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
}
|
}
|
||||||
} else if (mKeyMode == MODE_TEXT) {
|
} else if (mKeyMode == MODE_TEXT) {
|
||||||
if (mComposing.length() > 0) {
|
if (mComposing.length() > 0) {
|
||||||
|
//Log.d("updateCandidates", "Previous: " + mComposing.toString());
|
||||||
mSuggestionStrings.clear();
|
mSuggestionStrings.clear();
|
||||||
|
|
||||||
char[] ca = CharMap.T9TABLE[mLang.index][mPrevious];
|
char[] ca = CharMap.T9TABLE[mLang.index][mPrevious];
|
||||||
|
|
@ -941,6 +939,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
mSuggestionStrings.add(String.valueOf(c));
|
mSuggestionStrings.add(String.valueOf(c));
|
||||||
}
|
}
|
||||||
setSuggestions(mSuggestionStrings, mCharIndex);
|
setSuggestions(mSuggestionStrings, mCharIndex);
|
||||||
|
//Log.d("updateCandidates", "newSuggestedIndex: " + mCharIndex);
|
||||||
} else {
|
} else {
|
||||||
setSuggestions(null, -1);
|
setSuggestions(null, -1);
|
||||||
}
|
}
|
||||||
|
|
@ -966,8 +965,8 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
}
|
}
|
||||||
setCandidatesViewShown(false);
|
setCandidatesViewShown(false);
|
||||||
}
|
}
|
||||||
Log.d("handleBS", "Stage1: (" + length + "," + length2 + ")");
|
//Log.d("handleBS", "Stage1: (" + length + "," + length2 + ")");
|
||||||
Log.d("handleBS", "Stage1: (" + mComposingI.toString() + ")");
|
//Log.d("handleBS", "Stage1: (" + mComposingI.toString() + ")");
|
||||||
if (length2 > 1) {
|
if (length2 > 1) {
|
||||||
if (mComposingI.charAt(length2 - 1) == '1') {
|
if (mComposingI.charAt(length2 - 1) == '1') {
|
||||||
// revert previous word
|
// revert previous word
|
||||||
|
|
@ -985,16 +984,16 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
mPreviousWord = "";
|
mPreviousWord = "";
|
||||||
}
|
}
|
||||||
updateCandidates(true);
|
updateCandidates(true);
|
||||||
getCurrentInputConnection().setComposingText(mComposing, 1);
|
currentInputConnection.setComposingText(mComposing, 1);
|
||||||
} else if (length > 0 || length2 > 0) {
|
} else if (length > 0 || length2 > 0) {
|
||||||
Log.d("handleBS", "resetting thing");
|
//Log.d("handleBS", "resetting thing");
|
||||||
mComposing.setLength(0);
|
mComposing.setLength(0);
|
||||||
mComposingI.setLength(0);
|
mComposingI.setLength(0);
|
||||||
interfacehandler.midButtonUpdate(false);
|
interfacehandler.midButtonUpdate(false);
|
||||||
interfacehandler.showNotFound(false);
|
interfacehandler.showNotFound(false);
|
||||||
mSuggestionStrings.clear();
|
mSuggestionStrings.clear();
|
||||||
mPreviousWord = "";
|
mPreviousWord = "";
|
||||||
getCurrentInputConnection().commitText("", 0);
|
currentInputConnection.commitText("", 0);
|
||||||
updateCandidates();
|
updateCandidates();
|
||||||
} else {
|
} else {
|
||||||
mPreviousWord = "";
|
mPreviousWord = "";
|
||||||
|
|
@ -1016,7 +1015,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
|
|
||||||
if (mKeyMode == MODE_LANG && mComposing.length() > 0) {
|
if (mKeyMode == MODE_LANG && mComposing.length() > 0) {
|
||||||
updateCandidates();
|
updateCandidates();
|
||||||
getCurrentInputConnection().setComposingText(mComposing, 1);
|
currentInputConnection.setComposingText(mComposing, 1);
|
||||||
}
|
}
|
||||||
updateKeyMode();
|
updateKeyMode();
|
||||||
if (modeNotification != null)
|
if (modeNotification != null)
|
||||||
|
|
@ -1046,7 +1045,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
keyCode = keyCode - KeyEvent.KEYCODE_0;
|
keyCode = keyCode - KeyEvent.KEYCODE_0;
|
||||||
mComposingI.append(keyCode);
|
mComposingI.append(keyCode);
|
||||||
updateCandidates();
|
updateCandidates();
|
||||||
getCurrentInputConnection().setComposingText(mComposing, 1);
|
currentInputConnection.setComposingText(mComposing, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -1057,13 +1056,14 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
} else {
|
} else {
|
||||||
keyCode = keyCode - KeyEvent.KEYCODE_0;
|
keyCode = keyCode - KeyEvent.KEYCODE_0;
|
||||||
}
|
}
|
||||||
// Log.d("handleChar", "PRIMARY CODE (num): " + keyCode);
|
//Log.d("handleChar", "Key: " + keyCode + "Previous Key: " + mPrevious + " Index:" + mCharIndex);
|
||||||
|
|
||||||
boolean newChar = false;
|
boolean newChar = false;
|
||||||
if (mPrevious == keyCode) {
|
if (mPrevious == keyCode) {
|
||||||
mCharIndex++;
|
mCharIndex++;
|
||||||
} else {
|
} else {
|
||||||
commitTyped(getCurrentInputConnection());
|
//Log.d("handleChar", "COMMITING:" + mComposing.toString());
|
||||||
|
commitTyped();
|
||||||
// updateShiftKeyState(getCurrentInputEditorInfo());
|
// updateShiftKeyState(getCurrentInputEditorInfo());
|
||||||
newChar = true;
|
newChar = true;
|
||||||
mCharIndex = 0;
|
mCharIndex = 0;
|
||||||
|
|
@ -1076,20 +1076,18 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
mCharIndex = CharMap.T9CAPSTART[mLang.index][keyCode];
|
mCharIndex = CharMap.T9CAPSTART[mLang.index][keyCode];
|
||||||
}
|
}
|
||||||
|
|
||||||
// private int mPrevious;
|
|
||||||
// private int mCharindex;
|
|
||||||
mComposing.setLength(0);
|
mComposing.setLength(0);
|
||||||
mComposingI.setLength(0);
|
mComposingI.setLength(0);
|
||||||
char[] ca = CharMap.T9TABLE[mLang.index][keyCode];
|
char[] ca = CharMap.T9TABLE[mLang.index][keyCode];
|
||||||
if (mCharIndex >= ca.length) {
|
if (mCharIndex >= ca.length) {
|
||||||
mCharIndex = 0;
|
mCharIndex = 0;
|
||||||
}
|
}
|
||||||
|
//Log.d("handleChar", "Index: " + mCharIndex);
|
||||||
mComposing.append(ca[mCharIndex]);
|
mComposing.append(ca[mCharIndex]);
|
||||||
getCurrentInputConnection().setComposingText(mComposing, 1);
|
//Log.d("handleChar", "settingCompose: " + mComposing.toString());
|
||||||
|
currentInputConnection.setComposingText(mComposing, 1);
|
||||||
|
|
||||||
// TODO: Find reliable way to do this:
|
t9releasehandler.postDelayed(mt9release, T9DELAY);
|
||||||
// t9releasehandler.postDelayed(mt9release, T9DELAY);
|
|
||||||
if (newChar) {
|
if (newChar) {
|
||||||
// consume single caps
|
// consume single caps
|
||||||
if (mCapsMode == CAPS_SINGLE) {
|
if (mCapsMode == CAPS_SINGLE) {
|
||||||
|
|
@ -1134,7 +1132,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
} else {
|
} else {
|
||||||
// pass previous event and future events to super
|
// pass previous event and future events to super
|
||||||
mIgnoreDPADKeyUp = true;
|
mIgnoreDPADKeyUp = true;
|
||||||
getCurrentInputConnection().sendKeyEvent(mDPADkeyEvent);
|
currentInputConnection.sendKeyEvent(mDPADkeyEvent);
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1148,11 +1146,11 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
if (mKeyMode != MODE_NUM && mComposing.length() > 0) {
|
if (mKeyMode != MODE_NUM && mComposing.length() > 0) {
|
||||||
if (keyCode == KeyMap.DPAD_DOWN) {
|
if (keyCode == KeyMap.DPAD_DOWN) {
|
||||||
mCandidateView.scrollSuggestion(1);
|
mCandidateView.scrollSuggestion(1);
|
||||||
getCurrentInputConnection().setComposingText(mSuggestionStrings.get(mCandidateView.mSelectedIndex), 1);
|
currentInputConnection.setComposingText(mSuggestionStrings.get(mCandidateView.mSelectedIndex), 1);
|
||||||
return true;
|
return true;
|
||||||
} else if (keyCode == KeyMap.DPAD_UP) {
|
} else if (keyCode == KeyMap.DPAD_UP) {
|
||||||
mCandidateView.scrollSuggestion(-1);
|
mCandidateView.scrollSuggestion(-1);
|
||||||
getCurrentInputConnection().setComposingText(mSuggestionStrings.get(mCandidateView.mSelectedIndex), 1);
|
currentInputConnection.setComposingText(mSuggestionStrings.get(mCandidateView.mSelectedIndex), 1);
|
||||||
return true;
|
return true;
|
||||||
} else if (keyCode == KeyMap.DPAD_LEFT || keyCode == KeyMap.DPAD_RIGHT) {
|
} else if (keyCode == KeyMap.DPAD_LEFT || keyCode == KeyMap.DPAD_RIGHT) {
|
||||||
if (mKeyMode == MODE_LANG) {
|
if (mKeyMode == MODE_LANG) {
|
||||||
|
|
@ -1170,7 +1168,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
return true;
|
return true;
|
||||||
} else {// Send stored event to input connection then pass current
|
} else {// Send stored event to input connection then pass current
|
||||||
// event onto super
|
// event onto super
|
||||||
getCurrentInputConnection().sendKeyEvent(mDPADkeyEvent);
|
currentInputConnection.sendKeyEvent(mDPADkeyEvent);
|
||||||
return super.onKeyUp(keyCode, event);
|
return super.onKeyUp(keyCode, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1178,7 +1176,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void commitReset() {
|
private void commitReset() {
|
||||||
commitTyped(getCurrentInputConnection());
|
commitTyped();
|
||||||
charReset();
|
charReset();
|
||||||
if (mCapsMode == CAPS_SINGLE) {
|
if (mCapsMode == CAPS_SINGLE) {
|
||||||
mCapsMode = CAPS_OFF;
|
mCapsMode = CAPS_OFF;
|
||||||
|
|
@ -1195,7 +1193,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleClose() {
|
private void handleClose() {
|
||||||
commitTyped(getCurrentInputConnection());
|
commitTyped();
|
||||||
requestHideSelf(0);
|
requestHideSelf(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1238,7 +1236,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
}
|
}
|
||||||
mComposing.setLength(0);
|
mComposing.setLength(0);
|
||||||
mComposingI.setLength(0);
|
mComposingI.setLength(0);
|
||||||
getCurrentInputConnection().finishComposingText();
|
currentInputConnection.finishComposingText();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -25,17 +25,27 @@ public class SettingAdapter extends ArrayAdapter<Setting> {
|
||||||
final LayoutInflater layoutInflater = LayoutInflater.from(getContext());
|
final LayoutInflater layoutInflater = LayoutInflater.from(getContext());
|
||||||
// Check if an existing view is being reused, otherwise inflate the view
|
// Check if an existing view is being reused, otherwise inflate the view
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
convertView = layoutInflater.inflate(setting.layout, parent, false);
|
convertView = layoutInflater.inflate(R.layout.setting_widget, parent, false);
|
||||||
}
|
}
|
||||||
setting.setView(convertView);
|
setting.setView(convertView);
|
||||||
// Lookup view for data population
|
// Lookup view for data population
|
||||||
((TextView) convertView.findViewById(R.id.title)).setText(setting.title);
|
((TextView) convertView.findViewById(R.id.title)).setText(setting.title);
|
||||||
if (setting.summary != null)
|
View sv = convertView.findViewById(R.id.summary);
|
||||||
((TextView) convertView.findViewById(R.id.summary)).setText(setting.summary);
|
if (setting.summary != null && sv != null) {
|
||||||
|
((TextView) sv).setText(setting.summary);
|
||||||
|
sv.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
else if (sv != null) { sv.setVisibility(View.GONE); }
|
||||||
|
|
||||||
if (setting.widgetID != 0) {
|
|
||||||
final ViewGroup widgetFrame = (ViewGroup) convertView.findViewById(R.id.widget_frame);
|
final ViewGroup widgetFrame = (ViewGroup) convertView.findViewById(R.id.widget_frame);
|
||||||
|
if (setting.widgetID != 0) {
|
||||||
|
widgetFrame.removeAllViews();
|
||||||
layoutInflater.inflate(setting.widgetID, widgetFrame);
|
layoutInflater.inflate(setting.widgetID, widgetFrame);
|
||||||
|
widgetFrame.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// hide the widget area
|
||||||
|
widgetFrame.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
setting.init();
|
setting.init();
|
||||||
// Return the completed view to render on screen
|
// Return the completed view to render on screen
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue