diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 682cb4f6..2a8ecae4 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -26,9 +26,10 @@
android:resource="@xml/method" />
+
+
@@ -37,8 +38,9 @@
+ android:label="@string/title_activity_add_word"
+ android:excludeFromRecents="true" >
-
+
-
\ No newline at end of file
+
diff --git a/assets/ru-utf8.txt b/assets/ru-utf8.txt
index ce8603f4..d197db27 100644
--- a/assets/ru-utf8.txt
+++ b/assets/ru-utf8.txt
@@ -1,4 +1,4 @@
-радость
+радость
ожидать
плакать
желание
diff --git a/build.gradle b/build.gradle
index 668a07b6..043ce667 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,42 +1,99 @@
buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.6.+'
- }
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.7.+'
+ }
}
apply plugin: 'android'
+ext {
+ keyStorePass = ''
+ keyPass = ''
+}
+
dependencies {
- compile fileTree(dir: 'libs', include: '*.jar')
+ compile fileTree(dir: 'libs', include: '*.jar')
}
android {
- compileSdkVersion 10
- buildToolsVersion "19.0.0"
+ compileSdkVersion 10
+ buildToolsVersion "19.0.0"
- sourceSets {
- main {
- manifest.srcFile 'AndroidManifest.xml'
- java.srcDirs = ['src']
- resources.srcDirs = ['src']
- aidl.srcDirs = ['src']
- renderscript.srcDirs = ['src']
- res.srcDirs = ['res']
- assets.srcDirs = ['assets']
- }
+ sourceSets {
+ main {
+ manifest.srcFile 'AndroidManifest.xml'
+ java.srcDirs = ['src']
+ resources.srcDirs = ['src']
+ aidl.srcDirs = ['src']
+ renderscript.srcDirs = ['src']
+ res.srcDirs = ['res']
+ assets.srcDirs = ['assets']
+ }
- // Move the tests to tests/java, tests/res, etc...
- instrumentTest.setRoot('tests')
+ // Move the tests to tests/java, tests/res, etc...
+ instrumentTest.setRoot('tests')
- // Move the build types to build-types/
- // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
- // This moves them out of them default location under src//... which would
- // conflict with src/ being used by the main source set.
- // Adding new build types or product flavors should be accompanied
- // by a similar customization.
- debug.setRoot('build-types/debug')
- release.setRoot('build-types/release')
- }
+ // Move the build types to build-types/
+ // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
+ // This moves them out of them default location under src//... which would
+ // conflict with src/ being used by the main source set.
+ // Adding new build types or product flavors should be accompanied
+ // by a similar customization.
+ debug.setRoot('build-types/debug')
+ release.setRoot('build-types/release')
+
+ }
+ // http://stackoverflow.com/a/19130098
+ signingConfigs {
+ release {
+ storeFile file(System.getenv("KEYSTORE"))
+ storePassword project.ext.keyStorePass
+ keyAlias System.getenv("KEYALIAS")
+ keyPassword project.ext.keyPass
+ }
+ }
+
+ buildTypes {
+ release {
+ signingConfig android.signingConfigs.release
+ }
+ }
}
+
+
+task getDictSizes {
+ inputs.files 'assets/en-utf8.txt', 'assets/ru-utf8.txt'
+ outputs.file "assets/dict.properties"
+ doLast {
+ ant.echo("Deleting old file...")
+
+ delete 'assets/dict.properties'
+
+ ant.echo("Calculating dict size...")
+
+ FileCollection dicts = files("assets/en-utf8.txt", "assets/ru-utf8.txt")
+
+ dicts.each {File file ->
+ ant.propertyfile(file:"assets/dict.properties") {
+ entry(key: "size."+ file.name, value: file.length())
+ }
+ }
+ }
+}
+
+task readPasswordFromInput << {
+ android.signingConfigs.release.storePassword = String.valueOf(System.console().readPassword("\nKeyStore Password: "))
+ android.signingConfigs.release.keyPassword = String.valueOf(System.console().readPassword("\nKey Password: "))
+}
+
+//http://stackoverflow.com/a/17484331
+tasks.whenTaskAdded { task ->
+ if (task.name == 'packageRelease') {
+ task.dependsOn readPasswordFromInput
+ }
+}
+
+preBuild.dependsOn getDictSizes
+preBuild.mustRunAfter getDictSizes
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 861eddc3..56c8ec2c 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Mon Jan 13 17:37:00 EST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-all.zip
diff --git a/res/drawable/bggradient.xml b/res/drawable/bggradient.xml
index 59baebf9..52ca3c9f 100644
--- a/res/drawable/bggradient.xml
+++ b/res/drawable/bggradient.xml
@@ -1,9 +1,9 @@
-
-
-
\ No newline at end of file
+
+
+
diff --git a/res/drawable/button_custom.xml b/res/drawable/button_custom.xml
index 68d391a0..2f3497c4 100644
--- a/res/drawable/button_custom.xml
+++ b/res/drawable/button_custom.xml
@@ -1,8 +1,8 @@
-
-
-
-
\ No newline at end of file
+
+
+
+
diff --git a/res/drawable/button_grad.xml b/res/drawable/button_grad.xml
index 0b0f89f6..cf2ac403 100644
--- a/res/drawable/button_grad.xml
+++ b/res/drawable/button_grad.xml
@@ -1,9 +1,9 @@
-
-
-
\ No newline at end of file
+
+
+
diff --git a/res/drawable/button_grad_press.xml b/res/drawable/button_grad_press.xml
index ebf9652c..be81f300 100644
--- a/res/drawable/button_grad_press.xml
+++ b/res/drawable/button_grad_press.xml
@@ -1,9 +1,9 @@
-
-
-
\ No newline at end of file
+
+
+
diff --git a/res/drawable/holdicon.png b/res/drawable/holdicon.png
new file mode 100644
index 00000000..87899dbd
Binary files /dev/null and b/res/drawable/holdicon.png differ
diff --git a/res/drawable/ic_launcher.png b/res/drawable/ic_launcher.png
new file mode 100644
index 00000000..dd3a91f6
Binary files /dev/null and b/res/drawable/ic_launcher.png differ
diff --git a/res/drawable/ime_en_lang_lower.png b/res/drawable/ime_en_lang_lower.png
new file mode 100644
index 00000000..afd83b39
Binary files /dev/null and b/res/drawable/ime_en_lang_lower.png differ
diff --git a/res/drawable/ime_en_lang_single.png b/res/drawable/ime_en_lang_single.png
new file mode 100644
index 00000000..d2fd0de2
Binary files /dev/null and b/res/drawable/ime_en_lang_single.png differ
diff --git a/res/drawable/ime_en_lang_upper.png b/res/drawable/ime_en_lang_upper.png
new file mode 100644
index 00000000..5d3b5e28
Binary files /dev/null and b/res/drawable/ime_en_lang_upper.png differ
diff --git a/res/drawable/ime_en_text_lower.png b/res/drawable/ime_en_text_lower.png
new file mode 100644
index 00000000..f80c9632
Binary files /dev/null and b/res/drawable/ime_en_text_lower.png differ
diff --git a/res/drawable/ime_en_text_single.png b/res/drawable/ime_en_text_single.png
new file mode 100644
index 00000000..21ac0383
Binary files /dev/null and b/res/drawable/ime_en_text_single.png differ
diff --git a/res/drawable/ime_en_text_upper.png b/res/drawable/ime_en_text_upper.png
new file mode 100644
index 00000000..4ba32090
Binary files /dev/null and b/res/drawable/ime_en_text_upper.png differ
diff --git a/res/drawable/ime_number.png b/res/drawable/ime_number.png
new file mode 100644
index 00000000..c3a9faa9
Binary files /dev/null and b/res/drawable/ime_number.png differ
diff --git a/res/drawable/ime_ru_lang_lower.png b/res/drawable/ime_ru_lang_lower.png
new file mode 100644
index 00000000..83f5766b
Binary files /dev/null and b/res/drawable/ime_ru_lang_lower.png differ
diff --git a/res/drawable/ime_ru_lang_single.png b/res/drawable/ime_ru_lang_single.png
new file mode 100644
index 00000000..62459083
Binary files /dev/null and b/res/drawable/ime_ru_lang_single.png differ
diff --git a/res/drawable/ime_ru_lang_upper.png b/res/drawable/ime_ru_lang_upper.png
new file mode 100644
index 00000000..eb784da7
Binary files /dev/null and b/res/drawable/ime_ru_lang_upper.png differ
diff --git a/res/drawable/ime_ru_text_lower.png b/res/drawable/ime_ru_text_lower.png
new file mode 100644
index 00000000..78e71e90
Binary files /dev/null and b/res/drawable/ime_ru_text_lower.png differ
diff --git a/res/drawable/ime_ru_text_single.png b/res/drawable/ime_ru_text_single.png
new file mode 100644
index 00000000..c26e4d16
Binary files /dev/null and b/res/drawable/ime_ru_text_single.png differ
diff --git a/res/drawable/ime_ru_text_upper.png b/res/drawable/ime_ru_text_upper.png
new file mode 100644
index 00000000..10170486
Binary files /dev/null and b/res/drawable/ime_ru_text_upper.png differ
diff --git a/res/drawable/key_eight.png b/res/drawable/key_eight.png
new file mode 100644
index 00000000..e18ebde1
Binary files /dev/null and b/res/drawable/key_eight.png differ
diff --git a/res/drawable/key_five.png b/res/drawable/key_five.png
new file mode 100644
index 00000000..59d73df6
Binary files /dev/null and b/res/drawable/key_five.png differ
diff --git a/res/drawable/key_four.png b/res/drawable/key_four.png
new file mode 100644
index 00000000..35fa0317
Binary files /dev/null and b/res/drawable/key_four.png differ
diff --git a/res/drawable/key_nine.png b/res/drawable/key_nine.png
new file mode 100644
index 00000000..332bb4d5
Binary files /dev/null and b/res/drawable/key_nine.png differ
diff --git a/res/drawable/key_one.png b/res/drawable/key_one.png
new file mode 100644
index 00000000..5cbc17d0
Binary files /dev/null and b/res/drawable/key_one.png differ
diff --git a/res/drawable/key_pound.png b/res/drawable/key_pound.png
new file mode 100644
index 00000000..447dcb3b
Binary files /dev/null and b/res/drawable/key_pound.png differ
diff --git a/res/drawable/key_seven.png b/res/drawable/key_seven.png
new file mode 100644
index 00000000..59926d0a
Binary files /dev/null and b/res/drawable/key_seven.png differ
diff --git a/res/drawable/key_six.png b/res/drawable/key_six.png
new file mode 100644
index 00000000..51510d64
Binary files /dev/null and b/res/drawable/key_six.png differ
diff --git a/res/drawable/key_star.png b/res/drawable/key_star.png
new file mode 100644
index 00000000..653272be
Binary files /dev/null and b/res/drawable/key_star.png differ
diff --git a/res/drawable/key_three.png b/res/drawable/key_three.png
new file mode 100644
index 00000000..9bbbd971
Binary files /dev/null and b/res/drawable/key_three.png differ
diff --git a/res/drawable/key_two.png b/res/drawable/key_two.png
new file mode 100644
index 00000000..05cf2fe8
Binary files /dev/null and b/res/drawable/key_two.png differ
diff --git a/res/drawable/key_zero.png b/res/drawable/key_zero.png
new file mode 100644
index 00000000..d811d36f
Binary files /dev/null and b/res/drawable/key_zero.png differ
diff --git a/res/drawable/rcycle.png b/res/drawable/rcycle.png
new file mode 100644
index 00000000..05b1ccc6
Binary files /dev/null and b/res/drawable/rcycle.png differ
diff --git a/res/layout/addwordview.xml b/res/layout/addwordview.xml
index f251182d..d2972b25 100644
--- a/res/layout/addwordview.xml
+++ b/res/layout/addwordview.xml
@@ -1,41 +1,41 @@
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
\ No newline at end of file
+
diff --git a/res/layout/lbuttonhold.xml b/res/layout/lbuttonhold.xml
index 719bec94..b1160118 100644
--- a/res/layout/lbuttonhold.xml
+++ b/res/layout/lbuttonhold.xml
@@ -1,40 +1,40 @@
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_marginLeft="0dp"
+ android:layout_marginRight="0dp"
+ android:orientation="vertical"
+ android:padding="5dp" >
-
+
-
+
-
\ No newline at end of file
+
diff --git a/res/layout/lbuttonnohold.xml b/res/layout/lbuttonnohold.xml
index a62b6662..9c337111 100644
--- a/res/layout/lbuttonnohold.xml
+++ b/res/layout/lbuttonnohold.xml
@@ -1,26 +1,26 @@
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_marginLeft="0dp"
+ android:layout_marginRight="0dp"
+ android:orientation="vertical"
+ android:padding="5dp" >
-
+
-
\ No newline at end of file
+
diff --git a/res/layout/mainview.xml b/res/layout/mainview.xml
index 957e8b5b..55c99bb6 100644
--- a/res/layout/mainview.xml
+++ b/res/layout/mainview.xml
@@ -1,61 +1,61 @@
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="0dp"
+ android:layout_marginRight="0dp"
+ android:layout_marginTop="0dp"
+ android:background="@drawable/bggradient"
+ android:baselineAligned="true"
+ android:gravity="bottom"
+ android:orientation="horizontal" >
+
+
-
-
-
-
-
+
-
+
-
+
-
-
+
-
\ No newline at end of file
+
+
+
+
diff --git a/res/layout/mainviewold.xml b/res/layout/mainviewold.xml
index c0324101..a29858b9 100644
--- a/res/layout/mainviewold.xml
+++ b/res/layout/mainviewold.xml
@@ -1,57 +1,57 @@
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="0dp"
+ android:layout_marginRight="0dp"
+ android:layout_marginTop="0dp"
+ android:background="@drawable/bggradient"
+ android:baselineAligned="true"
+ android:gravity="bottom"
+ android:orientation="horizontal" >
-
+
-
+
-
+
-
-
+
+
-
\ No newline at end of file
+
diff --git a/res/layout/rbutton.xml b/res/layout/rbutton.xml
index 1c6e7d51..527f3366 100644
--- a/res/layout/rbutton.xml
+++ b/res/layout/rbutton.xml
@@ -1,42 +1,42 @@
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_marginLeft="0dp"
+ android:layout_marginRight="0dp"
+ android:orientation="vertical"
+ android:padding="5dp" >
-
+
-
+
-
\ No newline at end of file
+
diff --git a/res/layout/symbolview.xml b/res/layout/symbolview.xml
index 06c8bfc2..0215ce0e 100644
--- a/res/layout/symbolview.xml
+++ b/res/layout/symbolview.xml
@@ -1,202 +1,202 @@
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:gravity="center_horizontal"
+ android:orientation="vertical"
+ android:padding="2dp" >
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
\ No newline at end of file
+
diff --git a/res/menu/add_word.xml b/res/menu/add_word.xml
index e6dd2f2d..a13cac71 100644
--- a/res/menu/add_word.xml
+++ b/res/menu/add_word.xml
@@ -1,8 +1,8 @@
\ No newline at end of file
+
diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml
new file mode 100644
index 00000000..ec05c480
--- /dev/null
+++ b/res/values-ru/strings.xml
@@ -0,0 +1,61 @@
+
+
+
+ Traditional T9
+ Клавиатура T9
+ T9
+ Цифры
+ Режим ввода по умолчанию
+ Режим ввода по умолчанию
+ Traditional T9 настройки
+ вставить символ
+ Добавить слово
+ Готово
+ Commit
+ Режим ввода
+ Изменить IME
+ Добавить слово?
+ Hold Icon
+ Следущая страница
+ Предыдущая страница
+ Добавить слово
+ OK
+ Невозможно добавить слово.
+ Невозможно добавить слово с таким символом %1$s.
+ Слово (%1$s) уже есть в словаре.
+ Слово (%1$s) уже есть в словаре %2$s.
+ Отмена
+ Добавить слово
+ Настройки
+
+ Включить поддержку Русского языка
+
+ Загрузить словарь
+ Загрузить свой словарь
+ SDcard/traditionalt9/user.lang.dict (lang: en/ru)
+ Nuke dictionary
+ Backup dictionary
+ Restore dictionary
+ Query test
+ Test func
+
+ Загрузка словаря
+ Загрузка пользовательского словаря...
+ Загрузить словарь IME
+ Восстановление словаря...
+ Сохранение словаря...
+ Очистка словаря... Пожалуйста, подождите...
+
+ Предупреждение: Существующая копия базы данных будет перезаписана. Продолжить?
+ Резервное копирование базы данных IME
+ Ошибка: Внешняя память недоступна. Резервное копирование невозможно невозможно.
+ При восстановлении существующая база данных будет очищена. Если это нежелательно, то сначала выберите \"%1$s\" перед использованием этой опции.
+ Восстановить базу данных IME
+ Ошибка: Внешняя память недоступна. Восстановление невозможно.
+ Ошибка: Файл встановления не найден.
+ Предупреждение: Будет выполнена очстка словаря. Продолжить?
+ Очистить IME словарь
+
+ Hello world!
+
+
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index e8b25a3d..b30ba8b4 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -1,13 +1,25 @@
-
- - English
- - Text
- - Number
-
-
- - 0
- - 1
- - 2
-
-
\ No newline at end of file
+
+ - Dictionary
+ - Text
+ - Number
+
+
+ - 0
+ - 1
+ - 2
+
+
+
+ - 0
+
+
+ - English
+ - Russian
+
+
+ - 0
+ - 1
+
+
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 33912d8f..2db951e4 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -1,13 +1,13 @@
- #FF000000
- #FFE35900
- #ff808080
- #bbffffff
- #FFFCBE2B
- #FF2A9AEB
- #FFA8A8A8
- #FFFFFFFF
- #FF000000
- #FFFFFFFF
-
\ No newline at end of file
+ #FF000000
+ #FFE35900
+ #ff808080
+ #bbffffff
+ #FFFCBE2B
+ #FF2A9AEB
+ #FFA8A8A8
+ #FFFFFFFF
+ #FF000000
+ #FFFFFFFF
+
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index f9ec51de..85f2c3dc 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -1,29 +1,29 @@
- 50dip
- 16sp
- 6sp
- 16dp
- 16dp
+ 50dip
+ 16sp
+ 6sp
+ 16dp
+ 16dp
-
\ No newline at end of file
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4ae1c45d..c48a150c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,54 +1,73 @@
+ https://github.com/Clam-/TraditionalT9/wiki/Traditional-T9-keypad-IME-for-Android
+ Traditional T9
+ Traditional T9
+ English
+ Numbers
+ Default Input Mode
+ Default mode used for \'normal\' text entry
+ Traditional T9 Settings
+ Insert symbol
+ Add word
+ Done
+ Commit
+ Cycle Mode
+ Options
+ Add word?
+ Hold Icon
+ Next Page
+ Prev Page
+ Add word
+ OK
+ Close
+ Blank word not added.
+ Cannot add word with unmappable symbol for %1$s.
+ Word (%1$s) already in DB.
+ Word (%1$s) already in DB for %2$s.
+ Cancel
+ Add Word
+ Settings
+ Database unavailable.
- Traditional T9
- Traditional T9
- English
- Numbers
- Default Input Mode
- Default mode used for \'normal\' text entry
- Traditional T9 Settings
- Insert symbol
- Add word
- Done
- Commit
- Cycle Mode
- Change IME
- Add word?
- Hold Icon
- Next Page
- Prev Page
- Add word
- OK
- Blank word not added.
- Cannot add word with unmappable symbol.
- Word (
- ) already in DB.
- Cancel
- Add Word
- Settings
-
- Load dictionary
- Nuke dictionary
- Backup dictionary
- Restore dictionary
- Query test
-
- Loading dictionary…
- Restoring dictionary…
- Backing up dictionary…
- Nuking dictionary… Please wait…
-
- Warning: An existing database backup exists. Do you wish to overwrite?
- Backup IME database
- Error: No external storage available for backup. Backup will not continue.
- Backup database entries will overwrite existing database entries. Entries not in the backup will be retained. If that is not desired behaviour select \"%1$s\" before selecting this option.
- Restore IME database
- Error: No external storage available for restoring. Restore will not continue.
- Error: Backup file not found.
- Warning: This will delete your entire dictionary. Do you wish to continue?
- Nuke IME dictionary
-
- Hello world!
+ Warning: No keypad/keyboard
+ This device does not have a hardware keyboard/keypad, therefore it will not function in any useful way.
+Sorry for the inconvenience.
-
\ No newline at end of file
+ Updating dictionary database...
+ Updating dictionary database, this might take a while.
+ Updating dictionary database complete.
+ Updating dictionary database, word input unavailable at this time.
+
+ Multilingual support...
+ "Show help
+ Load dictionary
+ Load user dictionary
+ SDcard/traditionalt9/user.lang.dict (lang: en/ru)
+ Nuke dictionary
+ Backup dictionary
+ Restore dictionary
+ Query test
+ Test func
+
+ Loading dictionary…
+ Loading user dictionary…
+ Load IME dictionary
+ Restoring dictionary…
+ Backing up dictionary…
+ Nuking dictionary… Please wait…
+ Dictionary for %1$s not found. Not loading.
+
+ Warning: An existing database backup exists. Do you wish to overwrite?
+ Backup IME database
+ Error: No external storage available for backup. Backup will not continue.
+ Backup database entries will overwrite existing database entries. Entries not in the backup will be retained. If that is not desired behaviour select \"%1$s\" before selecting this option.
+ Restore IME database
+ Error: No external storage available for restoring. Restore will not continue.
+ Error: Backup file not found.
+ Warning: This will delete your entire dictionary. Do you wish to continue?
+ Nuke IME dictionary
+
+ Hello world!
+
+
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 4a10ca49..d10f8464 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -1,20 +1,20 @@
-
-
+
+
-
-
+
+
-
\ No newline at end of file
+
diff --git a/res/xml/prefs.xml b/res/xml/prefs.xml
index a9106fc2..69fcf3a3 100644
--- a/res/xml/prefs.xml
+++ b/res/xml/prefs.xml
@@ -1,18 +1,27 @@
-
-
-
-
-
-
-
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="first_preferencescreen">
+
+
+
+
+
+
+
+
+
+
diff --git a/src/com/stackoverflow/answer/UnicodeBOMInputStream.java b/src/com/stackoverflow/answer/UnicodeBOMInputStream.java
new file mode 100644
index 00000000..34aeda71
--- /dev/null
+++ b/src/com/stackoverflow/answer/UnicodeBOMInputStream.java
@@ -0,0 +1,315 @@
+/* ____________________________________________________________________________
+ *
+ * File: UnicodeBOMInputStream.java
+ * Author: Gregory Pakosz.
+ * Date: 02 - November - 2005
+ * ____________________________________________________________________________
+ */
+package com.stackoverflow.answer;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PushbackInputStream;
+
+/**
+ * The UnicodeBOMInputStream class wraps any
+ * InputStream and detects the presence of any Unicode BOM
+ * (Byte Order Mark) at its beginning, as defined by
+ * RFC 3629 - UTF-8, a transformation format of ISO 10646
+ *
+ * The
+ * Unicode FAQ
+ * defines 5 types of BOMs:
+ * 00 00 FE FF = UTF-32, big-endian
+ * FF FE 00 00 = UTF-32, little-endian
+ * FE FF = UTF-16, big-endian
+ * FF FE = UTF-16, little-endian
+ * EF BB BF = UTF-8
+ *
+ *
+ * Use the {@link #getBOM()} method to know whether a BOM has been detected
+ * or not.
+ *
+ * Use the {@link #skipBOM()} method to remove the detected BOM from the
+ * wrapped InputStream object.
+ */
+public class UnicodeBOMInputStream extends InputStream
+{
+ /**
+ * Type safe enumeration class that describes the different types of Unicode
+ * BOMs.
+ */
+ public static final class BOM
+ {
+ /**
+ * NONE.
+ */
+ public static final BOM NONE = new BOM(new byte[]{},"NONE");
+
+ /**
+ * UTF-8 BOM (EF BB BF).
+ */
+ public static final BOM UTF_8 = new BOM(new byte[]{(byte)0xEF,
+ (byte)0xBB,
+ (byte)0xBF},
+ "UTF-8");
+
+ /**
+ * UTF-16, little-endian (FF FE).
+ */
+ public static final BOM UTF_16_LE = new BOM(new byte[]{ (byte)0xFF,
+ (byte)0xFE},
+ "UTF-16 little-endian");
+
+ /**
+ * UTF-16, big-endian (FE FF).
+ */
+ public static final BOM UTF_16_BE = new BOM(new byte[]{ (byte)0xFE,
+ (byte)0xFF},
+ "UTF-16 big-endian");
+
+ /**
+ * UTF-32, little-endian (FF FE 00 00).
+ */
+ public static final BOM UTF_32_LE = new BOM(new byte[]{ (byte)0xFF,
+ (byte)0xFE,
+ (byte)0x00,
+ (byte)0x00},
+ "UTF-32 little-endian");
+
+ /**
+ * UTF-32, big-endian (00 00 FE FF).
+ */
+ public static final BOM UTF_32_BE = new BOM(new byte[]{ (byte)0x00,
+ (byte)0x00,
+ (byte)0xFE,
+ (byte)0xFF},
+ "UTF-32 big-endian");
+
+ /**
+ * Returns a String representation of this BOM
+ * value.
+ */
+ public final String toString()
+ {
+ return description;
+ }
+
+ /**
+ * Returns the bytes corresponding to this BOM value.
+ */
+ public final byte[] getBytes()
+ {
+ final int length = bytes.length;
+ final byte[] result = new byte[length];
+
+ // Make a defensive copy
+ System.arraycopy(bytes,0,result,0,length);
+
+ return result;
+ }
+
+ private BOM(final byte bom[], final String description)
+ {
+ assert(bom != null) : "invalid BOM: null is not allowed";
+ assert(description != null) : "invalid description: null is not allowed";
+ assert(description.length() != 0) : "invalid description: empty string is not allowed";
+
+ this.bytes = bom;
+ this.description = description;
+ }
+
+ final byte bytes[];
+ private final String description;
+
+ } // BOM
+
+ /**
+ * Constructs a new UnicodeBOMInputStream that wraps the
+ * specified InputStream.
+ *
+ * @param inputStream an InputStream.
+ *
+ * @throws NullPointerException when inputStream is
+ * null.
+ * @throws IOException on reading from the specified InputStream
+ * when trying to detect the Unicode BOM.
+ */
+ public UnicodeBOMInputStream(final InputStream inputStream) throws NullPointerException,
+ IOException
+
+ {
+ if (inputStream == null)
+ throw new NullPointerException("invalid input stream: null is not allowed");
+
+ in = new PushbackInputStream(inputStream,4);
+
+ final byte bom[] = new byte[4];
+ final int read = in.read(bom);
+
+ switch(read)
+ {
+ case 4:
+ if ((bom[0] == (byte)0xFF) &&
+ (bom[1] == (byte)0xFE) &&
+ (bom[2] == (byte)0x00) &&
+ (bom[3] == (byte)0x00))
+ {
+ this.bom = BOM.UTF_32_LE;
+ break;
+ }
+ else
+ if ((bom[0] == (byte)0x00) &&
+ (bom[1] == (byte)0x00) &&
+ (bom[2] == (byte)0xFE) &&
+ (bom[3] == (byte)0xFF))
+ {
+ this.bom = BOM.UTF_32_BE;
+ break;
+ }
+
+ case 3:
+ if ((bom[0] == (byte)0xEF) &&
+ (bom[1] == (byte)0xBB) &&
+ (bom[2] == (byte)0xBF))
+ {
+ this.bom = BOM.UTF_8;
+ break;
+ }
+
+ case 2:
+ if ((bom[0] == (byte)0xFF) &&
+ (bom[1] == (byte)0xFE))
+ {
+ this.bom = BOM.UTF_16_LE;
+ break;
+ }
+ else
+ if ((bom[0] == (byte)0xFE) &&
+ (bom[1] == (byte)0xFF))
+ {
+ this.bom = BOM.UTF_16_BE;
+ break;
+ }
+
+ default:
+ this.bom = BOM.NONE;
+ break;
+ }
+
+ if (read > 0)
+ in.unread(bom,0,read);
+ }
+
+ /**
+ * Returns the BOM that was detected in the wrapped
+ * InputStream object.
+ *
+ * @return a BOM value.
+ */
+ public final BOM getBOM()
+ {
+ // BOM type is immutable.
+ return bom;
+ }
+
+ /**
+ * Skips the BOM that was found in the wrapped
+ * InputStream object.
+ *
+ * @return this UnicodeBOMInputStream.
+ *
+ * @throws IOException when trying to skip the BOM from the wrapped
+ * InputStream object.
+ */
+ public final synchronized UnicodeBOMInputStream skipBOM() throws IOException
+ {
+ if (!skipped)
+ {
+ in.skip(bom.bytes.length);
+ skipped = true;
+ }
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int read() throws IOException
+ {
+ return in.read();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int read(final byte b[]) throws IOException,
+ NullPointerException
+ {
+ return in.read(b,0,b.length);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int read(final byte b[],
+ final int off,
+ final int len) throws IOException,
+ NullPointerException
+ {
+ return in.read(b,off,len);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public long skip(final long n) throws IOException
+ {
+ return in.skip(n);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int available() throws IOException
+ {
+ return in.available();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void close() throws IOException
+ {
+ in.close();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public synchronized void mark(final int readlimit)
+ {
+ in.mark(readlimit);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public synchronized void reset() throws IOException
+ {
+ in.reset();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean markSupported()
+ {
+ return in.markSupported();
+ }
+
+ private final PushbackInputStream in;
+ private final BOM bom;
+ private boolean skipped = false;
+
+} // UnicodeBOMInputStream
diff --git a/src/org/nyanya/android/traditionalt9/AbsSymDialog.java b/src/org/nyanya/android/traditionalt9/AbsSymDialog.java
index 63d82fb4..7a3dac64 100644
--- a/src/org/nyanya/android/traditionalt9/AbsSymDialog.java
+++ b/src/org/nyanya/android/traditionalt9/AbsSymDialog.java
@@ -2,12 +2,15 @@ package org.nyanya.android.traditionalt9;
import android.app.Dialog;
import android.content.Context;
+import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
+import java.util.Arrays;
+
public abstract class AbsSymDialog extends Dialog implements
View.OnClickListener {
@@ -20,15 +23,15 @@ public abstract class AbsSymDialog extends Dialog implements
private String title;
private boolean started;
- private static final int[] buttons = {
+ private static final int[] buttons = {
R.id.text_keyone, R.id.text_keytwo,
R.id.text_keythree, R.id.text_keyfour, R.id.text_keyfive,
R.id.text_keysix, R.id.text_keyseven, R.id.text_keyeight,
- R.id.text_keynine, R.id.text_keyzero
+ R.id.text_keynine, R.id.text_keyzero
};
- private static final int[] buttons2 = {
+ private static final int[] buttons2 = {
R.id.text_keystar,
- R.id.text_keypound
+ R.id.text_keypound
};
public AbsSymDialog(Context c, View mv) {
@@ -279,6 +282,11 @@ public abstract class AbsSymDialog extends Dialog implements
win.setAttributes(lp);
win.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
updateButtons();
- show();
+ try {
+ show();
+ } catch (Exception e) {
+ Log.e("AbsSymDialog", "Cannot create Dialog:");
+ Log.e("AbsSymDialog", Arrays.toString(e.getStackTrace()));
+ }
}
}
diff --git a/src/org/nyanya/android/traditionalt9/AddWordAct.java b/src/org/nyanya/android/traditionalt9/AddWordAct.java
index 405de26b..e8946fe6 100644
--- a/src/org/nyanya/android/traditionalt9/AddWordAct.java
+++ b/src/org/nyanya/android/traditionalt9/AddWordAct.java
@@ -1,52 +1,87 @@
package org.nyanya.android.traditionalt9;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
import android.os.Bundle;
import android.app.Activity;
+import android.preference.PreferenceManager;
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 {
View main;
+ int lang;
+ SharedPreferences pref;
+ String origword;
@Override
protected void onCreate(Bundle savedData) {
super.onCreate(savedData);
View v = getLayoutInflater().inflate(R.layout.addwordview, null);
EditText et = (EditText) v.findViewById(R.id.add_word_text);
- String word = getIntent().getStringExtra("org.nyanya.android.traditionalt9.word");
+ Intent i = getIntent();
+ origword = i.getStringExtra("org.nyanya.android.traditionalt9.word");
+
+ lang = i.getIntExtra("org.nyanya.android.traditionalt9.lang", -1);
+ if (lang == -1) {
+ Log.e("AddWordAct.onCreate", "lang is invalid. How?");
+ }
// Log.d("AddWord", "data.get: " + word);
- et.setText(word);
- et.setSelection(word.length());
+ et.setText(origword);
+ et.setSelection(origword.length());
setContentView(v);
main = v;
+ pref = PreferenceManager.getDefaultSharedPreferences(this);
}
public void addWordButton(View v) {
EditText et = (EditText) main.findViewById(R.id.add_word_text);
// Log.d("AddWordAct", "adding word: " + et.getText());
- if (TraditionalT9.ghettoaccess == null) {
- Log.e("AddWordAct.addWordbutton", "ghettoaccess is null? Oh no.");
- } else {
- TraditionalT9.ghettoaccess.doAddWord(et.getText().toString());
- }
+ doAddWord(et.getText().toString());
this.finish();
}
+ public void doAddWord(String text) {
+ T9DB db = T9DB.getInstance(this);
+ try {
+ db.addWord(text, lang);
+ } catch (DBException e) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ String msg = e.getMessage();
+ //Log.e("AddWord.doAddWord", msg);
+ builder.setMessage(msg).setTitle(R.string.add_word)
+ .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ dialog.dismiss();
+ }
+ });
+ 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();
+ prefedit.putString("last_word", text);
+ prefedit.commit();
+ }
+
+
public void cancelButton(View v) {
// Log.d("AddWordAct", "Cancelled...");
- // TraditionalT9.ghettoaccess.addCancel();
this.finish();
}
- @Override
- public void onStop() {
- TraditionalT9.ghettoaccess.addCancel();
- super.onStop();
- }
-
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
diff --git a/src/org/nyanya/android/traditionalt9/CandidateView.java b/src/org/nyanya/android/traditionalt9/CandidateView.java
index 1d547943..9d69958a 100644
--- a/src/org/nyanya/android/traditionalt9/CandidateView.java
+++ b/src/org/nyanya/android/traditionalt9/CandidateView.java
@@ -46,16 +46,15 @@ public class CandidateView extends View {
/**
* Construct a CandidateView for showing suggested words for completion.
- *
+ *
* @param context
- * @param attrs
*/
public CandidateView(Context context) {
super(context);
mSelectionHighlight = context.getResources().getDrawable(
android.R.drawable.list_selector_background);
- mSelectionHighlight.setState(new int[] {
- android.R.attr.state_enabled, android.R.attr.state_focused,
+ mSelectionHighlight.setState(new int[] {
+ android.R.attr.state_enabled, android.R.attr.state_focused,
android.R.attr.state_window_focused, android.R.attr.state_pressed });
Resources r = context.getResources();
diff --git a/src/org/nyanya/android/traditionalt9/CharMap.java b/src/org/nyanya/android/traditionalt9/CharMap.java
index 13c78fe9..e24e89cd 100644
--- a/src/org/nyanya/android/traditionalt9/CharMap.java
+++ b/src/org/nyanya/android/traditionalt9/CharMap.java
@@ -1,5 +1,6 @@
package org.nyanya.android.traditionalt9;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
@@ -8,77 +9,101 @@ import java.util.Map;
import android.util.Log;
public class CharMap {
- protected static final Map CHARTABLE;
+ protected static final ArrayList