summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-05 14:34:30 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-05 14:34:30 -0800
commitedd86fdaa9a52c1f33e27e6e67ffb27fb1521be4 (patch)
tree5b45846508f47cd02223da332d713f2807604660 /samples
parent52d4c30ca52320ec92d1d1ddc8db3f07f69c4f98 (diff)
downloadandroid_development-edd86fdaa9a52c1f33e27e6e67ffb27fb1521be4.tar.gz
android_development-edd86fdaa9a52c1f33e27e6e67ffb27fb1521be4.tar.bz2
android_development-edd86fdaa9a52c1f33e27e6e67ffb27fb1521be4.zip
auto import from //depot/cupcake/@136594
Diffstat (limited to 'samples')
-rw-r--r--samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java b/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java
index 656efdfb7..a870e234a 100644
--- a/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java
+++ b/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java
@@ -174,14 +174,16 @@ public class SoftKeyboard extends InputMethodService
// We now look for a few special variations of text that will
// modify our behavior.
int variation = attribute.inputType & EditorInfo.TYPE_MASK_VARIATION;
- if (variation == EditorInfo.TYPE_TEXT_VARIATION_PASSWORD) {
+ if (variation == EditorInfo.TYPE_TEXT_VARIATION_PASSWORD ||
+ variation == EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
// Do not display predictions / what the user is typing
// when they are entering a password.
mPredictionOn = false;
}
if (variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
- || variation == EditorInfo.TYPE_TEXT_VARIATION_URI) {
+ || variation == EditorInfo.TYPE_TEXT_VARIATION_URI
+ || variation == EditorInfo.TYPE_TEXT_VARIATION_FILTER) {
// Our predictions are not useful for e-mail addresses
// or URIs.
mPredictionOn = false;
@@ -207,6 +209,7 @@ public class SoftKeyboard extends InputMethodService
// For all unknown input types, default to the alphabetic
// keyboard with no special features.
mCurKeyboard = mQwertyKeyboard;
+ updateShiftKeyState(attribute);
}
// Update the label on the enter key, depending on what the application
@@ -428,7 +431,11 @@ public class SoftKeyboard extends InputMethodService
private void updateShiftKeyState(EditorInfo attr) {
if (attr != null
&& mInputView != null && mQwertyKeyboard == mInputView.getKeyboard()) {
- int caps = getCurrentInputConnection().getCursorCapsMode(attr.inputType);
+ int caps = 0;
+ EditorInfo ei = getCurrentInputEditorInfo();
+ if (ei != null && ei.inputType != EditorInfo.TYPE_NULL) {
+ caps = getCurrentInputConnection().getCursorCapsMode(attr.inputType);
+ }
mInputView.setShifted(mCapsLock || caps != 0);
}
}
@@ -553,7 +560,7 @@ public class SoftKeyboard extends InputMethodService
final int length = mComposing.length();
if (length > 1) {
mComposing.delete(length - 1, length);
- getCurrentInputConnection().setComposingText(mComposing, mComposing.length());
+ getCurrentInputConnection().setComposingText(mComposing, 1);
updateCandidates();
} else if (length > 0) {
mComposing.setLength(0);
@@ -594,7 +601,7 @@ public class SoftKeyboard extends InputMethodService
}
if (isAlphabet(primaryCode) && mPredictionOn) {
mComposing.append((char) primaryCode);
- getCurrentInputConnection().setComposingText(mComposing, mComposing.length());
+ getCurrentInputConnection().setComposingText(mComposing, 1);
updateShiftKeyState(getCurrentInputEditorInfo());
updateCandidates();
} else {
@@ -605,7 +612,7 @@ public class SoftKeyboard extends InputMethodService
private void handleClose() {
commitTyped(getCurrentInputConnection());
- dismissSoftInput(0);
+ requestHideSelf(0);
mInputView.closing();
}