am ab72a97d
: Cleanup unused import
* commit 'ab72a97d7ce44230a0c824797d1675a5ca354a56': Cleanup unused import
This commit is contained in:
commit
b2200511e8
17 changed files with 32 additions and 64 deletions
|
@ -30,7 +30,6 @@ import android.view.inputmethod.EditorInfo;
|
|||
|
||||
import com.android.inputmethod.compat.AccessibilityEventCompatUtils;
|
||||
import com.android.inputmethod.compat.AudioManagerCompatWrapper;
|
||||
import com.android.inputmethod.compat.EditorInfoCompatUtils;
|
||||
import com.android.inputmethod.compat.InputTypeCompatUtils;
|
||||
import com.android.inputmethod.compat.MotionEventCompatUtils;
|
||||
import com.android.inputmethod.keyboard.Key;
|
||||
|
|
|
@ -317,6 +317,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
}
|
||||
|
||||
final boolean settingsKeyEnabled = settingsValues.isSettingsKeyEnabled();
|
||||
@SuppressWarnings("deprecation")
|
||||
final boolean noMicrophone = Utils.inPrivateImeOptions(
|
||||
mPackageName, LatinIME.IME_OPTION_NO_MICROPHONE, editorInfo)
|
||||
|| Utils.inPrivateImeOptions(
|
||||
|
|
|
@ -18,9 +18,7 @@ package com.android.inputmethod.keyboard;
|
|||
|
||||
import android.graphics.Rect;
|
||||
|
||||
import com.android.inputmethod.keyboard.Key;
|
||||
import com.android.inputmethod.keyboard.internal.KeyboardParams.TouchPositionCorrection;
|
||||
import com.android.inputmethod.latin.SubtypeSwitcher;
|
||||
import com.android.inputmethod.latin.Utils;
|
||||
import com.android.inputmethod.latin.spellcheck.SpellCheckerProximityInfo;
|
||||
|
||||
|
|
|
@ -37,16 +37,16 @@ class AssetFileAddress {
|
|||
|
||||
public static AssetFileAddress makeFromFileName(final String filename) {
|
||||
if (null == filename) return null;
|
||||
File f = new File(filename);
|
||||
if (null == f || !f.isFile()) return null;
|
||||
final File f = new File(filename);
|
||||
if (!f.isFile()) return null;
|
||||
return new AssetFileAddress(filename, 0l, f.length());
|
||||
}
|
||||
|
||||
public static AssetFileAddress makeFromFileNameAndOffset(final String filename,
|
||||
final long offset, final long length) {
|
||||
if (null == filename) return null;
|
||||
File f = new File(filename);
|
||||
if (null == f || !f.isFile()) return null;
|
||||
final File f = new File(filename);
|
||||
if (!f.isFile()) return null;
|
||||
return new AssetFileAddress(filename, offset, length);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,12 +16,10 @@
|
|||
|
||||
package com.android.inputmethod.latin;
|
||||
|
||||
import com.android.inputmethod.keyboard.Keyboard;
|
||||
import com.android.inputmethod.keyboard.KeyboardSwitcher;
|
||||
import com.android.inputmethod.keyboard.ProximityInfo;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.inputmethod.keyboard.ProximityInfo;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
|
@ -41,7 +39,6 @@ public class BinaryDictionary extends Dictionary {
|
|||
public static final int MAX_WORD_LENGTH = 48;
|
||||
public static final int MAX_WORDS = 18;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = "BinaryDictionary";
|
||||
private static final int MAX_PROXIMITY_CHARS_SIZE = ProximityInfo.MAX_PROXIMITY_CHARS_SIZE;
|
||||
private static final int MAX_BIGRAMS = 60;
|
||||
|
@ -56,8 +53,6 @@ public class BinaryDictionary extends Dictionary {
|
|||
private final int[] mScores = new int[MAX_WORDS];
|
||||
private final int[] mBigramScores = new int[MAX_BIGRAMS];
|
||||
|
||||
private final KeyboardSwitcher mKeyboardSwitcher = KeyboardSwitcher.getInstance();
|
||||
|
||||
public static final Flag FLAG_REQUIRES_GERMAN_UMLAUT_PROCESSING =
|
||||
new Flag(R.bool.config_require_umlaut_processing, 0x1);
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ package com.android.inputmethod.latin;
|
|||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
@ -27,7 +26,6 @@ import android.util.Log;
|
|||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -24,9 +24,6 @@ import android.content.res.Resources;
|
|||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package com.android.inputmethod.latin;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.android.inputmethod.keyboard.Keyboard;
|
||||
import com.android.inputmethod.keyboard.ProximityInfo;
|
||||
|
@ -166,15 +165,14 @@ public class ExpandableDictionary extends Dictionary {
|
|||
// Does children have the current character?
|
||||
final int childrenLength = children.mLength;
|
||||
Node childNode = null;
|
||||
boolean found = false;
|
||||
for (int i = 0; i < childrenLength; i++) {
|
||||
childNode = children.mData[i];
|
||||
if (childNode.mCode == c) {
|
||||
found = true;
|
||||
final Node node = children.mData[i];
|
||||
if (node.mCode == c) {
|
||||
childNode = node;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (childNode == null) {
|
||||
childNode = new Node();
|
||||
childNode.mCode = c;
|
||||
childNode.mParent = parentNode;
|
||||
|
@ -206,7 +204,7 @@ public class ExpandableDictionary extends Dictionary {
|
|||
}
|
||||
|
||||
protected final void getWordsInner(final WordComposer codes, final WordCallback callback,
|
||||
final ProximityInfo proximityInfo) {
|
||||
@SuppressWarnings("unused") final ProximityInfo proximityInfo) {
|
||||
mInputLength = codes.size();
|
||||
if (mCodes.length < mInputLength) mCodes = new int[mInputLength][];
|
||||
// Cache the codes so that we don't have to lookup an array list
|
||||
|
@ -270,7 +268,7 @@ public class ExpandableDictionary extends Dictionary {
|
|||
*/
|
||||
// TODO: Share this routine with the native code for BinaryDictionary
|
||||
protected void getWordsRec(NodeArray roots, final WordComposer codes, final char[] word,
|
||||
final int depth, boolean completion, int snr, int inputIndex, int skipPos,
|
||||
final int depth, final boolean completion, int snr, int inputIndex, int skipPos,
|
||||
WordCallback callback) {
|
||||
final int count = roots.mLength;
|
||||
final int codeSize = mInputLength;
|
||||
|
@ -278,9 +276,9 @@ public class ExpandableDictionary extends Dictionary {
|
|||
if (depth > mMaxDepth) {
|
||||
return;
|
||||
}
|
||||
int[] currentChars = null;
|
||||
final int[] currentChars;
|
||||
if (codeSize <= inputIndex) {
|
||||
completion = true;
|
||||
currentChars = null;
|
||||
} else {
|
||||
currentChars = mCodes[inputIndex];
|
||||
}
|
||||
|
@ -292,7 +290,7 @@ public class ExpandableDictionary extends Dictionary {
|
|||
final boolean terminal = node.mTerminal;
|
||||
final NodeArray children = node.mChildren;
|
||||
final int freq = node.mFrequency;
|
||||
if (completion) {
|
||||
if (completion || currentChars == null) {
|
||||
word[depth] = c;
|
||||
if (terminal) {
|
||||
final int finalFreq;
|
||||
|
@ -307,7 +305,7 @@ public class ExpandableDictionary extends Dictionary {
|
|||
}
|
||||
}
|
||||
if (children != null) {
|
||||
getWordsRec(children, codes, word, depth + 1, completion, snr, inputIndex,
|
||||
getWordsRec(children, codes, word, depth + 1, true, snr, inputIndex,
|
||||
skipPos, callback);
|
||||
}
|
||||
} else if ((c == Keyboard.CODE_SINGLE_QUOTE
|
||||
|
@ -412,15 +410,14 @@ public class ExpandableDictionary extends Dictionary {
|
|||
// Does children have the current character?
|
||||
final int childrenLength = children.mLength;
|
||||
Node childNode = null;
|
||||
boolean found = false;
|
||||
for (int i = 0; i < childrenLength; i++) {
|
||||
childNode = children.mData[i];
|
||||
if (childNode.mCode == c) {
|
||||
found = true;
|
||||
final Node node = children.mData[i];
|
||||
if (node.mCode == c) {
|
||||
childNode = node;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (childNode == null) {
|
||||
childNode = new Node();
|
||||
childNode.mCode = c;
|
||||
childNode.mParent = parentNode;
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package com.android.inputmethod.latin;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
|
|
@ -32,9 +32,6 @@ import java.util.Locale;
|
|||
* dictionary pack.
|
||||
*/
|
||||
public class LocaleUtils {
|
||||
|
||||
private final static String TAG = LocaleUtils.class.getSimpleName();
|
||||
|
||||
private LocaleUtils() {
|
||||
// Intentional empty constructor for utility class.
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class SynchronouslyLoadedUserDictionary extends UserDictionary {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getWords(final WordComposer codes, final WordCallback callback,
|
||||
public synchronized void getWords(final WordComposer codes, final WordCallback callback,
|
||||
final ProximityInfo proximityInfo) {
|
||||
blockingReloadDictionaryIfRequired();
|
||||
getWordsInner(codes, callback, proximityInfo);
|
||||
|
|
|
@ -104,12 +104,12 @@ public class UserBigramDictionary extends ExpandableDictionary {
|
|||
private static class Bigram {
|
||||
public final String mWord1;
|
||||
public final String mWord2;
|
||||
public final int frequency;
|
||||
public final int mFrequency;
|
||||
|
||||
Bigram(String word1, String word2, int frequency) {
|
||||
this.mWord1 = word1;
|
||||
this.mWord2 = word2;
|
||||
this.frequency = frequency;
|
||||
this.mFrequency = frequency;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -190,7 +190,7 @@ public class UserBigramDictionary extends ExpandableDictionary {
|
|||
// Nothing pending? Return
|
||||
if (mPendingWrites.isEmpty()) return;
|
||||
// Create a background thread to write the pending entries
|
||||
new UpdateDbTask(getContext(), sOpenHelper, mPendingWrites, mLocale).execute();
|
||||
new UpdateDbTask(sOpenHelper, mPendingWrites, mLocale).execute();
|
||||
// Create a new map for writing new entries into while the old one is written to db
|
||||
mPendingWrites = new HashSet<Bigram>();
|
||||
}
|
||||
|
@ -302,8 +302,8 @@ public class UserBigramDictionary extends ExpandableDictionary {
|
|||
private final DatabaseHelper mDbHelper;
|
||||
private final String mLocale;
|
||||
|
||||
public UpdateDbTask(Context context, DatabaseHelper openHelper,
|
||||
HashSet<Bigram> pendingWrites, String locale) {
|
||||
public UpdateDbTask(DatabaseHelper openHelper, HashSet<Bigram> pendingWrites,
|
||||
String locale) {
|
||||
mMap = pendingWrites;
|
||||
mLocale = locale;
|
||||
mDbHelper = openHelper;
|
||||
|
@ -372,7 +372,7 @@ public class UserBigramDictionary extends ExpandableDictionary {
|
|||
c.close();
|
||||
|
||||
// insert new frequency
|
||||
db.insert(FREQ_TABLE_NAME, null, getFrequencyContentValues(pairId, bi.frequency));
|
||||
db.insert(FREQ_TABLE_NAME, null, getFrequencyContentValues(pairId, bi.mFrequency));
|
||||
}
|
||||
checkPruneData(db);
|
||||
sUpdatingDB = false;
|
||||
|
|
|
@ -19,14 +19,12 @@ package com.android.inputmethod.latin.spellcheck;
|
|||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.service.textservice.SpellCheckerService;
|
||||
import android.service.textservice.SpellCheckerService.Session;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.textservice.SuggestionsInfo;
|
||||
import android.view.textservice.TextInfo;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.inputmethod.compat.ArraysCompatUtils;
|
||||
import com.android.inputmethod.keyboard.Key;
|
||||
import com.android.inputmethod.keyboard.ProximityInfo;
|
||||
import com.android.inputmethod.latin.BinaryDictionary;
|
||||
import com.android.inputmethod.latin.Dictionary;
|
||||
|
@ -38,7 +36,6 @@ import com.android.inputmethod.latin.Flag;
|
|||
import com.android.inputmethod.latin.LocaleUtils;
|
||||
import com.android.inputmethod.latin.R;
|
||||
import com.android.inputmethod.latin.SynchronouslyLoadedUserDictionary;
|
||||
import com.android.inputmethod.latin.UserDictionary;
|
||||
import com.android.inputmethod.latin.Utils;
|
||||
import com.android.inputmethod.latin.WordComposer;
|
||||
|
||||
|
@ -111,7 +108,6 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
|
|||
}
|
||||
}
|
||||
|
||||
private final int DEFAULT_SUGGESTION_LENGTH = 16;
|
||||
private final ArrayList<CharSequence> mSuggestions;
|
||||
private final int[] mScores;
|
||||
private final String mOriginalText;
|
||||
|
|
|
@ -16,14 +16,13 @@
|
|||
|
||||
package com.android.inputmethod.latin.spellcheck;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
/**
|
||||
* A blocking queue that creates dictionaries up to a certain limit as necessary.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class DictionaryPool extends LinkedBlockingQueue<DictAndProximity> {
|
||||
private final AndroidSpellCheckerService mService;
|
||||
private final int mMaxSize;
|
||||
|
|
|
@ -19,7 +19,6 @@ package com.android.inputmethod.latin.spellcheck;
|
|||
import com.android.inputmethod.keyboard.KeyDetector;
|
||||
import com.android.inputmethod.keyboard.ProximityInfo;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class SpellCheckerProximityInfo {
|
||||
|
|
|
@ -16,14 +16,10 @@
|
|||
|
||||
package com.android.inputmethod.latin.spellcheck;
|
||||
|
||||
import com.android.inputmethod.latin.R;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Spell checker preference screen.
|
||||
*/
|
||||
|
|
|
@ -16,17 +16,15 @@
|
|||
|
||||
package com.android.inputmethod.latin.spellcheck;
|
||||
|
||||
import com.android.inputmethod.latin.R;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceFragment;
|
||||
|
||||
import com.android.inputmethod.latin.R;
|
||||
|
||||
/**
|
||||
* Preference screen.
|
||||
*/
|
||||
public class SpellCheckerSettingsFragment extends PreferenceFragment {
|
||||
private static final String TAG = SpellCheckerSettingsFragment.class.getSimpleName();
|
||||
|
||||
/**
|
||||
* Empty constructor for fragment generation.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue