Merge "Make some private method static"
This commit is contained in:
commit
6f811bd13f
11 changed files with 23 additions and 27 deletions
|
@ -153,8 +153,7 @@ public class InputMethodManagerCompatWrapper {
|
||||||
return Utils.getInputMethodInfo(this, mLatinImePackageName);
|
return Utils.getInputMethodInfo(this, mLatinImePackageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
private static InputMethodSubtypeCompatWrapper getLastResortSubtype(String mode) {
|
||||||
private InputMethodSubtypeCompatWrapper getLastResortSubtype(String mode) {
|
|
||||||
if (VOICE_MODE.equals(mode) && !FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES)
|
if (VOICE_MODE.equals(mode) && !FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES)
|
||||||
return null;
|
return null;
|
||||||
Locale inputLocale = SubtypeSwitcher.getInstance().getInputLocale();
|
Locale inputLocale = SubtypeSwitcher.getInstance().getInputLocale();
|
||||||
|
|
|
@ -223,7 +223,7 @@ public class Key {
|
||||||
if (style == null)
|
if (style == null)
|
||||||
throw new ParseException("Unknown key style: " + styleName, parser);
|
throw new ParseException("Unknown key style: " + styleName, parser);
|
||||||
} else {
|
} else {
|
||||||
style = keyStyles.getEmptyKeyStyle();
|
style = KeyStyles.getEmptyKeyStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
final float keyXPos = row.getKeyX(keyAttr);
|
final float keyXPos = row.getKeyX(keyAttr);
|
||||||
|
|
|
@ -235,7 +235,7 @@ public class KeyStyles {
|
||||||
return mStyles.get(styleName);
|
return mStyles.get(styleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyStyle getEmptyKeyStyle() {
|
public static KeyStyle getEmptyKeyStyle() {
|
||||||
return EMPTY_KEY_STYLE;
|
return EMPTY_KEY_STYLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class AutoCorrection {
|
||||||
return whiteListedWord != null;
|
return whiteListedWord != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasAutoCorrectionForTypedWord(Map<String, Dictionary> dictionaries,
|
private static boolean hasAutoCorrectionForTypedWord(Map<String, Dictionary> dictionaries,
|
||||||
WordComposer wordComposer, ArrayList<CharSequence> suggestions, CharSequence typedWord,
|
WordComposer wordComposer, ArrayList<CharSequence> suggestions, CharSequence typedWord,
|
||||||
int correctionMode) {
|
int correctionMode) {
|
||||||
if (TextUtils.isEmpty(typedWord)) return false;
|
if (TextUtils.isEmpty(typedWord)) return false;
|
||||||
|
|
|
@ -1180,7 +1180,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
}
|
}
|
||||||
|
|
||||||
// "ic" must not be null
|
// "ic" must not be null
|
||||||
private void maybeRemovePreviousPeriod(final InputConnection ic, CharSequence text) {
|
private static void maybeRemovePreviousPeriod(final InputConnection ic, CharSequence text) {
|
||||||
// When the text's first character is '.', remove the previous period
|
// When the text's first character is '.', remove the previous period
|
||||||
// if there is one.
|
// if there is one.
|
||||||
final CharSequence lastOne = ic.getTextBeforeCursor(1, 0);
|
final CharSequence lastOne = ic.getTextBeforeCursor(1, 0);
|
||||||
|
@ -1192,7 +1192,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
}
|
}
|
||||||
|
|
||||||
// "ic" may be null
|
// "ic" may be null
|
||||||
private void removeTrailingSpaceWhileInBatchEdit(final InputConnection ic) {
|
private static void removeTrailingSpaceWhileInBatchEdit(final InputConnection ic) {
|
||||||
if (ic == null) return;
|
if (ic == null) return;
|
||||||
final CharSequence lastOne = ic.getTextBeforeCursor(1, 0);
|
final CharSequence lastOne = ic.getTextBeforeCursor(1, 0);
|
||||||
if (lastOne != null && lastOne.length() == 1
|
if (lastOne != null && lastOne.length() == 1
|
||||||
|
@ -1210,12 +1210,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAlphabet(int code) {
|
private static boolean isAlphabet(int code) {
|
||||||
if (Character.isLetter(code)) {
|
return Character.isLetter(code);
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSettingsKeyPressed() {
|
private void onSettingsKeyPressed() {
|
||||||
|
@ -2078,7 +2074,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
}
|
}
|
||||||
|
|
||||||
// "ic" must not be null
|
// "ic" must not be null
|
||||||
private boolean sameAsTextBeforeCursor(final InputConnection ic, CharSequence text) {
|
private static boolean sameAsTextBeforeCursor(final InputConnection ic, CharSequence text) {
|
||||||
CharSequence beforeText = ic.getTextBeforeCursor(text.length(), 0);
|
CharSequence beforeText = ic.getTextBeforeCursor(text.length(), 0);
|
||||||
return TextUtils.equals(text, beforeText);
|
return TextUtils.equals(text, beforeText);
|
||||||
}
|
}
|
||||||
|
@ -2132,7 +2128,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean revertSwapPunctuation(final InputConnection ic) {
|
private static boolean revertSwapPunctuation(final InputConnection ic) {
|
||||||
// Here we test whether we indeed have a space and something else before us. This should not
|
// Here we test whether we indeed have a space and something else before us. This should not
|
||||||
// be needed, but it's there just in case something went wrong.
|
// be needed, but it's there just in case something went wrong.
|
||||||
final CharSequence textBeforeCursor = ic.getTextBeforeCursor(2, 0);
|
final CharSequence textBeforeCursor = ic.getTextBeforeCursor(2, 0);
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
initWhitelistAndAutocorrectAndPool(context, locale);
|
initWhitelistAndAutocorrectAndPool(context, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addOrReplaceDictionary(Map<String, Dictionary> dictionaries, String key,
|
private static void addOrReplaceDictionary(Map<String, Dictionary> dictionaries, String key,
|
||||||
Dictionary dict) {
|
Dictionary dict) {
|
||||||
final Dictionary oldDict = (dict == null)
|
final Dictionary oldDict = (dict == null)
|
||||||
? dictionaries.remove(key)
|
? dictionaries.remove(key)
|
||||||
|
@ -518,7 +518,8 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void collectGarbage(ArrayList<CharSequence> suggestions, int prefMaxSuggestions) {
|
private static void collectGarbage(ArrayList<CharSequence> suggestions,
|
||||||
|
int prefMaxSuggestions) {
|
||||||
int poolSize = StringBuilderPool.getSize();
|
int poolSize = StringBuilderPool.getSize();
|
||||||
int garbageSize = suggestions.size();
|
int garbageSize = suggestions.size();
|
||||||
while (poolSize < prefMaxSuggestions && garbageSize > 0) {
|
while (poolSize < prefMaxSuggestions && garbageSize > 0) {
|
||||||
|
|
|
@ -238,7 +238,7 @@ public class UserBigramDictionary extends ExpandableDictionary {
|
||||||
/**
|
/**
|
||||||
* Query the database
|
* Query the database
|
||||||
*/
|
*/
|
||||||
private Cursor query(String selection, String[] selectionArgs) {
|
private static Cursor query(String selection, String[] selectionArgs) {
|
||||||
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
|
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
|
||||||
|
|
||||||
// main INNER JOIN frequency ON (main._id=freq.pair_id)
|
// main INNER JOIN frequency ON (main._id=freq.pair_id)
|
||||||
|
@ -310,7 +310,7 @@ public class UserBigramDictionary extends ExpandableDictionary {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Prune any old data if the database is getting too big. */
|
/** Prune any old data if the database is getting too big. */
|
||||||
private void checkPruneData(SQLiteDatabase db) {
|
private static void checkPruneData(SQLiteDatabase db) {
|
||||||
db.execSQL("PRAGMA foreign_keys = ON;");
|
db.execSQL("PRAGMA foreign_keys = ON;");
|
||||||
Cursor c = db.query(FREQ_TABLE_NAME, new String[] { FREQ_COLUMN_PAIR_ID },
|
Cursor c = db.query(FREQ_TABLE_NAME, new String[] { FREQ_COLUMN_PAIR_ID },
|
||||||
null, null, null, null, null);
|
null, null, null, null, null);
|
||||||
|
@ -380,7 +380,7 @@ public class UserBigramDictionary extends ExpandableDictionary {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContentValues getContentValues(String word1, String word2, String locale) {
|
private static ContentValues getContentValues(String word1, String word2, String locale) {
|
||||||
ContentValues values = new ContentValues(3);
|
ContentValues values = new ContentValues(3);
|
||||||
values.put(MAIN_COLUMN_WORD1, word1);
|
values.put(MAIN_COLUMN_WORD1, word1);
|
||||||
values.put(MAIN_COLUMN_WORD2, word2);
|
values.put(MAIN_COLUMN_WORD2, word2);
|
||||||
|
@ -388,7 +388,7 @@ public class UserBigramDictionary extends ExpandableDictionary {
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContentValues getFrequencyContentValues(int pairId, int frequency) {
|
private static ContentValues getFrequencyContentValues(int pairId, int frequency) {
|
||||||
ContentValues values = new ContentValues(2);
|
ContentValues values = new ContentValues(2);
|
||||||
values.put(FREQ_COLUMN_PAIR_ID, pairId);
|
values.put(FREQ_COLUMN_PAIR_ID, pairId);
|
||||||
values.put(FREQ_COLUMN_FREQUENCY, frequency);
|
values.put(FREQ_COLUMN_FREQUENCY, frequency);
|
||||||
|
|
|
@ -206,7 +206,7 @@ public class UserUnigramDictionary extends ExpandableDictionary {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Cursor query(String selection, String[] selectionArgs) {
|
private static Cursor query(String selection, String[] selectionArgs) {
|
||||||
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
|
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
|
||||||
qb.setTables(USER_UNIGRAM_DICT_TABLE_NAME);
|
qb.setTables(USER_UNIGRAM_DICT_TABLE_NAME);
|
||||||
qb.setProjectionMap(sDictProjectionMap);
|
qb.setProjectionMap(sDictProjectionMap);
|
||||||
|
@ -251,7 +251,7 @@ public class UserUnigramDictionary extends ExpandableDictionary {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContentValues getContentValues(String word, int frequency, String locale) {
|
private static ContentValues getContentValues(String word, int frequency, String locale) {
|
||||||
ContentValues values = new ContentValues(4);
|
ContentValues values = new ContentValues(4);
|
||||||
values.put(COLUMN_WORD, word);
|
values.put(COLUMN_WORD, word);
|
||||||
values.put(COLUMN_FREQUENCY, frequency);
|
values.put(COLUMN_FREQUENCY, frequency);
|
||||||
|
|
|
@ -242,7 +242,7 @@ public class Utils {
|
||||||
UsabilityStudyLogUtils.getInstance().init(context);
|
UsabilityStudyLogUtils.getInstance().init(context);
|
||||||
return sRingCharBuffer;
|
return sRingCharBuffer;
|
||||||
}
|
}
|
||||||
private int normalize(int in) {
|
private static int normalize(int in) {
|
||||||
int ret = in % BUFSIZE;
|
int ret = in % BUFSIZE;
|
||||||
return ret < 0 ? ret + BUFSIZE : ret;
|
return ret < 0 ? ret + BUFSIZE : ret;
|
||||||
}
|
}
|
||||||
|
@ -465,7 +465,7 @@ public class Utils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeBackSpace() {
|
public static void writeBackSpace() {
|
||||||
UsabilityStudyLogUtils.getInstance().write("<backspace>\t0\t0");
|
UsabilityStudyLogUtils.getInstance().write("<backspace>\t0\t0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class WordComposer {
|
||||||
* @param primaryCode the preferred character
|
* @param primaryCode the preferred character
|
||||||
* @param codes array of codes based on distance from touch point
|
* @param codes array of codes based on distance from touch point
|
||||||
*/
|
*/
|
||||||
private void correctPrimaryJuxtapos(int primaryCode, int[] codes) {
|
private static void correctPrimaryJuxtapos(int primaryCode, int[] codes) {
|
||||||
if (codes.length < 2) return;
|
if (codes.length < 2) return;
|
||||||
if (codes[0] > 0 && codes[1] > 0 && codes[0] != primaryCode && codes[1] == primaryCode) {
|
if (codes[0] > 0 && codes[1] > 0 && codes[0] != primaryCode && codes[1] == primaryCode) {
|
||||||
codes[1] = codes[0];
|
codes[1] = codes[0];
|
||||||
|
|
|
@ -368,7 +368,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
|
||||||
* @param text the string to evaluate.
|
* @param text the string to evaluate.
|
||||||
* @return true if we should filter this text out, false otherwise
|
* @return true if we should filter this text out, false otherwise
|
||||||
*/
|
*/
|
||||||
private boolean shouldFilterOut(final String text) {
|
private static boolean shouldFilterOut(final String text) {
|
||||||
if (TextUtils.isEmpty(text) || text.length() <= 1) return true;
|
if (TextUtils.isEmpty(text) || text.length() <= 1) return true;
|
||||||
|
|
||||||
// TODO: check if an equivalent processing can't be done more quickly with a
|
// TODO: check if an equivalent processing can't be done more quickly with a
|
||||||
|
|
Loading…
Reference in a new issue