Added French icons. Fixed bugs in settings nuke.
This commit is contained in:
parent
00665c7913
commit
9458c58b2e
9 changed files with 40 additions and 19 deletions
BIN
res/drawable-hdpi/ime_fr_lang_lower.png
Normal file
BIN
res/drawable-hdpi/ime_fr_lang_lower.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 612 B |
BIN
res/drawable-hdpi/ime_fr_lang_single.png
Normal file
BIN
res/drawable-hdpi/ime_fr_lang_single.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 674 B |
BIN
res/drawable-hdpi/ime_fr_lang_upper.png
Normal file
BIN
res/drawable-hdpi/ime_fr_lang_upper.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 868 B |
BIN
res/drawable/ime_fr_lang_lower.png
Normal file
BIN
res/drawable/ime_fr_lang_lower.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 612 B |
BIN
res/drawable/ime_fr_lang_single.png
Normal file
BIN
res/drawable/ime_fr_lang_single.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 674 B |
BIN
res/drawable/ime_fr_lang_upper.png
Normal file
BIN
res/drawable/ime_fr_lang_upper.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 868 B |
|
|
@ -63,7 +63,7 @@ public class LangHelper {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// French resources
|
// French resources
|
||||||
{R.drawable.ime_de_lang_lower, R.drawable.ime_de_lang_single, R.drawable.ime_de_lang_upper}, //LANG
|
{R.drawable.ime_fr_lang_lower, R.drawable.ime_fr_lang_single, R.drawable.ime_fr_lang_upper}, //LANG
|
||||||
{R.drawable.ime_en_text_lower, R.drawable.ime_en_text_single, R.drawable.ime_en_text_upper}, //TEXT
|
{R.drawable.ime_en_text_lower, R.drawable.ime_en_text_single, R.drawable.ime_en_text_upper}, //TEXT
|
||||||
{R.drawable.ime_number}, //NUM
|
{R.drawable.ime_number}, //NUM
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import android.content.res.Resources;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteConstraintException;
|
import android.database.sqlite.SQLiteConstraintException;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.database.sqlite.SQLiteException;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
import android.provider.BaseColumns;
|
import android.provider.BaseColumns;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
@ -167,25 +168,23 @@ public class T9DB {
|
||||||
protected 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) {
|
|
||||||
db.close();
|
|
||||||
}
|
|
||||||
String[] oldSettings = getSettings();
|
String[] oldSettings = getSettings();
|
||||||
if (!mContext.deleteDatabase(DATABASE_NAME)) {
|
if (oldSettings == null) { Log.e("T9DB", "Couldn't get old settings"); }
|
||||||
Log.e("T9DB", "Couldn't delete database.");
|
if (db != null) { db.close(); }
|
||||||
}
|
if (!mContext.deleteDatabase(DATABASE_NAME)) { Log.e("T9DB", "Couldn't delete database."); }
|
||||||
Log.i("T9DB.nuke", "Preparing database...");
|
Log.i("T9DB.nuke", "Preparing database...");
|
||||||
getWritableDatabase().close();
|
getWritableDatabase().close();
|
||||||
|
|
||||||
db = null;
|
db = null;
|
||||||
ready = true;
|
ready = true;
|
||||||
init();
|
init();
|
||||||
StringBuilder sb = new StringBuilder("INSERT OR REPLACE INTO ");
|
if (oldSettings != null) {
|
||||||
sb.append(SETTING_TABLE_NAME); sb.append(" ("); sb.append(COLUMN_ID); sb.append(",");
|
StringBuilder sb = new StringBuilder("INSERT OR REPLACE INTO ");
|
||||||
sb = DBSettings.SETTING.join(DBSettings.SETTING.settings, sb);
|
sb.append(SETTING_TABLE_NAME); sb.append(" ("); sb.append(COLUMN_ID); sb.append(",");
|
||||||
sb.append(") VALUES ("); sb.append(TextUtils.join(",", oldSettings));
|
sb = DBSettings.SETTING.join(DBSettings.SETTING.settings, sb);
|
||||||
sb.append(")");
|
sb.append(") VALUES ("); sb.append(TextUtils.join(",", oldSettings)); sb.append(")");
|
||||||
db.execSQL(sb.toString());
|
db.execSQL(sb.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Log.i("T9DB.nuke", "Done...");
|
Log.i("T9DB.nuke", "Done...");
|
||||||
}
|
}
|
||||||
|
|
@ -269,18 +268,31 @@ public class T9DB {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] getSettings() {
|
private String[] getSettings() {
|
||||||
int len = DBSettings.SETTING.settings.length;
|
if (!checkReady()) {
|
||||||
String[] settings = new String[len+1];
|
Log.e("T9DB.getSetting", "not ready");
|
||||||
StringBuilder sb = new StringBuilder("SELECT ");
|
return null;
|
||||||
|
}
|
||||||
|
int len = DBSettings.SETTING.settings.length+1;
|
||||||
|
String[] settings = new String[len];
|
||||||
|
StringBuilder sb = new StringBuilder("SELECT "); sb.append(COLUMN_ID); sb.append(",");
|
||||||
sb = DBSettings.SETTING.join(DBSettings.SETTING.settings, sb);
|
sb = DBSettings.SETTING.join(DBSettings.SETTING.settings, sb);
|
||||||
sb.append("FROM "); sb.append(SETTING_TABLE_NAME); sb.append(" WHERE "); sb.append(COLUMN_ID); sb.append("=1");
|
sb.append(" FROM "); sb.append(SETTING_TABLE_NAME); sb.append(" WHERE "); sb.append(COLUMN_ID);
|
||||||
Cursor cur = db.rawQuery(sb.toString(),null);
|
sb.append("=1");
|
||||||
|
|
||||||
|
Cursor cur = null;
|
||||||
|
cur = db.rawQuery(sb.toString(),null);
|
||||||
|
try { cur = db.rawQuery(sb.toString(),null); }
|
||||||
|
catch (SQLiteException e) {
|
||||||
|
if (cur != null) { cur.close(); }
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (cur.moveToFirst()) {
|
if (cur.moveToFirst()) {
|
||||||
for (int x = 0; x < len; x++)
|
for (int x = 0; x < len; x++)
|
||||||
settings[x] = cur.getString(x);
|
settings[x] = cur.getString(x);
|
||||||
} else {
|
} else {
|
||||||
Log.w("T9DB.getSettings", "COULDN'T RETRIEVE SETTINGS?");
|
Log.w("T9DB.getSettings", "COULDN'T RETRIEVE SETTINGS?");
|
||||||
for (int x = 0; x < len; x++) {
|
for (int x = 1; x < len; x++) {
|
||||||
|
settings[0] = "1"; // COLUMN_ID
|
||||||
if (DBSettings.SETTING.settings[x].defvalue == null)
|
if (DBSettings.SETTING.settings[x].defvalue == null)
|
||||||
settings[x] = null;
|
settings[x] = null;
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
import android.os.Handler;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
@ -747,6 +748,7 @@ public class TraditionalT9Settings extends ListActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
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(android.R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
|
|
@ -754,6 +756,13 @@ public class TraditionalT9Settings extends ListActivity implements
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
task = new NukeDictTask(R.string.pref_nukingdict);
|
task = new NukeDictTask(R.string.pref_nukingdict);
|
||||||
task.execute();
|
task.execute();
|
||||||
|
// restart settings to get fresh settings.
|
||||||
|
TraditionalT9Settings.this.finish();
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
startActivity(new Intent(TraditionalT9Settings.this, TraditionalT9Settings.class));
|
||||||
|
}}, 1000);
|
||||||
}
|
}
|
||||||
}).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
}).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue