Loading java/src/com/android/inputmethod/latin/UserBinaryDictionary.java +23 −10 Original line number Diff line number Diff line Loading @@ -36,11 +36,22 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary { // TODO: use Words.SHORTCUT when it's public in the SDK final static String SHORTCUT = "shortcut"; private static final String[] PROJECTION_QUERY = { private static final String[] PROJECTION_QUERY; static { // 16 is JellyBean, but we want this to compile against ICS. if (android.os.Build.VERSION.SDK_INT >= 16) { PROJECTION_QUERY = new String[] { Words.WORD, SHORTCUT, Words.FREQUENCY, }; } else { PROJECTION_QUERY = new String[] { Words.WORD, Words.FREQUENCY, }; } } private static final String NAME = "userunigram"; Loading Loading @@ -182,16 +193,18 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary { } private void addWords(Cursor cursor) { // 16 is JellyBean, but we want this to compile against ICS. final boolean hasShortcutColumn = android.os.Build.VERSION.SDK_INT >= 16; clearFusionDictionary(); if (cursor == null) return; if (cursor.moveToFirst()) { final int indexWord = cursor.getColumnIndex(Words.WORD); final int indexShortcut = cursor.getColumnIndex(SHORTCUT); final int indexShortcut = hasShortcutColumn ? cursor.getColumnIndex(SHORTCUT) : 0; final int indexFrequency = cursor.getColumnIndex(Words.FREQUENCY); while (!cursor.isAfterLast()) { String word = cursor.getString(indexWord); String shortcut = cursor.getString(indexShortcut); int frequency = cursor.getInt(indexFrequency); final String word = cursor.getString(indexWord); final String shortcut = hasShortcutColumn ? cursor.getString(indexShortcut) : null; final int frequency = cursor.getInt(indexFrequency); // Safeguard against adding really long words. if (word.length() < MAX_WORD_LENGTH) { super.addWord(word, null, frequency); Loading Loading
java/src/com/android/inputmethod/latin/UserBinaryDictionary.java +23 −10 Original line number Diff line number Diff line Loading @@ -36,11 +36,22 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary { // TODO: use Words.SHORTCUT when it's public in the SDK final static String SHORTCUT = "shortcut"; private static final String[] PROJECTION_QUERY = { private static final String[] PROJECTION_QUERY; static { // 16 is JellyBean, but we want this to compile against ICS. if (android.os.Build.VERSION.SDK_INT >= 16) { PROJECTION_QUERY = new String[] { Words.WORD, SHORTCUT, Words.FREQUENCY, }; } else { PROJECTION_QUERY = new String[] { Words.WORD, Words.FREQUENCY, }; } } private static final String NAME = "userunigram"; Loading Loading @@ -182,16 +193,18 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary { } private void addWords(Cursor cursor) { // 16 is JellyBean, but we want this to compile against ICS. final boolean hasShortcutColumn = android.os.Build.VERSION.SDK_INT >= 16; clearFusionDictionary(); if (cursor == null) return; if (cursor.moveToFirst()) { final int indexWord = cursor.getColumnIndex(Words.WORD); final int indexShortcut = cursor.getColumnIndex(SHORTCUT); final int indexShortcut = hasShortcutColumn ? cursor.getColumnIndex(SHORTCUT) : 0; final int indexFrequency = cursor.getColumnIndex(Words.FREQUENCY); while (!cursor.isAfterLast()) { String word = cursor.getString(indexWord); String shortcut = cursor.getString(indexShortcut); int frequency = cursor.getInt(indexFrequency); final String word = cursor.getString(indexWord); final String shortcut = hasShortcutColumn ? cursor.getString(indexShortcut) : null; final int frequency = cursor.getInt(indexFrequency); // Safeguard against adding really long words. if (word.length() < MAX_WORD_LENGTH) { super.addWord(word, null, frequency); Loading