Implement the delete button for user words

Bug: 6026080
Change-Id: I43345874edb0a1b51dfcac9c99e74c345eeef7e6
This commit is contained in:
Jean Chalard
2012-05-09 20:15:06 +09:00
parent 622fc7aa5f
commit 5bdde7f939
2 changed files with 34 additions and 3 deletions

View File

@@ -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);
}