Make some private method static
Change-Id: Ia23765268be0ef89d7fe7c3f5372ed32d6615765
This commit is contained in:
parent
d862b93578
commit
8fbf29e2d5
11 changed files with 23 additions and 27 deletions
|
@ -153,8 +153,7 @@ public class InputMethodManagerCompatWrapper {
|
|||
return Utils.getInputMethodInfo(this, mLatinImePackageName);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private InputMethodSubtypeCompatWrapper getLastResortSubtype(String mode) {
|
||||
private static InputMethodSubtypeCompatWrapper getLastResortSubtype(String mode) {
|
||||
if (VOICE_MODE.equals(mode) && !FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES)
|
||||
return null;
|
||||
Locale inputLocale = SubtypeSwitcher.getInstance().getInputLocale();
|
||||
|
|
|
@ -223,7 +223,7 @@ public class Key {
|
|||
if (style == null)
|
||||
throw new ParseException("Unknown key style: " + styleName, parser);
|
||||
} else {
|
||||
style = keyStyles.getEmptyKeyStyle();
|
||||
style = KeyStyles.getEmptyKeyStyle();
|
||||
}
|
||||
|
||||
final float keyXPos = row.getKeyX(keyAttr);
|
||||
|
|
|
@ -235,7 +235,7 @@ public class KeyStyles {
|
|||
return mStyles.get(styleName);
|
||||
}
|
||||
|
||||
public KeyStyle getEmptyKeyStyle() {
|
||||
public static KeyStyle getEmptyKeyStyle() {
|
||||
return EMPTY_KEY_STYLE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public class AutoCorrection {
|
|||
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,
|
||||
int correctionMode) {
|
||||
if (TextUtils.isEmpty(typedWord)) return false;
|
||||
|
|
|
@ -1178,7 +1178,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||
}
|
||||
|
||||
// "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
|
||||
// if there is one.
|
||||
final CharSequence lastOne = ic.getTextBeforeCursor(1, 0);
|
||||
|
@ -1190,7 +1190,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||
}
|
||||
|
||||
// "ic" may be null
|
||||
private void removeTrailingSpaceWhileInBatchEdit(final InputConnection ic) {
|
||||
private static void removeTrailingSpaceWhileInBatchEdit(final InputConnection ic) {
|
||||
if (ic == null) return;
|
||||
final CharSequence lastOne = ic.getTextBeforeCursor(1, 0);
|
||||
if (lastOne != null && lastOne.length() == 1
|
||||
|
@ -1208,12 +1208,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean isAlphabet(int code) {
|
||||
if (Character.isLetter(code)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
private static boolean isAlphabet(int code) {
|
||||
return Character.isLetter(code);
|
||||
}
|
||||
|
||||
private void onSettingsKeyPressed() {
|
||||
|
@ -2075,7 +2071,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||
}
|
||||
|
||||
// "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);
|
||||
return TextUtils.equals(text, beforeText);
|
||||
}
|
||||
|
@ -2129,7 +2125,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||
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
|
||||
// be needed, but it's there just in case something went wrong.
|
||||
final CharSequence textBeforeCursor = ic.getTextBeforeCursor(2, 0);
|
||||
|
|
|
@ -144,7 +144,7 @@ public class Suggest implements Dictionary.WordCallback {
|
|||
initWhitelistAndAutocorrectAndPool(context, locale);
|
||||
}
|
||||
|
||||
private void addOrReplaceDictionary(Map<String, Dictionary> dictionaries, String key,
|
||||
private static void addOrReplaceDictionary(Map<String, Dictionary> dictionaries, String key,
|
||||
Dictionary dict) {
|
||||
final Dictionary oldDict = (dict == null)
|
||||
? dictionaries.remove(key)
|
||||
|
@ -518,7 +518,8 @@ public class Suggest implements Dictionary.WordCallback {
|
|||
return -1;
|
||||
}
|
||||
|
||||
private void collectGarbage(ArrayList<CharSequence> suggestions, int prefMaxSuggestions) {
|
||||
private static void collectGarbage(ArrayList<CharSequence> suggestions,
|
||||
int prefMaxSuggestions) {
|
||||
int poolSize = StringBuilderPool.getSize();
|
||||
int garbageSize = suggestions.size();
|
||||
while (poolSize < prefMaxSuggestions && garbageSize > 0) {
|
||||
|
|
|
@ -238,7 +238,7 @@ public class UserBigramDictionary extends ExpandableDictionary {
|
|||
/**
|
||||
* Query the database
|
||||
*/
|
||||
private Cursor query(String selection, String[] selectionArgs) {
|
||||
private static Cursor query(String selection, String[] selectionArgs) {
|
||||
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
|
||||
|
||||
// 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. */
|
||||
private void checkPruneData(SQLiteDatabase db) {
|
||||
private static void checkPruneData(SQLiteDatabase db) {
|
||||
db.execSQL("PRAGMA foreign_keys = ON;");
|
||||
Cursor c = db.query(FREQ_TABLE_NAME, new String[] { FREQ_COLUMN_PAIR_ID },
|
||||
null, null, null, null, null);
|
||||
|
@ -380,7 +380,7 @@ public class UserBigramDictionary extends ExpandableDictionary {
|
|||
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);
|
||||
values.put(MAIN_COLUMN_WORD1, word1);
|
||||
values.put(MAIN_COLUMN_WORD2, word2);
|
||||
|
@ -388,7 +388,7 @@ public class UserBigramDictionary extends ExpandableDictionary {
|
|||
return values;
|
||||
}
|
||||
|
||||
private ContentValues getFrequencyContentValues(int pairId, int frequency) {
|
||||
private static ContentValues getFrequencyContentValues(int pairId, int frequency) {
|
||||
ContentValues values = new ContentValues(2);
|
||||
values.put(FREQ_COLUMN_PAIR_ID, pairId);
|
||||
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();
|
||||
qb.setTables(USER_UNIGRAM_DICT_TABLE_NAME);
|
||||
qb.setProjectionMap(sDictProjectionMap);
|
||||
|
@ -251,7 +251,7 @@ public class UserUnigramDictionary extends ExpandableDictionary {
|
|||
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);
|
||||
values.put(COLUMN_WORD, word);
|
||||
values.put(COLUMN_FREQUENCY, frequency);
|
||||
|
|
|
@ -242,7 +242,7 @@ public class Utils {
|
|||
UsabilityStudyLogUtils.getInstance().init(context);
|
||||
return sRingCharBuffer;
|
||||
}
|
||||
private int normalize(int in) {
|
||||
private static int normalize(int in) {
|
||||
int ret = in % BUFSIZE;
|
||||
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");
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public class WordComposer {
|
|||
* @param primaryCode the preferred character
|
||||
* @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[0] > 0 && codes[1] > 0 && codes[0] != primaryCode && codes[1] == primaryCode) {
|
||||
codes[1] = codes[0];
|
||||
|
|
|
@ -368,7 +368,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
|
|||
* @param text the string to evaluate.
|
||||
* @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;
|
||||
|
||||
// TODO: check if an equivalent processing can't be done more quickly with a
|
||||
|
|
Loading…
Reference in a new issue