aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/userdictionary/UserDictionaryAddWordContents.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/userdictionary/UserDictionaryAddWordContents.java')
-rw-r--r--java/src/com/android/inputmethod/latin/userdictionary/UserDictionaryAddWordContents.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/userdictionary/UserDictionaryAddWordContents.java b/java/src/com/android/inputmethod/latin/userdictionary/UserDictionaryAddWordContents.java
index dad72963d..ba5a68460 100644
--- a/java/src/com/android/inputmethod/latin/userdictionary/UserDictionaryAddWordContents.java
+++ b/java/src/com/android/inputmethod/latin/userdictionary/UserDictionaryAddWordContents.java
@@ -65,6 +65,8 @@ public class UserDictionaryAddWordContents {
private String mLocale;
private final String mOldWord;
private final String mOldShortcut;
+ private String mSavedWord;
+ private String mSavedShortcut;
/* package */ UserDictionaryAddWordContents(final View view, final Bundle args) {
mWordEditText = (EditText)view.findViewById(R.id.user_dictionary_add_word_text);
@@ -96,6 +98,16 @@ public class UserDictionaryAddWordContents {
updateLocale(args.getString(EXTRA_LOCALE));
}
+ /* package */ UserDictionaryAddWordContents(final View view,
+ final UserDictionaryAddWordContents oldInstanceToBeEdited) {
+ mWordEditText = (EditText)view.findViewById(R.id.user_dictionary_add_word_text);
+ mShortcutEditText = (EditText)view.findViewById(R.id.user_dictionary_add_shortcut);
+ mMode = MODE_EDIT;
+ mOldWord = oldInstanceToBeEdited.mSavedWord;
+ mOldShortcut = oldInstanceToBeEdited.mSavedShortcut;
+ updateLocale(mLocale);
+ }
+
// locale may be null, this means default locale
// It may also be the empty string, which means "all locales"
/* package */ void updateLocale(final String locale) {
@@ -149,6 +161,8 @@ public class UserDictionaryAddWordContents {
// If the word is somehow empty, don't insert it.
return CODE_CANCEL;
}
+ mSavedWord = newWord;
+ mSavedShortcut = newShortcut;
// If there is no shortcut, and the word already exists in the database, then we
// should not insert, because either A. the word exists with no shortcut, in which
// case the exact same thing we want to insert is already there, or B. the word