Cleaned up some code, attempted fix for UI staying
* Also changed manifest to filter non hardware keyboard devices.
This commit is contained in:
parent
e08e27c903
commit
cbb7561506
12 changed files with 149 additions and 216 deletions
|
|
@ -11,6 +11,12 @@
|
||||||
<uses-configuration
|
<uses-configuration
|
||||||
android:reqFiveWayNav="true"
|
android:reqFiveWayNav="true"
|
||||||
android:reqHardKeyboard="true"
|
android:reqHardKeyboard="true"
|
||||||
|
android:reqKeyboardType="qwerty"
|
||||||
|
/>
|
||||||
|
<uses-configuration
|
||||||
|
android:reqFiveWayNav="true"
|
||||||
|
android:reqKeyboardType="twelvekey"
|
||||||
|
android:reqHardKeyboard="true"
|
||||||
/>
|
/>
|
||||||
<application
|
<application
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package org.nyanya.android.traditionalt9;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.inputmethodservice.KeyboardView;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
@ -14,7 +15,7 @@ import java.util.Arrays;
|
||||||
public abstract class AbsSymDialog extends Dialog implements
|
public abstract class AbsSymDialog extends Dialog implements
|
||||||
View.OnClickListener {
|
View.OnClickListener {
|
||||||
|
|
||||||
private TraditionalT9 parent;
|
private KeyboardView.OnKeyboardActionListener parent;
|
||||||
private View mainview;
|
private View mainview;
|
||||||
private int pagenum = 1;
|
private int pagenum = 1;
|
||||||
private int pageoffset = (pagenum - 1) * 10;
|
private int pageoffset = (pagenum - 1) * 10;
|
||||||
|
|
@ -36,18 +37,18 @@ public abstract class AbsSymDialog extends Dialog implements
|
||||||
|
|
||||||
public AbsSymDialog(Context c, View mv) {
|
public AbsSymDialog(Context c, View mv) {
|
||||||
super(c);
|
super(c);
|
||||||
parent = (TraditionalT9) c;
|
parent = (KeyboardView.OnKeyboardActionListener) c;
|
||||||
mainview = mv;
|
mainview = mv;
|
||||||
started = true;
|
started = true;
|
||||||
setContentView(mv);
|
setContentView(mv);
|
||||||
|
|
||||||
View button;
|
View button;
|
||||||
for (int x = 0; x < buttons.length; x++) {
|
for (int butt : buttons) {
|
||||||
button = mv.findViewById(buttons[x]);
|
button = mv.findViewById(butt);
|
||||||
button.setOnClickListener(this);
|
button.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
for (int x = 0; x < buttons2.length; x++) {
|
for (int butt : buttons2) {
|
||||||
button = mv.findViewById(buttons2[x]);
|
button = mv.findViewById(butt);
|
||||||
button.setOnClickListener(this);
|
button.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
MAX_PAGE = getMaxPage();
|
MAX_PAGE = getMaxPage();
|
||||||
|
|
@ -59,7 +60,7 @@ public abstract class AbsSymDialog extends Dialog implements
|
||||||
// Log.d("SymbolPopup - onClick", "click happen: " + v);
|
// Log.d("SymbolPopup - onClick", "click happen: " + v);
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.text_keyone:
|
case R.id.text_keyone:
|
||||||
sendChar(pageoffset + 0);
|
sendChar(pageoffset);
|
||||||
break;
|
break;
|
||||||
case R.id.text_keytwo:
|
case R.id.text_keytwo:
|
||||||
sendChar(pageoffset + 1);
|
sendChar(pageoffset + 1);
|
||||||
|
|
@ -234,7 +235,7 @@ public abstract class AbsSymDialog extends Dialog implements
|
||||||
// HANDLE SPECIAL KEYS
|
// HANDLE SPECIAL KEYS
|
||||||
switch (keyCode) {
|
switch (keyCode) {
|
||||||
case KeyEvent.KEYCODE_1:
|
case KeyEvent.KEYCODE_1:
|
||||||
sendChar(pageoffset + 0);
|
sendChar(pageoffset);
|
||||||
break;
|
break;
|
||||||
case KeyEvent.KEYCODE_2:
|
case KeyEvent.KEYCODE_2:
|
||||||
sendChar(pageoffset + 1);
|
sendChar(pageoffset + 1);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
public class AddWordAct extends Activity {
|
public class AddWordAct extends Activity {
|
||||||
|
|
||||||
|
|
@ -63,12 +62,6 @@ public class AddWordAct extends Activity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
AlertDialog dialog = builder.create();
|
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();
|
dialog.show();
|
||||||
}
|
}
|
||||||
SharedPreferences.Editor prefedit = pref.edit();
|
SharedPreferences.Editor prefedit = pref.edit();
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@ package org.nyanya.android.traditionalt9;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.nyanya.android.traditionalt9.R;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
|
@ -15,7 +13,6 @@ import android.view.View;
|
||||||
|
|
||||||
public class CandidateView extends View {
|
public class CandidateView extends View {
|
||||||
|
|
||||||
// private TraditionalT9 mService;
|
|
||||||
private List<String> mSuggestions;
|
private List<String> mSuggestions;
|
||||||
protected int mSelectedIndex;
|
protected int mSelectedIndex;
|
||||||
|
|
||||||
|
|
@ -179,7 +176,7 @@ public class CandidateView extends View {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSuggestions(List<String> suggestions, int initialSel) {
|
protected void setSuggestions(List<String> suggestions, int initialSel) {
|
||||||
clear();
|
clear();
|
||||||
if (suggestions != null) {
|
if (suggestions != null) {
|
||||||
mSuggestions = suggestions;
|
mSuggestions = suggestions;
|
||||||
|
|
@ -193,7 +190,7 @@ public class CandidateView extends View {
|
||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
protected void clear() {
|
||||||
mSuggestions = EMPTY_LIST;
|
mSuggestions = EMPTY_LIST;
|
||||||
mSelectedIndex = -1;
|
mSelectedIndex = -1;
|
||||||
invalidate();
|
invalidate();
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
package org.nyanya.android.traditionalt9;
|
package org.nyanya.android.traditionalt9;
|
||||||
|
|
||||||
|
import java.util.AbstractList;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class CharMap {
|
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 {
|
static {
|
||||||
Map<Character, Integer> enMap = new HashMap<Character, Integer>();
|
Map<Character, Integer> enMap = new HashMap<Character, Integer>();
|
||||||
enMap.put('.', 1); enMap.put(',', 1); enMap.put('!', 1); enMap.put('?', 1);
|
enMap.put('.', 1); enMap.put(',', 1); enMap.put('!', 1); enMap.put('?', 1);
|
||||||
|
|
|
||||||
|
|
@ -3,19 +3,8 @@ package org.nyanya.android.traditionalt9;
|
||||||
public class DBException extends Exception {
|
public class DBException extends Exception {
|
||||||
private static final long serialVersionUID = 376752656441823823L;
|
private static final long serialVersionUID = 376752656441823823L;
|
||||||
|
|
||||||
public DBException() {
|
protected DBException(String message) {
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public DBException(String message) {
|
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DBException(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DBException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,18 +24,12 @@ public class InterfaceHandler implements View.OnClickListener, View.OnLongClickL
|
||||||
return mainview;
|
return mainview;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void clearParent() {
|
|
||||||
ViewGroup vg = ((ViewGroup) mainview.getParent());
|
|
||||||
if (vg != null) {
|
|
||||||
vg.removeView(mainview);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void changeView(View v) {
|
protected void changeView(View v) {
|
||||||
this.mainview = v;
|
this.mainview = v;
|
||||||
View button;
|
View button;
|
||||||
for (int x = 0; x < buttons.length; x++) {
|
for (int buttid : buttons) {
|
||||||
button = v.findViewById(buttons[x]);
|
button = v.findViewById(buttid);
|
||||||
button.setOnClickListener(this);
|
button.setOnClickListener(this);
|
||||||
if (!parent.mAddingWord) {
|
if (!parent.mAddingWord) {
|
||||||
button.setOnLongClickListener(this);
|
button.setOnLongClickListener(this);
|
||||||
|
|
@ -81,9 +75,9 @@ public class InterfaceHandler implements View.OnClickListener, View.OnLongClickL
|
||||||
|
|
||||||
protected void midButtonUpdate(boolean composing) {
|
protected void midButtonUpdate(boolean composing) {
|
||||||
if (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 {
|
} 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void hideView() {
|
||||||
|
mainview.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package org.nyanya.android.traditionalt9;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import pl.wavesoftware.widget.MultiSelectListPreference;
|
||||||
|
|
||||||
public class LangHelper {
|
public class LangHelper {
|
||||||
protected static final Locale RUSSIAN = new Locale("ru","RU");
|
protected static final Locale RUSSIAN = new Locale("ru","RU");
|
||||||
protected static final int EN = 0;
|
protected static final int EN = 0;
|
||||||
|
|
@ -31,4 +33,24 @@ public class LangHelper {
|
||||||
{R.drawable.ime_number}, //NUM
|
{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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,10 @@
|
||||||
package org.nyanya.android.traditionalt9;
|
package org.nyanya.android.traditionalt9;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.AbstractList;
|
||||||
import java.util.Arrays;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
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.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
@ -62,7 +59,7 @@ public class T9DB {
|
||||||
mOpenHelper = new DatabaseHelper(caller);
|
mOpenHelper = new DatabaseHelper(caller);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static T9DB getInstance(Context caller) {
|
protected static T9DB getInstance(Context caller) {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
synchronized (T9DB.class){
|
synchronized (T9DB.class){
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
|
|
@ -74,7 +71,7 @@ public class T9DB {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SQLiteDatabase getSQLDB(Context caller) {
|
protected static SQLiteDatabase getSQLDB(Context caller) {
|
||||||
T9DB t9dbhelper = getInstance(caller);
|
T9DB t9dbhelper = getInstance(caller);
|
||||||
//Log.d("T9DB.getSQLDB", "db:" + t9dbhelper.db.isOpen());
|
//Log.d("T9DB.getSQLDB", "db:" + t9dbhelper.db.isOpen());
|
||||||
return t9dbhelper.db;
|
return t9dbhelper.db;
|
||||||
|
|
@ -88,7 +85,7 @@ public class T9DB {
|
||||||
if (db != null) {
|
if (db != null) {
|
||||||
try {
|
try {
|
||||||
db.close();
|
db.close();
|
||||||
} catch (NullPointerException e) { }
|
} catch (NullPointerException ignored) { }
|
||||||
db = null;
|
db = null;
|
||||||
}
|
}
|
||||||
Intent intent = new Intent(mContext, DBUpdateService.class);
|
Intent intent = new Intent(mContext, DBUpdateService.class);
|
||||||
|
|
@ -122,13 +119,13 @@ public class T9DB {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
protected void close() {
|
||||||
try { db.close(); }
|
try { db.close(); }
|
||||||
catch (NullPointerException e) { }
|
catch (NullPointerException ignored) { }
|
||||||
db = null;
|
db = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void nuke() {
|
protected void nuke() {
|
||||||
Log.i("T9DB.nuke", "Deleting database...");
|
Log.i("T9DB.nuke", "Deleting database...");
|
||||||
synchronized (T9DB.class){
|
synchronized (T9DB.class){
|
||||||
if (db != null) {
|
if (db != null) {
|
||||||
|
|
@ -147,7 +144,7 @@ public class T9DB {
|
||||||
Log.i("T9DB.nuke", "Done...");
|
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();
|
Resources r = mContext.getResources();
|
||||||
if (iword.equals("")) {
|
if (iword.equals("")) {
|
||||||
throw new DBException(r.getString(R.string.add_word_blank));
|
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()) {
|
if (!checkReady()) {
|
||||||
Log.e("T9DB.incrementWord", "not ready");
|
Log.e("T9DB.incrementWord", "not ready");
|
||||||
Toast.makeText(mContext, R.string.database_notready, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mContext, R.string.database_notready, Toast.LENGTH_SHORT).show();
|
||||||
|
|
@ -234,7 +231,7 @@ public class T9DB {
|
||||||
return result;
|
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) {
|
int capsMode, int lang) {
|
||||||
stringList.clear();
|
stringList.clear();
|
||||||
intList.clear();
|
intList.clear();
|
||||||
|
|
@ -333,11 +330,10 @@ public class T9DB {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Log.d("T9DB.updateWords", "i:" + is + " words:" + Arrays.toString(stringList.toArray()));
|
//Log.d("T9DB.updateWords", "i:" + is + " words:" + Arrays.toString(stringList.toArray()));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateWordsW(String is, ArrayList<String> stringList,
|
protected void updateWordsW(String is, Collection<String> stringList,
|
||||||
ArrayList<Integer> intList, ArrayList<Integer> freq, int lang) {
|
Collection<Integer> intList, Collection<Integer> freq, int lang) {
|
||||||
stringList.clear();
|
stringList.clear();
|
||||||
intList.clear();
|
intList.clear();
|
||||||
freq.clear();
|
freq.clear();
|
||||||
|
|
@ -386,7 +382,6 @@ public class T9DB {
|
||||||
}
|
}
|
||||||
cur.close();
|
cur.close();
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class DatabaseHelper extends SQLiteOpenHelper {
|
private static class DatabaseHelper extends SQLiteOpenHelper {
|
||||||
|
|
@ -405,12 +400,7 @@ public class T9DB {
|
||||||
SQLiteDatabase db = mContext.openOrCreateDatabase(DATABASE_NAME, 0, null);
|
SQLiteDatabase db = mContext.openOrCreateDatabase(DATABASE_NAME, 0, null);
|
||||||
int version = db.getVersion();
|
int version = db.getVersion();
|
||||||
db.close();
|
db.close();
|
||||||
if (version < DATABASE_VERSION) {
|
return version < DATABASE_VERSION;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package org.nyanya.android.traditionalt9;
|
package org.nyanya.android.traditionalt9;
|
||||||
|
|
||||||
|
import java.util.AbstractList;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.Editor;
|
import android.content.SharedPreferences.Editor;
|
||||||
|
|
@ -17,11 +17,9 @@ import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.view.inputmethod.CompletionInfo;
|
import android.view.inputmethod.CompletionInfo;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.view.inputmethod.InputConnection;
|
import android.view.inputmethod.InputConnection;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import pl.wavesoftware.widget.MultiSelectListPreference;
|
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<String> mSuggestionStrings = new ArrayList<String>(10);
|
||||||
private ArrayList<Integer> mSuggestionInts = new ArrayList<Integer>(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 NON_EDIT = 0;
|
||||||
private static final int EDITING = 1;
|
private static final int EDITING = 1;
|
||||||
|
|
@ -103,7 +101,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
db = T9DB.getInstance(this);
|
db = T9DB.getInstance(this);
|
||||||
|
|
||||||
pref = PreferenceManager.getDefaultSharedPreferences(this);
|
pref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
buildLangs();
|
mLangsAvailable = LangHelper.buildLangs(pref.getString("pref_lang_support", null));
|
||||||
|
|
||||||
if (interfacehandler == null) {
|
if (interfacehandler == null) {
|
||||||
interfacehandler = new InterfaceHandler(getLayoutInflater().inflate(R.layout.mainview,
|
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
|
@Override
|
||||||
public boolean onEvaluateInputViewShown() {
|
public boolean onEvaluateInputViewShown() {
|
||||||
if (mEditing == EDITING_NOSHOW) {
|
if (mEditing == EDITING_NOSHOW) {
|
||||||
|
|
@ -256,6 +229,9 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
mEditing = NON_EDIT;
|
mEditing = NON_EDIT;
|
||||||
requestHideSelf(0);
|
requestHideSelf(0);
|
||||||
hideStatusIcon();
|
hideStatusIcon();
|
||||||
|
if (interfacehandler != null) {
|
||||||
|
interfacehandler.hideView();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mFirstPress = true;
|
mFirstPress = true;
|
||||||
|
|
@ -265,7 +241,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
// way.
|
// way.
|
||||||
clearState();
|
clearState();
|
||||||
|
|
||||||
buildLangs();
|
mLangsAvailable = LangHelper.buildLangs(pref.getString("pref_lang_support", null));
|
||||||
mLang = sanitizeLang(pref.getInt("last_lang", 0));
|
mLang = sanitizeLang(pref.getInt("last_lang", 0));
|
||||||
|
|
||||||
updateCandidates();
|
updateCandidates();
|
||||||
|
|
@ -547,11 +523,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
// but we will manage it ourselves because native Android handling
|
// but we will manage it ourselves because native Android handling
|
||||||
// of the input view is ... flakey at best.
|
// of the input view is ... flakey at best.
|
||||||
// Log.d("onKeyDown", "back pres");
|
// Log.d("onKeyDown", "back pres");
|
||||||
if (isInputViewShown()) {
|
return isInputViewShown();
|
||||||
// Log.d("inKeyDown", "input shown");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
|
|
||||||
case KeyEvent.KEYCODE_ENTER:
|
case KeyEvent.KEYCODE_ENTER:
|
||||||
// Let the underlying text editor always handle these.
|
// Let the underlying text editor always handle these.
|
||||||
|
|
@ -817,7 +789,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
// Log.d("updateShift", "CM start: " + mCapsMode);
|
// Log.d("updateShift", "CM start: " + mCapsMode);
|
||||||
if (attr != null && mCapsMode != CAPS_ALL) {
|
if (attr != null && mCapsMode != CAPS_ALL) {
|
||||||
int caps = 0;
|
int caps = 0;
|
||||||
if (attr != null && attr.inputType != InputType.TYPE_NULL) {
|
if (attr.inputType != InputType.TYPE_NULL) {
|
||||||
caps = getCurrentInputConnection().getCursorCapsMode(attr.inputType);
|
caps = getCurrentInputConnection().getCursorCapsMode(attr.inputType);
|
||||||
}
|
}
|
||||||
// mInputView.setShifted(mCapsLock || caps != 0);
|
// mInputView.setShifted(mCapsLock || caps != 0);
|
||||||
|
|
@ -1011,8 +983,8 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
if (mComposing.length() > 0) {
|
if (mComposing.length() > 0) {
|
||||||
mSuggestionStrings.clear();
|
mSuggestionStrings.clear();
|
||||||
char[] ca = CharMap.T9TABLE[mLang][mPrevious];
|
char[] ca = CharMap.T9TABLE[mLang][mPrevious];
|
||||||
for (int i = 0; i < ca.length; i++) {
|
for (char c : ca) {
|
||||||
mSuggestionStrings.add(String.valueOf(ca[i]));
|
mSuggestionStrings.add(String.valueOf(c));
|
||||||
}
|
}
|
||||||
setSuggestions(mSuggestionStrings, mCharIndex);
|
setSuggestions(mSuggestionStrings, mCharIndex);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1355,7 +1327,7 @@ public class TraditionalT9 extends InputMethodService implements
|
||||||
pickSuggestionManually(-1, ic);
|
pickSuggestionManually(-1, ic);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pickSuggestionManually(int index, InputConnection ic) {
|
private void pickSuggestionManually(int index, InputConnection ic) {
|
||||||
// Log.d("pickSuggestMan", "Doing");
|
// Log.d("pickSuggestMan", "Doing");
|
||||||
if (mComposing.length() > 0 || mComposingI.length() > 0) {
|
if (mComposing.length() > 0 || mComposingI.length() > 0) {
|
||||||
// If we were generating candidate suggestions for the current
|
// If we were generating candidate suggestions for the current
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
package org.nyanya.android.traditionalt9;
|
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.BufferedReader;
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
|
|
@ -13,8 +18,8 @@ import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.AbstractList;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -22,6 +27,7 @@ import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
@ -37,6 +43,7 @@ import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
@ -67,18 +74,6 @@ public class TraditionalT9Settings extends PreferenceActivity implements
|
||||||
public LoadException() {
|
public LoadException() {
|
||||||
super();
|
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 {
|
private class Reply {
|
||||||
|
|
@ -104,9 +99,7 @@ public class TraditionalT9Settings extends PreferenceActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finishAndShowError(ProgressDialog pd, Reply result, int title){
|
private void finishAndShowError(ProgressDialog pd, Reply result, int title){
|
||||||
if (pd == null) {
|
if (pd != null) {
|
||||||
// Log.d("onPostExecute", "pd");
|
|
||||||
} else {
|
|
||||||
// Log.d("onPostExecute", "pd");
|
// Log.d("onPostExecute", "pd");
|
||||||
if (pd.isShowing()) {
|
if (pd.isShowing()) {
|
||||||
pd.dismiss();
|
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) {
|
private void closeStream(Closeable is, Reply reply) {
|
||||||
if (is == null) {
|
if (is == null) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -218,6 +164,53 @@ public class TraditionalT9Settings extends PreferenceActivity implements
|
||||||
pd.setOnCancelListener(TraditionalT9Settings.this);
|
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() {
|
@Override protected void onPreExecute() {
|
||||||
size = getDictSizes(internal, restore, dicts);
|
size = getDictSizes(internal, restore, dicts);
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
|
@ -248,8 +241,8 @@ public class TraditionalT9Settings extends PreferenceActivity implements
|
||||||
// add characters first, then dictionary:
|
// add characters first, then dictionary:
|
||||||
Log.d("doInBackground", "Adding characters...");
|
Log.d("doInBackground", "Adding characters...");
|
||||||
// load characters from supported langs
|
// load characters from supported langs
|
||||||
for (int x=0; x<mSupportedLanguages.length; x++) {
|
for (int lang : mSupportedLanguages) {
|
||||||
processChars(reply, db, mSupportedLanguages[x]);
|
processChars(db, lang);
|
||||||
}
|
}
|
||||||
Log.d("doInBackground", "done.");
|
Log.d("doInBackground", "done.");
|
||||||
|
|
||||||
|
|
@ -296,7 +289,7 @@ public class TraditionalT9Settings extends PreferenceActivity implements
|
||||||
reply.forceMsg("File not found: " + e.getMessage());
|
reply.forceMsg("File not found: " + e.getMessage());
|
||||||
final String msg = mContext.getString(R.string.pref_loaduser_notfound, dicts[x]);
|
final String msg = mContext.getString(R.string.pref_loaduser_notfound, dicts[x]);
|
||||||
//Log.d("T9Setting.load", "Built string. Calling Toast.");
|
//Log.d("T9Setting.load", "Built string. Calling Toast.");
|
||||||
((PreferenceActivity) mContext).runOnUiThread(new Runnable() {
|
((Activity) mContext).runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(mContext,
|
Toast.makeText(mContext,
|
||||||
|
|
@ -326,7 +319,7 @@ public class TraditionalT9Settings extends PreferenceActivity implements
|
||||||
return reply;
|
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);
|
InsertHelper wordhelp = new InsertHelper(db, T9DB.WORD_TABLE_NAME);
|
||||||
|
|
||||||
final int wordColumn = wordhelp.getColumnIndex(T9DB.COLUMN_WORD);
|
final int wordColumn = wordhelp.getColumnIndex(T9DB.COLUMN_WORD);
|
||||||
|
|
@ -526,8 +519,6 @@ public class TraditionalT9Settings extends PreferenceActivity implements
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
reply.status = false;
|
reply.status = false;
|
||||||
reply.forceMsg("Backup file error: " + e.getMessage());
|
reply.forceMsg("Backup file error: " + e.getMessage());
|
||||||
closeStream(dictstream, reply); // this is silly but it stops
|
|
||||||
// IDE nagging at me.
|
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -754,30 +745,6 @@ public class TraditionalT9Settings extends PreferenceActivity implements
|
||||||
mContext = this;
|
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() {
|
private void openHelp() {
|
||||||
Intent i = new Intent(Intent.ACTION_VIEW);
|
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||||
i.setData(Uri.parse(getString(R.string.help_url)));
|
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) {
|
private void preloader(int msgid, boolean internal, boolean restorebackup) {
|
||||||
|
|
||||||
task = new LoadDictTask(msgid, internal, restorebackup,
|
task = new LoadDictTask(msgid, internal, restorebackup,
|
||||||
buildLangs(((MultiSelectListPreference) findPreference("pref_lang_support")).getValue()));
|
LangHelper.buildLangs(((ListPreference) findPreference("pref_lang_support")).getValue()));
|
||||||
task.execute();
|
task.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -797,18 +764,14 @@ public class TraditionalT9Settings extends PreferenceActivity implements
|
||||||
task.execute();
|
task.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prenuke(int msgid) {
|
|
||||||
task = new NukeDictTask(msgid);
|
|
||||||
task.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void nukeDict() {
|
private void nukeDict() {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setMessage(R.string.pref_nuke_warn).setTitle(R.string.pref_nuke_title)
|
builder.setMessage(R.string.pref_nuke_warn).setTitle(R.string.pref_nuke_title)
|
||||||
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
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() {
|
}).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@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);
|
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)
|
builder.setMessage(msg).setTitle(title)
|
||||||
.setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() {
|
.setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -923,8 +886,8 @@ public class TraditionalT9Settings extends PreferenceActivity implements
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void queryTestDebug() {
|
private void queryTestDebug() {
|
||||||
long startnow, endnow;
|
long startnow, endnow;
|
||||||
ArrayList<String> words = new ArrayList<String>();
|
AbstractList<String> words = new ArrayList<String>();
|
||||||
ArrayList<Integer> ids = new ArrayList<Integer>();
|
List<Integer> ids = new ArrayList<Integer>();
|
||||||
|
|
||||||
startnow = SystemClock.uptimeMillis();
|
startnow = SystemClock.uptimeMillis();
|
||||||
|
|
||||||
|
|
@ -968,10 +931,11 @@ public class TraditionalT9Settings extends PreferenceActivity implements
|
||||||
Log.d("TIMING", "Execution time: " + (endnow - startnow) + " ms");
|
Log.d("TIMING", "Execution time: " + (endnow - startnow) + " ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private void queryTestSingle() {
|
private void queryTestSingle() {
|
||||||
long startnow, endnow;
|
long startnow, endnow;
|
||||||
int size;
|
int size;
|
||||||
ArrayList<String> words = new ArrayList<String>(8);
|
AbstractList<String> words = new ArrayList<String>(8);
|
||||||
ArrayList<Integer> ids = new ArrayList<Integer>(8);
|
ArrayList<Integer> ids = new ArrayList<Integer>(8);
|
||||||
startnow = SystemClock.uptimeMillis();
|
startnow = SystemClock.uptimeMillis();
|
||||||
|
|
||||||
|
|
@ -992,7 +956,7 @@ public class TraditionalT9Settings extends PreferenceActivity implements
|
||||||
endnow = SystemClock.uptimeMillis();
|
endnow = SystemClock.uptimeMillis();
|
||||||
Log.d("TIMING", "Execution time: " + (endnow - startnow) + " ms");
|
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);
|
tdb.updateWordsW("222", words, ids, freqs, LangHelper.EN);
|
||||||
Log.d("VALUES", "...");
|
Log.d("VALUES", "...");
|
||||||
size = freqs.size();
|
size = freqs.size();
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@ package org.nyanya.android.traditionalt9;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class Utils {
|
@SuppressWarnings("unused")
|
||||||
|
class Utils {
|
||||||
|
|
||||||
public static void printFlags(int inputType) {
|
public static void printFlags(int inputType) {
|
||||||
if ((inputType & InputType.TYPE_CLASS_DATETIME) == InputType.TYPE_CLASS_DATETIME)
|
if ((inputType & InputType.TYPE_CLASS_DATETIME) == InputType.TYPE_CLASS_DATETIME)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue