1
0
Fork 0

Phew. Changed settings backend. Used more ENUM, fixed some bugs.

* Settings now use the database instead of SharedPreferences (which are
  bad)
  * Changed many constants to now be ENUMs.
  * Changed some character mappings which were too big.
  * Added limit to number of results returned to stop crash.
  * Changed Lang id so can do binary operations on it
  * Removed some old code
This commit is contained in:
Clam 2014-11-03 22:46:02 +11:00
parent 300e9df54b
commit b40db96182
44 changed files with 1043 additions and 483 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 894 B

After

Width:  |  Height:  |  Size: 888 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 915 B

After

Width:  |  Height:  |  Size: 817 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 823 B

After

Width:  |  Height:  |  Size: 809 B

Before After
Before After

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- taken from Sharp 007SH -->
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_window_focused="false"
android:state_enabled="true"
android:drawable="@drawable/btn_circle_normal" />
<item
android:state_window_focused="false"
android:state_enabled="false"
android:drawable="@drawable/btn_circle_disable" />
<item
android:state_enabled="false"
android:state_pressed="true"
android:drawable="@drawable/btn_circle_disable" />
<item
android:state_pressed="true"
android:drawable="@drawable/btn_circle_pressed" />
<item
android:state_focused="true"
android:state_enabled="true"
android:drawable="@drawable/btn_circle_selected" />
<item
android:state_enabled="true"
android:drawable="@drawable/btn_circle_normal" />
<item
android:state_focused="true"
android:drawable="@drawable/btn_circle_disable_focused" />
<item android:drawable="@drawable/btn_circle_disable" />
</selector>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- taken from Sharp 007SH -->
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_enabled="false"
android:drawable="@drawable/ic_btn_round_more_disabled" />
<item android:drawable="@drawable/ic_btn_round_more_normal" />
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 894 B

After

Width:  |  Height:  |  Size: 888 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 915 B

After

Width:  |  Height:  |  Size: 817 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 823 B

After

Width:  |  Height:  |  Size: 809 B

Before After
Before After

View file

@ -34,7 +34,7 @@
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:onClick="cancelButton"
android:text="@string/cancel" />
android:text="@android:string/cancel" />
</RelativeLayout>

26
res/layout/checkbox.xml Normal file
View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- taken from android source -->
<!-- Copyright (C) 2006 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Layout used by CheckBoxPreference for the checkbox style. This is inflated
inside android.R.layout.preference. -->
<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="4dip"
android:layout_gravity="center_vertical"
android:focusable="false"
android:clickable="false" />

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- taken from Sharp 007SH -->
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_gravity="center_vertical"
android:background="@drawable/btn_circle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="4.0dip"
android:src="@drawable/ic_btn_round_more"/>

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/layout/list_content.xml
**
** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawSelectorOnTop="false"
android:scrollbarAlwaysDrawVerticalTrack="true"
/>

29
res/layout/setting.xml Normal file
View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modfied from android preference.xml -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:paddingRight="?android:attr/scrollbarSize"
android:baselineAligned="false">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_marginRight="6dip"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:layout_weight="1">
<TextView android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
</RelativeLayout>
</LinearLayout>

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modfied from android preference.xml -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:paddingRight="?android:attr/scrollbarSize"
android:baselineAligned="false">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_marginRight="6dip"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:layout_weight="1">
<TextView android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
<TextView android:id="@+id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_alignLeft="@+id/title"
android:textAppearance="?android:attr/textAppearanceSmall"
android:maxLines="4" />
</RelativeLayout>
</LinearLayout>

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modfied from android preference.xml -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:paddingRight="?android:attr/scrollbarSize"
android:baselineAligned="false">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_marginRight="6dip"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:layout_weight="1">
<TextView android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
<TextView android:id="@+id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_alignLeft="@+id/title"
android:textAppearance="?android:attr/textAppearanceSmall"
android:maxLines="4" />
</RelativeLayout>
<!-- Preference should place its actual preference widget here. -->
<LinearLayout android:id="@+id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical" />
</LinearLayout>

View file

@ -21,16 +21,15 @@
<string name="symbol_page">Seite: %1$s/%2$s</string>
<string name="add_word">Wort hinzufügen</string>
<string name="ok">OK</string>
<string name="close">Schließen</string>
<string name="add_word_blank">Leeres Wort nicht hinzugefügt.</string>
<string name="add_word_badchar">Wort mit nicht zuordbarem Buchstaben für %1$s (%2$s) kann nicht hinzugefügt werden.</string>
<string name="add_word_exist1">Das Wort (%1$s) ist bereits in der DB.</string>
<string name="add_word_exist2">Das Wort (%1$s) ist bereits für %2$s in der DB.</string>
<string name="cancel">Abbrechen</string>
<string name="title_activity_add_word">Wort hinzufügen</string>
<string name="action_settings">Einstellungen</string>
<string name="database_notready">Datenbank nicht verfügbar.</string>
<string name="database_settings_notready">Database unavailable. Using default settings.</string>
<string name="updating_database_title">Wörterbuch-Datenbank wird aktualisiert…</string>
<string name="updating_database">Aktualisiere Wörterbuch-Datenbank. Das könnte einen Moment dauern.</string>

View file

@ -7,7 +7,6 @@
<string name="add_word_exist1">Слово (%1$s) уже есть в словаре.</string>
<string name="add_word_exist2">Слово (%1$s) уже есть в словаре %2$s.</string>
<string name="app_name">Traditional T9</string>
<string name="cancel">Отмена</string>
<string name="hello_world">Hello world!</string>
<string name="ime_name">Клавиатура T9</string>
<string name="ime_number">Цифры</string>
@ -18,7 +17,6 @@
<string name="main_mid_commit">Commit</string>
<string name="main_right_lower">Изменить IME</string>
<string name="main_right_upper">Режим ввода</string>
<string name="ok">OK</string>
<string name="pref_backup_noext">Ошибка: Внешняя память недоступна. Резервное копирование невозможно невозможно.</string>
<string name="pref_backup_title">Резервное копирование базы данных IME</string>
<string name="pref_backup_warn">Предупреждение: Существующая копия базы данных будет перезаписана. Продолжить?</string>
@ -62,6 +60,7 @@
<string name="pref_loaduser_notfound"> Ошибка. \n Словарь %1$s не найден. </string>
<string name="pref_mode_notify_subtitle">Используется для озвучивания изменения режима ввода.</string>
<string name="pref_mode_notify">Режим уведомления</string>
<string name="database_settings_notready">Database unavailable. Using default settings.</string>
<string name="title_activity_add_word">Добавить слово</string>
<string name="traditionalt9_settings">Traditional T9 настройки</string>

View file

@ -1,29 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="pref_inputmode_entries">
<item >Dictionary</item>
<item >Text</item>
<item >Number</item>
</string-array>
<string-array translatable="false" name="pref_inputmode_values">
<item >0</item>
<item >1</item>
<item >2</item>
<item>Dictionary</item>
<item>Text</item>
<item>Number</item>
</string-array>
<integer-array translatable="false" name="pref_inputmode_values">
<item>@integer/INPUT_DICT</item>
<item>@integer/INPUT_TEXT</item>
<item>@integer/INPUT_NUM</item>
</integer-array>
<string-array translatable="false" name="pref_lang_defaults">
<item >0</item>
</string-array>
<string-array name="pref_lang_titles">
<item >English</item>
<item >Russian</item>
<item >German</item>
</string-array>
<string-array translatable="false" name="pref_lang_values">
<item >0</item>
<item >1</item>
<item >2</item>
<item>English</item>
<item>Russian</item>
<item>German</item>
</string-array>
<integer-array translatable="false" name="pref_lang_values">
<item>@integer/LANG_EN</item>
<item>@integer/LANG_RU</item>
<item>@integer/LANG_DE</item>
</integer-array>
<string-array name="capsMode">
<item>Caps off</item>

View file

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="candidate_normal">#FF000000</color>
<color name="candidate_recommended">#FFE35900</color>
<color name="candidate_other">#ff808080</color>
<color name="candidate_background">#bbffffff</color>
<color name="button_press">#FFFCBE2B</color>
<color name="candidate_recommended">#ffc66ac3</color>
<color name="candidate_other">#ff68f0e9</color>
<color name="candidate_background">#e19185df</color>
<color name="button_focus">#FF2A9AEB</color>
<color name="button_default">#FFA8A8A8</color>
<color name="button_text">#FFFFFFFF</color>

14
res/values/const.xml Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- MAKE SURE THESE MATCH WITH LangHelper.java -->
<integer name="LANG_EN">1</integer>
<integer name="LANG_RU">2</integer>
<integer name="LANG_DE">4</integer>
<integer name="INPUT_DICT">0</integer>
<integer name="INPUT_TEXT">1</integer>
<integer name="INPUT_NUM">2</integer>
<integer name="INPUT_DEFAULT">@integer/INPUT_DICT</integer>
<integer name="LANG_DEFAULT">@integer/LANG_EN</integer>
</resources>

View file

@ -22,16 +22,15 @@
<string name="symbol_page">Page: %1$s/%2$s</string>
<string name="add_word">Add word</string>
<string name="ok">OK</string>
<string name="close">Close</string>
<string name="add_word_blank">Blank word not added.</string>
<string name="add_word_badchar">Cannot add word with unmappable character for %1$s (%2$s).</string>
<string name="add_word_exist1">Word (%1$s) already in DB.</string>
<string name="add_word_exist2">Word (%1$s) already in DB for %2$s.</string>
<string name="cancel">Cancel</string>
<string name="title_activity_add_word">Add Word</string>
<string name="action_settings">Settings</string>
<string name="database_notready">Database unavailable.</string>
<string name="database_settings_notready">Database unavailable. Using default settings.</string>
<string name="updating_database_title">Updating dictionary database…</string>
<string name="updating_database">Updating dictionary database, this might take a while.</string>

View file

@ -17,4 +17,8 @@
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<declare-styleable name="PrefItem">
<attr name="title" format="string" />
<attr name="summary" format="string" />
</declare-styleable>
</resources>

View file

@ -1,35 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:key="first_preferencescreen">
<Preference android:title="@string/pref_help" android:key="help"/>
<ListPreference
android:key="pref_inputmode"
android:title="@string/pref_inputmode"
android:dialogTitle="@string/pref_inputmode"
android:entries="@array/pref_inputmode_entries"
android:entryValues="@array/pref_inputmode_values"
android:persistent="true"
android:defaultValue="0" android:summary="@string/pref_inputmode_desc"/>
<pl.wavesoftware.widget.MultiSelectListPreference
android:defaultValue="@array/pref_lang_defaults"
android:entries="@array/pref_lang_titles"
android:entryValues="@array/pref_lang_values"
android:key="pref_lang_support"
android:persistent="true"
android:title="@string/pref_lang_title" />
<CheckBoxPreference
android:key="pref_mode_notify"
android:title="@string/pref_mode_notify"
android:summary="@string/pref_mode_notify_subtitle"
android:persistent="true"
android:defaultValue="false"
<!-- WHEN ADDING NEW SETTING KEY THAT STORES VALUE, ADD KEY AND QUERY TO T9DB -->
<Settings>
<Setting title="@string/pref_help" id="help" />
<SettingList
id="pref_inputmode"
title="@string/pref_inputmode"
entries="@array/pref_inputmode_entries"
entryValues="@array/pref_inputmode_values"
defaultValue="@integer/INPUT_DEFAULT"
summary="@string/pref_inputmode_desc"/>
<SettingMultiList
id="pref_lang_support"
defaultValue="@integer/LANG_DEFAULT"
entries="@array/pref_lang_titles"
entryValues="@array/pref_lang_values"
title="@string/pref_lang_title" />
<SettingCheck
id="pref_mode_notify"
title="@string/pref_mode_notify"
summary="@string/pref_mode_notify_subtitle"
defaultValue="false"
/>
<Preference android:title="@string/pref_loaddict" android:key="loaddict"/>
<Preference android:title="@string/pref_loaduserdict" android:summary="@string/pref_loaduserdictdesc" android:key="loaduserdict"/>
<Preference android:title="@string/pref_nukedict" android:key="nukedict"/>
<Preference android:title="@string/pref_backupdict" android:key="backupdict"/>
<Preference android:title="@string/pref_restoredict" android:key="restoredict"/>
<Preference android:title="@string/pref_querytest" android:key="querytest"/>
</PreferenceScreen>
<Setting title="@string/pref_loaddict" id="loaddict"/>
<Setting title="@string/pref_loaduserdict" summary="@string/pref_loaduserdictdesc" id="loaduserdict"/>
<Setting title="@string/pref_nukedict" id="nukedict"/>
<Setting title="@string/pref_backupdict" id="backupdict"/>
<Setting title="@string/pref_restoredict" id="restoredict"/>
</Settings>