diff options
author | 2013-05-31 04:29:58 -0700 | |
---|---|---|
committer | 2013-05-31 04:29:58 -0700 | |
commit | f6a4670d1c82111e825fb59f8afdbb4ca4d6719b (patch) | |
tree | 24c5b4993944cf541a69c68dbcf892d29898f671 /java/src | |
parent | fcdb85b37a4a41589e5e81cb69e3b4a0db15c875 (diff) | |
parent | 26f489493eb3a1ccb9cb0ab55627bee4c74a6fd2 (diff) | |
download | latinime-f6a4670d1c82111e825fb59f8afdbb4ca4d6719b.tar.gz latinime-f6a4670d1c82111e825fb59f8afdbb4ca4d6719b.tar.xz latinime-f6a4670d1c82111e825fb59f8afdbb4ca4d6719b.zip |
am 26f48949: Fix the displayed status after download
* commit '26f489493eb3a1ccb9cb0ab55627bee4c74a6fd2':
Fix the displayed status after download
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/dictionarypack/DictionarySettingsFragment.java | 16 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/dictionarypack/WordListPreference.java | 9 |
2 files changed, 9 insertions, 16 deletions
diff --git a/java/src/com/android/inputmethod/dictionarypack/DictionarySettingsFragment.java b/java/src/com/android/inputmethod/dictionarypack/DictionarySettingsFragment.java index 1e93e7e7a..4b89d20bb 100644 --- a/java/src/com/android/inputmethod/dictionarypack/DictionarySettingsFragment.java +++ b/java/src/com/android/inputmethod/dictionarypack/DictionarySettingsFragment.java @@ -304,7 +304,7 @@ public final class DictionarySettingsFragment extends PreferenceFragment // the description. final String key = matchLevelString + "." + description + "." + wordlistId; final WordListPreference existingPref = prefMap.get(key); - if (null == existingPref || hasPriority(status, existingPref.mStatus)) { + if (null == existingPref || existingPref.hasPriorityOver(status)) { final WordListPreference oldPreference = mCurrentPreferenceMap.get(key); final WordListPreference pref; if (null != oldPreference @@ -315,7 +315,7 @@ public final class DictionarySettingsFragment extends PreferenceFragment // need to be the same, others have been tested through the key of the // map. Also, status may differ so we don't want to use #equals() here. pref = oldPreference; - pref.mStatus = status; + pref.setStatus(status); } else { // Otherwise, discard it and create a new one instead. pref = new WordListPreference(activity, mDictionaryListInterfaceState, @@ -331,18 +331,6 @@ public final class DictionarySettingsFragment extends PreferenceFragment } } - /** - * Finds out if a given status has priority over another for display order. - * - * @param newStatus - * @param oldStatus - * @return whether newStatus has priority over oldStatus. - */ - private static boolean hasPriority(final int newStatus, final int oldStatus) { - // Both of these should be one of MetadataDbHelper.STATUS_* - return newStatus > oldStatus; - } - @Override public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { diff --git a/java/src/com/android/inputmethod/dictionarypack/WordListPreference.java b/java/src/com/android/inputmethod/dictionarypack/WordListPreference.java index a1031c2ca..7ec7e9c13 100644 --- a/java/src/com/android/inputmethod/dictionarypack/WordListPreference.java +++ b/java/src/com/android/inputmethod/dictionarypack/WordListPreference.java @@ -61,7 +61,7 @@ public final class WordListPreference extends Preference { public final Locale mLocale; public final String mDescription; // The status - public int mStatus; + private int mStatus; // The size of the dictionary file private final int mFilesize; @@ -92,7 +92,7 @@ public final class WordListPreference extends Preference { setKey(wordlistId); } - private void setStatus(final int status) { + public void setStatus(final int status) { if (status == mStatus) return; mStatus = status; setSummary(getSummary(status)); @@ -106,6 +106,11 @@ public final class WordListPreference extends Preference { return mInterfaceState.addToCacheAndReturnView(newView); } + public boolean hasPriorityOver(final int otherPrefStatus) { + // Both of these should be one of MetadataDbHelper.STATUS_* + return mStatus > otherPrefStatus; + } + private String getSummary(final int status) { switch (status) { // If we are deleting the word list, for the user it's like it's already deleted. |