1
0
Fork 0

Cleaned up some code, attempted fix for UI staying

* Also changed manifest to filter non hardware keyboard devices.
This commit is contained in:
Clam 2014-03-01 23:57:05 +11:00
parent e08e27c903
commit cbb7561506
12 changed files with 149 additions and 216 deletions

View file

@ -11,6 +11,12 @@
<uses-configuration
android:reqFiveWayNav="true"
android:reqHardKeyboard="true"
android:reqKeyboardType="qwerty"
/>
<uses-configuration
android:reqFiveWayNav="true"
android:reqKeyboardType="twelvekey"
android:reqHardKeyboard="true"
/>
<application
android:allowBackup="false"

View file

@ -2,6 +2,7 @@ package org.nyanya.android.traditionalt9;
import android.app.Dialog;
import android.content.Context;
import android.inputmethodservice.KeyboardView;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
@ -14,7 +15,7 @@ import java.util.Arrays;
public abstract class AbsSymDialog extends Dialog implements
View.OnClickListener {
private TraditionalT9 parent;
private KeyboardView.OnKeyboardActionListener parent;
private View mainview;
private int pagenum = 1;
private int pageoffset = (pagenum - 1) * 10;
@ -36,18 +37,18 @@ public abstract class AbsSymDialog extends Dialog implements
public AbsSymDialog(Context c, View mv) {
super(c);
parent = (TraditionalT9) c;
parent = (KeyboardView.OnKeyboardActionListener) c;
mainview = mv;
started = true;
setContentView(mv);
View button;
for (int x = 0; x < buttons.length; x++) {
button = mv.findViewById(buttons[x]);
for (int butt : buttons) {
button = mv.findViewById(butt);
button.setOnClickListener(this);
}
for (int x = 0; x < buttons2.length; x++) {
button = mv.findViewById(buttons2[x]);
for (int butt : buttons2) {
button = mv.findViewById(butt);
button.setOnClickListener(this);
}
MAX_PAGE = getMaxPage();
@ -59,7 +60,7 @@ public abstract class AbsSymDialog extends Dialog implements
// Log.d("SymbolPopup - onClick", "click happen: " + v);
switch (v.getId()) {
case R.id.text_keyone:
sendChar(pageoffset + 0);
sendChar(pageoffset);
break;
case R.id.text_keytwo:
sendChar(pageoffset + 1);
@ -234,7 +235,7 @@ public abstract class AbsSymDialog extends Dialog implements
// HANDLE SPECIAL KEYS
switch (keyCode) {
case KeyEvent.KEYCODE_1:
sendChar(pageoffset + 0);
sendChar(pageoffset);
break;
case KeyEvent.KEYCODE_2:
sendChar(pageoffset + 1);

View file

@ -11,7 +11,6 @@ import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
public class AddWordAct extends Activity {
@ -63,12 +62,6 @@ public class AddWordAct extends Activity {
}
});
AlertDialog dialog = builder.create();
// Window win = dialog.getWindow();
// WindowManager.LayoutParams lp = win.getAttributes();
// lp.token = getWindow().getWindow().getDecorView().getWindowToken();
// lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
// win.setAttributes(lp);
// win.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
dialog.show();
}
SharedPreferences.Editor prefedit = pref.edit();

View file

@ -3,8 +3,6 @@ package org.nyanya.android.traditionalt9;
import java.util.ArrayList;
import java.util.List;
import org.nyanya.android.traditionalt9.R;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
@ -15,7 +13,6 @@ import android.view.View;
public class CandidateView extends View {
// private TraditionalT9 mService;
private List<String> mSuggestions;
protected int mSelectedIndex;
@ -179,7 +176,7 @@ public class CandidateView extends View {
invalidate();
}
public void setSuggestions(List<String> suggestions, int initialSel) {
protected void setSuggestions(List<String> suggestions, int initialSel) {
clear();
if (suggestions != null) {
mSuggestions = suggestions;
@ -193,7 +190,7 @@ public class CandidateView extends View {
requestLayout();
}
public void clear() {
protected void clear() {
mSuggestions = EMPTY_LIST;
mSelectedIndex = -1;
invalidate();

View file

@ -1,15 +1,15 @@
package org.nyanya.android.traditionalt9;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import android.util.Log;
public class CharMap {
protected static final ArrayList<Map<Character, Integer>> CHARTABLE = new ArrayList<Map<Character, Integer>>(2);
protected static final AbstractList<Map<Character, Integer>> CHARTABLE = new ArrayList<Map<Character, Integer>>(2);
static {
Map<Character, Integer> enMap = new HashMap<Character, Integer>();
enMap.put('.', 1); enMap.put(',', 1); enMap.put('!', 1); enMap.put('?', 1);

View file

@ -3,19 +3,8 @@ package org.nyanya.android.traditionalt9;
public class DBException extends Exception {
private static final long serialVersionUID = 376752656441823823L;
public DBException() {
super();
}
public DBException(String message) {
protected DBException(String message) {
super(message);
}
public DBException(String message, Throwable cause) {
super(message, cause);
}
public DBException(Throwable cause) {
super(cause);
}
}

View file

@ -24,18 +24,12 @@ public class InterfaceHandler implements View.OnClickListener, View.OnLongClickL
return mainview;
}
protected void clearParent() {
ViewGroup vg = ((ViewGroup) mainview.getParent());
if (vg != null) {
vg.removeView(mainview);
}
}
protected void changeView(View v) {
this.mainview = v;
View button;
for (int x = 0; x < buttons.length; x++) {
button = v.findViewById(buttons[x]);
for (int buttid : buttons) {
button = v.findViewById(buttid);
button.setOnClickListener(this);
if (!parent.mAddingWord) {
button.setOnLongClickListener(this);
@ -81,9 +75,9 @@ public class InterfaceHandler implements View.OnClickListener, View.OnLongClickL
protected void midButtonUpdate(boolean composing) {
if (composing) {
((Button) mainview.findViewById(R.id.main_mid)).setText(R.string.main_mid_commit);
((TextView) mainview.findViewById(R.id.main_mid)).setText(R.string.main_mid_commit);
} else {
((Button) mainview.findViewById(R.id.main_mid)).setText(R.string.main_mid);
((TextView) mainview.findViewById(R.id.main_mid)).setText(R.string.main_mid);
}
}
@ -133,4 +127,8 @@ public class InterfaceHandler implements View.OnClickListener, View.OnLongClickL
}
return true;
}
protected void hideView() {
mainview.setVisibility(View.GONE);
}
}

View file

@ -2,6 +2,8 @@ package org.nyanya.android.traditionalt9;
import java.util.Locale;
import pl.wavesoftware.widget.MultiSelectListPreference;
public class LangHelper {
protected static final Locale RUSSIAN = new Locale("ru","RU");
protected static final int EN = 0;
@ -31,4 +33,24 @@ public class LangHelper {
{R.drawable.ime_number}, //NUM
}
};
protected static int[] buildLangs(CharSequence s) {
int[] ia = MultiSelectListPreference.defaultunpack2Int(s);
int num = 0;
//calc size of filtered array
for (int i : ia) {
if (i >= 0 && i < LangHelper.NLANGS) {
num++;
}
}
int[] ian = new int[num];
int iansize = 0;
for (int i : ia) {
if (i >= 0 && i < LangHelper.NLANGS) {
ian[iansize] = i;
iansize++;
}
}
return ian;
}
}

View file

@ -1,13 +1,10 @@
package org.nyanya.android.traditionalt9;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.AbstractList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Locale;
import java.util.List;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
@ -62,7 +59,7 @@ public class T9DB {
mOpenHelper = new DatabaseHelper(caller);
}
public static T9DB getInstance(Context caller) {
protected static T9DB getInstance(Context caller) {
if (instance == null) {
synchronized (T9DB.class){
if (instance == null) {
@ -74,7 +71,7 @@ public class T9DB {
return instance;
}
public static SQLiteDatabase getSQLDB(Context caller) {
protected static SQLiteDatabase getSQLDB(Context caller) {
T9DB t9dbhelper = getInstance(caller);
//Log.d("T9DB.getSQLDB", "db:" + t9dbhelper.db.isOpen());
return t9dbhelper.db;
@ -88,7 +85,7 @@ public class T9DB {
if (db != null) {
try {
db.close();
} catch (NullPointerException e) { }
} catch (NullPointerException ignored) { }
db = null;
}
Intent intent = new Intent(mContext, DBUpdateService.class);
@ -122,13 +119,13 @@ public class T9DB {
}
}
public void close() {
protected void close() {
try { db.close(); }
catch (NullPointerException e) { }
catch (NullPointerException ignored) { }
db = null;
}
public void nuke() {
protected void nuke() {
Log.i("T9DB.nuke", "Deleting database...");
synchronized (T9DB.class){
if (db != null) {
@ -147,7 +144,7 @@ public class T9DB {
Log.i("T9DB.nuke", "Done...");
}
public void addWord(String iword, int lang) throws DBException {
protected void addWord(String iword, int lang) throws DBException {
Resources r = mContext.getResources();
if (iword.equals("")) {
throw new DBException(r.getString(R.string.add_word_blank));
@ -180,7 +177,7 @@ public class T9DB {
}
}
public void incrementWord(int id) {
protected void incrementWord(int id) {
if (!checkReady()) {
Log.e("T9DB.incrementWord", "not ready");
Toast.makeText(mContext, R.string.database_notready, Toast.LENGTH_SHORT).show();
@ -234,7 +231,7 @@ public class T9DB {
return result;
}
public void updateWords(String is, ArrayList<String> stringList, ArrayList<Integer> intList,
protected void updateWords(String is, AbstractList<String> stringList, List<Integer> intList,
int capsMode, int lang) {
stringList.clear();
intList.clear();
@ -333,11 +330,10 @@ public class T9DB {
}
}
//Log.d("T9DB.updateWords", "i:" + is + " words:" + Arrays.toString(stringList.toArray()));
return;
}
protected void updateWordsW(String is, ArrayList<String> stringList,
ArrayList<Integer> intList, ArrayList<Integer> freq, int lang) {
protected void updateWordsW(String is, Collection<String> stringList,
Collection<Integer> intList, Collection<Integer> freq, int lang) {
stringList.clear();
intList.clear();
freq.clear();
@ -386,7 +382,6 @@ public class T9DB {
}
cur.close();
}
return;
}
private static class DatabaseHelper extends SQLiteOpenHelper {
@ -405,12 +400,7 @@ public class T9DB {
SQLiteDatabase db = mContext.openOrCreateDatabase(DATABASE_NAME, 0, null);
int version = db.getVersion();
db.close();
if (version < DATABASE_VERSION) {
return true;
}
else {
return false;
}
return version < DATABASE_VERSION;
} else {
return false;
}

View file

@ -1,10 +1,10 @@
package org.nyanya.android.traditionalt9;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
@ -17,11 +17,9 @@ import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.CompletionInfo;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
import pl.wavesoftware.widget.MultiSelectListPreference;
@ -37,7 +35,7 @@ public class TraditionalT9 extends InputMethodService implements
private ArrayList<String> mSuggestionStrings = new ArrayList<String>(10);
private ArrayList<Integer> mSuggestionInts = new ArrayList<Integer>(10);
private ArrayList<String> mSuggestionSym = new ArrayList<String>(16);
private AbstractList<String> mSuggestionSym = new ArrayList<String>(16);
private static final int NON_EDIT = 0;
private static final int EDITING = 1;
@ -103,7 +101,7 @@ public class TraditionalT9 extends InputMethodService implements
db = T9DB.getInstance(this);
pref = PreferenceManager.getDefaultSharedPreferences(this);
buildLangs();
mLangsAvailable = LangHelper.buildLangs(pref.getString("pref_lang_support", null));
if (interfacehandler == null) {
interfacehandler = new InterfaceHandler(getLayoutInflater().inflate(R.layout.mainview,
@ -111,31 +109,6 @@ public class TraditionalT9 extends InputMethodService implements
}
}
//build and filter Langs
private void buildLangs() {
int[] ia = MultiSelectListPreference.defaultunpack2Int(pref.getString("pref_lang_support", null));
int num = 0;
int i;
//calc size of filtered array
for (int x=0; x<ia.length; x++) {
i = ia[x];
if (i >= 0 && i < LangHelper.NLANGS) {
num++;
}
}
int[] ian = new int[num];
int iansize = 0;
for (int x=0; x<ia.length; x++) {
i = ia[x];
if (i >= 0 && i < LangHelper.NLANGS) {
ian[iansize] = i;
iansize++;
}
}
mLangsAvailable = ian;
}
@Override
public boolean onEvaluateInputViewShown() {
if (mEditing == EDITING_NOSHOW) {
@ -256,6 +229,9 @@ public class TraditionalT9 extends InputMethodService implements
mEditing = NON_EDIT;
requestHideSelf(0);
hideStatusIcon();
if (interfacehandler != null) {
interfacehandler.hideView();
}
return;
}
mFirstPress = true;
@ -265,7 +241,7 @@ public class TraditionalT9 extends InputMethodService implements
// way.
clearState();
buildLangs();
mLangsAvailable = LangHelper.buildLangs(pref.getString("pref_lang_support", null));
mLang = sanitizeLang(pref.getInt("last_lang", 0));
updateCandidates();
@ -547,11 +523,7 @@ public class TraditionalT9 extends InputMethodService implements
// but we will manage it ourselves because native Android handling
// of the input view is ... flakey at best.
// Log.d("onKeyDown", "back pres");
if (isInputViewShown()) {
// Log.d("inKeyDown", "input shown");
return true;
}
return false;
return isInputViewShown();
case KeyEvent.KEYCODE_ENTER:
// Let the underlying text editor always handle these.
@ -817,7 +789,7 @@ public class TraditionalT9 extends InputMethodService implements
// Log.d("updateShift", "CM start: " + mCapsMode);
if (attr != null && mCapsMode != CAPS_ALL) {
int caps = 0;
if (attr != null && attr.inputType != InputType.TYPE_NULL) {
if (attr.inputType != InputType.TYPE_NULL) {
caps = getCurrentInputConnection().getCursorCapsMode(attr.inputType);
}
// mInputView.setShifted(mCapsLock || caps != 0);
@ -1011,8 +983,8 @@ public class TraditionalT9 extends InputMethodService implements
if (mComposing.length() > 0) {
mSuggestionStrings.clear();
char[] ca = CharMap.T9TABLE[mLang][mPrevious];
for (int i = 0; i < ca.length; i++) {
mSuggestionStrings.add(String.valueOf(ca[i]));
for (char c : ca) {
mSuggestionStrings.add(String.valueOf(c));
}
setSuggestions(mSuggestionStrings, mCharIndex);
} else {
@ -1355,7 +1327,7 @@ public class TraditionalT9 extends InputMethodService implements
pickSuggestionManually(-1, ic);
}
public void pickSuggestionManually(int index, InputConnection ic) {
private void pickSuggestionManually(int index, InputConnection ic) {
// Log.d("pickSuggestMan", "Doing");
if (mComposing.length() > 0 || mComposingI.length() > 0) {
// If we were generating candidate suggestions for the current

View file

@ -1,5 +1,10 @@
package org.nyanya.android.traditionalt9;
/*
Source for English dictionary: http://wordlist.sourceforge.net/
Source for Russian dictionary: Various sources from Russian user
*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
@ -13,8 +18,8 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@ -22,6 +27,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
@ -37,6 +43,7 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.os.SystemClock;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
@ -67,18 +74,6 @@ public class TraditionalT9Settings extends PreferenceActivity implements
public LoadException() {
super();
}
public LoadException(String message) {
super(message);
}
public LoadException(String message, Throwable cause) {
super(message, cause);
}
public LoadException(Throwable cause) {
super(cause);
}
}
private class Reply {
@ -104,9 +99,7 @@ public class TraditionalT9Settings extends PreferenceActivity implements
}
private void finishAndShowError(ProgressDialog pd, Reply result, int title){
if (pd == null) {
// Log.d("onPostExecute", "pd");
} else {
if (pd != null) {
// Log.d("onPostExecute", "pd");
if (pd.isShowing()) {
pd.dismiss();
@ -124,53 +117,6 @@ public class TraditionalT9Settings extends PreferenceActivity implements
}
}
private long getDictSizes(boolean internal, boolean restore, String[] dicts) {
if (internal) {
InputStream input;
Properties props = new Properties();
try {
input = getAssets().open("dict.properties");
props.load(input);
long total = 0;
for (int x=0; x<dicts.length; x++) {
total = total + Long.parseLong(props.getProperty("size." + dicts[x]));
}
return total;
} catch (IOException e) {
Log.e("getDictSizes", "Unable to get dict sizes");
e.printStackTrace();
return -1;
} catch (NumberFormatException e) {
Log.e("getDictSizes", "Unable to parse sizes");
return -1;
}
} else {
File backupfile = new File(Environment.getExternalStorageDirectory(), sddir);
if (restore) {
// using external backup
backupfile = new File(backupfile, backupname);
if (backupfile.exists() && backupfile.isFile()) {
return backupfile.length();
} else {
return -1;
}
} else {
long total = 0;
File f;
for (int x=0; x<dicts.length; x++) {
f = new File(backupfile, dicts[x]);
if (f.exists() && f.isFile()) {
total = total + f.length();
} else {
total = total + 0;
}
}
return total;
}
}
}
private void closeStream(Closeable is, Reply reply) {
if (is == null) {
return;
@ -218,6 +164,53 @@ public class TraditionalT9Settings extends PreferenceActivity implements
pd.setOnCancelListener(TraditionalT9Settings.this);
}
private long getDictSizes(boolean internal, boolean restore, String[] dicts) {
if (internal) {
InputStream input;
Properties props = new Properties();
try {
input = getAssets().open("dict.properties");
props.load(input);
long total = 0;
for (String dict : dicts) {
total += Long.parseLong(props.getProperty("size." + dict));
}
return total;
} catch (IOException e) {
Log.e("getDictSizes", "Unable to get dict sizes");
e.printStackTrace();
return -1;
} catch (NumberFormatException e) {
Log.e("getDictSizes", "Unable to parse sizes");
return -1;
}
} else {
File backupfile = new File(Environment.getExternalStorageDirectory(), sddir);
if (restore) {
// using external backup
backupfile = new File(backupfile, backupname);
if (backupfile.exists() && backupfile.isFile()) {
return backupfile.length();
} else {
return -1;
}
} else {
long total = 0;
File f;
for (String dict : dicts) {
f = new File(backupfile, dict);
if (f.exists() && f.isFile()) {
total = total + f.length();
} else {
total = total + 0;
}
}
return total;
}
}
}
@Override protected void onPreExecute() {
size = getDictSizes(internal, restore, dicts);
pos = 0;
@ -248,8 +241,8 @@ public class TraditionalT9Settings extends PreferenceActivity implements
// add characters first, then dictionary:
Log.d("doInBackground", "Adding characters...");
// load characters from supported langs
for (int x=0; x<mSupportedLanguages.length; x++) {
processChars(reply, db, mSupportedLanguages[x]);
for (int lang : mSupportedLanguages) {
processChars(db, lang);
}
Log.d("doInBackground", "done.");
@ -296,7 +289,7 @@ public class TraditionalT9Settings extends PreferenceActivity implements
reply.forceMsg("File not found: " + e.getMessage());
final String msg = mContext.getString(R.string.pref_loaduser_notfound, dicts[x]);
//Log.d("T9Setting.load", "Built string. Calling Toast.");
((PreferenceActivity) mContext).runOnUiThread(new Runnable() {
((Activity) mContext).runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(mContext,
@ -326,7 +319,7 @@ public class TraditionalT9Settings extends PreferenceActivity implements
return reply;
}
private void processChars(Reply rpl, SQLiteDatabase db, int lang) {
private void processChars(SQLiteDatabase db, int lang) {
InsertHelper wordhelp = new InsertHelper(db, T9DB.WORD_TABLE_NAME);
final int wordColumn = wordhelp.getColumnIndex(T9DB.COLUMN_WORD);
@ -526,8 +519,6 @@ public class TraditionalT9Settings extends PreferenceActivity implements
} catch (FileNotFoundException e) {
reply.status = false;
reply.forceMsg("Backup file error: " + e.getMessage());
closeStream(dictstream, reply); // this is silly but it stops
// IDE nagging at me.
return reply;
}
@ -754,30 +745,6 @@ public class TraditionalT9Settings extends PreferenceActivity implements
mContext = this;
}
//build and filter Langs. (This should be refactored to a common method for base T9 module, too.
private int[] buildLangs(String s) {
int[] ia = MultiSelectListPreference.defaultunpack2Int(s);
int num = 0;
int i;
//calc size of filtered array
for (int x=0; x<ia.length; x++) {
i = ia[x];
if (i >= 0 && i < LangHelper.NLANGS) {
num++;
}
}
int[] ian = new int[num];
int iansize = 0;
for (int x=0; x<ia.length; x++) {
i = ia[x];
if (i >= 0 && i < LangHelper.NLANGS) {
ian[iansize] = i;
iansize++;
}
}
return ian;
}
private void openHelp() {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(getString(R.string.help_url)));
@ -788,7 +755,7 @@ public class TraditionalT9Settings extends PreferenceActivity implements
private void preloader(int msgid, boolean internal, boolean restorebackup) {
task = new LoadDictTask(msgid, internal, restorebackup,
buildLangs(((MultiSelectListPreference) findPreference("pref_lang_support")).getValue()));
LangHelper.buildLangs(((ListPreference) findPreference("pref_lang_support")).getValue()));
task.execute();
}
@ -797,18 +764,14 @@ public class TraditionalT9Settings extends PreferenceActivity implements
task.execute();
}
private void prenuke(int msgid) {
task = new NukeDictTask(msgid);
task.execute();
}
private void nukeDict() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.pref_nuke_warn).setTitle(R.string.pref_nuke_title)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
prenuke(R.string.pref_nukingdict);
task = new NukeDictTask(R.string.pref_nukingdict);
task.execute();
}
}).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
@ -856,11 +819,11 @@ public class TraditionalT9Settings extends PreferenceActivity implements
}
}
private void showErrorDialog(String title, String msg) {
private void showErrorDialog(CharSequence title, CharSequence msg) {
showErrorDialog(new AlertDialog.Builder(this), title, msg);
}
private void showErrorDialog(AlertDialog.Builder builder, String title, String msg) {
private void showErrorDialog(AlertDialog.Builder builder, CharSequence title, CharSequence msg) {
builder.setMessage(msg).setTitle(title)
.setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
@ -923,8 +886,8 @@ public class TraditionalT9Settings extends PreferenceActivity implements
@SuppressWarnings("unused")
private void queryTestDebug() {
long startnow, endnow;
ArrayList<String> words = new ArrayList<String>();
ArrayList<Integer> ids = new ArrayList<Integer>();
AbstractList<String> words = new ArrayList<String>();
List<Integer> ids = new ArrayList<Integer>();
startnow = SystemClock.uptimeMillis();
@ -968,10 +931,11 @@ public class TraditionalT9Settings extends PreferenceActivity implements
Log.d("TIMING", "Execution time: " + (endnow - startnow) + " ms");
}
@SuppressWarnings("unused")
private void queryTestSingle() {
long startnow, endnow;
int size;
ArrayList<String> words = new ArrayList<String>(8);
AbstractList<String> words = new ArrayList<String>(8);
ArrayList<Integer> ids = new ArrayList<Integer>(8);
startnow = SystemClock.uptimeMillis();
@ -992,7 +956,7 @@ public class TraditionalT9Settings extends PreferenceActivity implements
endnow = SystemClock.uptimeMillis();
Log.d("TIMING", "Execution time: " + (endnow - startnow) + " ms");
ArrayList<Integer> freqs = new ArrayList<Integer>(8);
List<Integer> freqs = new ArrayList<Integer>(8);
tdb.updateWordsW("222", words, ids, freqs, LangHelper.EN);
Log.d("VALUES", "...");
size = freqs.size();

View file

@ -3,7 +3,8 @@ package org.nyanya.android.traditionalt9;
import android.text.InputType;
import android.util.Log;
public class Utils {
@SuppressWarnings("unused")
class Utils {
public static void printFlags(int inputType) {
if ((inputType & InputType.TYPE_CLASS_DATETIME) == InputType.TYPE_CLASS_DATETIME)