summaryrefslogtreecommitdiff
path: root/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java')
-rw-r--r--src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java b/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java
index 1e8bf74885..d33f8c34a0 100644
--- a/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java
+++ b/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java
@@ -87,9 +87,18 @@ public class UserDictionaryAddWordContents {
outState.putString(EXTRA_LOCALE, mLocale);
}
+ /* package */ void delete(final Context context) {
+ if (MODE_EDIT == mMode && !TextUtils.isEmpty(mOldWord)) {
+ // Mode edit: remove the old entry.
+ final ContentResolver resolver = context.getContentResolver();
+ UserDictionarySettings.deleteWord(mOldWord, mOldShortcut, resolver);
+ }
+ // If we are in add mode, nothing was added, so we don't need to do anything.
+ }
+
/* package */ void apply(final Context context) {
final ContentResolver resolver = context.getContentResolver();
- if (UserDictionaryAddWordContents.MODE_EDIT == mMode && !TextUtils.isEmpty(mOldWord)) {
+ if (MODE_EDIT == mMode && !TextUtils.isEmpty(mOldWord)) {
// Mode edit: remove the old entry.
UserDictionarySettings.deleteWord(mOldWord, mOldShortcut, resolver);
}