summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-09-12 17:46:40 +0900
committerJean Chalard <jchalard@google.com>2013-09-12 17:47:59 +0900
commit0995398e734bd66ee04b60939ec7c74548148952 (patch)
treed53011c8659aa4faee7ece7402a351402e359976 /core/java/android
parent737d2c0b92b69d9069de6fe0e2785676b9a10d78 (diff)
downloadframeworks_base-0995398e734bd66ee04b60939ec7c74548148952.zip
frameworks_base-0995398e734bd66ee04b60939ec7c74548148952.tar.gz
frameworks_base-0995398e734bd66ee04b60939ec7c74548148952.tar.bz2
Don't change the text in reaction to a user dict add
This is a confusing interface. The user should be able to edit the word in the dialog, and the text should be unchanged. Bug: 9902905 Change-Id: I24e93df37583f6051046fd6a84a4cbb10d99c046
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/widget/Editor.java66
1 files changed, 0 insertions, 66 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index 50d28ab..2b90281 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -205,8 +205,6 @@ public class Editor {
private TextView mTextView;
- private final UserDictionaryListener mUserDictionaryListener = new UserDictionaryListener();
-
Editor(TextView textView) {
mTextView = textView;
}
@@ -2707,9 +2705,6 @@ public class Editor {
intent.putExtra("locale", mTextView.getTextServicesLocale().toString());
// Put a listener to replace the original text with a word which the user
// modified in a user dictionary dialog.
- mUserDictionaryListener.waitForUserDictionaryAdded(
- mTextView, originalText, spanStart, spanEnd);
- intent.putExtra("listener", new Messenger(mUserDictionaryListener));
intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
mTextView.getContext().startActivity(intent);
// There is no way to know if the word was indeed added. Re-check.
@@ -3915,67 +3910,6 @@ public class Editor {
int mChangedStart, mChangedEnd, mChangedDelta;
}
- /**
- * @hide
- */
- public static class UserDictionaryListener extends Handler {
- public TextView mTextView;
- public String mOriginalWord;
- public int mWordStart;
- public int mWordEnd;
-
- public void waitForUserDictionaryAdded(
- TextView tv, String originalWord, int spanStart, int spanEnd) {
- mTextView = tv;
- mOriginalWord = originalWord;
- mWordStart = spanStart;
- mWordEnd = spanEnd;
- }
-
- @Override
- public void handleMessage(Message msg) {
- switch(msg.what) {
- case 0: /* CODE_WORD_ADDED */
- case 2: /* CODE_ALREADY_PRESENT */
- if (!(msg.obj instanceof Bundle)) {
- Log.w(TAG, "Illegal message. Abort handling onUserDictionaryAdded.");
- return;
- }
- final Bundle bundle = (Bundle)msg.obj;
- final String originalWord = bundle.getString("originalWord");
- final String addedWord = bundle.getString("word");
- onUserDictionaryAdded(originalWord, addedWord);
- return;
- default:
- return;
- }
- }
-
- private void onUserDictionaryAdded(String originalWord, String addedWord) {
- if (TextUtils.isEmpty(mOriginalWord) || TextUtils.isEmpty(addedWord)) {
- return;
- }
- if (mWordStart < 0 || mWordEnd >= mTextView.length()) {
- return;
- }
- if (!mOriginalWord.equals(originalWord)) {
- return;
- }
- if (originalWord.equals(addedWord)) {
- return;
- }
- final Editable editable = (Editable) mTextView.getText();
- final String currentWord = editable.toString().substring(mWordStart, mWordEnd);
- if (!currentWord.equals(originalWord)) {
- return;
- }
- mTextView.replaceText_internal(mWordStart, mWordEnd, addedWord);
- // Move cursor at the end of the replaced word
- final int newCursorPosition = mWordStart + addedWord.length();
- mTextView.setCursorPosition_internal(newCursorPosition, newCursorPosition);
- }
- }
-
public static class UndoInputFilter implements InputFilter {
final Editor mEditor;