summaryrefslogtreecommitdiff
path: root/src/ui/android
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/android')
-rw-r--r--src/ui/android/.classpath9
-rw-r--r--src/ui/android/.project33
-rw-r--r--src/ui/android/AndroidManifest.xml63
-rw-r--r--src/ui/android/LICENSE27
-rw-r--r--src/ui/android/README68
-rw-r--r--src/ui/android/ant.properties2
-rw-r--r--src/ui/android/assets/help_content.html157
-rw-r--r--src/ui/android/assets/phrases.xml1035
-rw-r--r--src/ui/android/build.xml92
-rw-r--r--src/ui/android/gf-translator-alignment.dot60
-rw-r--r--src/ui/android/gf-translator.svg28
-rw-r--r--src/ui/android/glosses.hs46
-rw-r--r--src/ui/android/hlc.svg10
-rw-r--r--src/ui/android/jni/Android.mk28
-rw-r--r--src/ui/android/jni/Application.mk3
-rw-r--r--src/ui/android/proguard-project.txt20
-rw-r--r--src/ui/android/project.properties14
-rw-r--r--src/ui/android/res/drawable-hdpi/btn_close.pngbin2220 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-hdpi/close_arrow.pngbin9643 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-hdpi/ic_action_switch.pngbin436 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-hdpi/ic_app.pngbin2458 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-hdpi/ic_drawer.pngbin2829 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-hdpi/ic_keyboard.pngbin695 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-hdpi/ic_mic.pngbin665 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-hdpi/ic_search_black_24dp.pngbin390 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-hdpi/open_arrow.pngbin8107 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-hdpi/sym_keyboard_delete.pngbin885 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-hdpi/sym_keyboard_return.pngbin536 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-hdpi/sym_keyboard_search.pngbin1623 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-hdpi/sym_keyboard_shift.pngbin1247 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-hdpi/sym_keyboard_space.pngbin859 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-mdpi/ic_action_switch.pngbin327 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-mdpi/ic_app.pngbin1502 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-mdpi/ic_drawer.pngbin2820 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-mdpi/ic_mic.pngbin437 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-mdpi/ic_search_black_24dp.pngbin249 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-mdpi/sym_keyboard_delete.pngbin465 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-mdpi/sym_keyboard_done.pngbin771 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-mdpi/sym_keyboard_return.pngbin337 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-mdpi/sym_keyboard_search.pngbin1029 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-mdpi/sym_keyboard_shift.pngbin1029 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-mdpi/sym_keyboard_space.pngbin436 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-xhdpi/ic_action_switch.pngbin547 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-xhdpi/ic_app.pngbin3672 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-xhdpi/ic_dictionary.pngbin3591 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-xhdpi/ic_drawer.pngbin2836 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-xhdpi/ic_mic.pngbin783 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-xhdpi/ic_search_black_24dp.pngbin464 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-xxhdpi/ic_app.pngbin6265 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-xxhdpi/ic_drawer.pngbin202 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-xxhdpi/ic_search_black_24dp.pngbin684 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable-xxxhdpi/ic_search_black_24dp.pngbin868 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable/first_person_utterance_bg.xml6
-rw-r--r--src/ui/android/res/drawable/grid_phrasebook_button.xml7
-rw-r--r--src/ui/android/res/drawable/ic_volume_up_black_18dp.pngbin282 -> 0 bytes
-rw-r--r--src/ui/android/res/drawable/second_person_best_utterance_bg.xml6
-rw-r--r--src/ui/android/res/drawable/second_person_chunk_utterance_bg.xml6
-rw-r--r--src/ui/android/res/drawable/second_person_utterance_bg.xml6
-rw-r--r--src/ui/android/res/drawable/second_person_worst_utterance_bg.xml6
-rw-r--r--src/ui/android/res/layout/activity_help.xml11
-rw-r--r--src/ui/android/res/layout/activity_lexical_entry.xml80
-rw-r--r--src/ui/android/res/layout/activity_main.xml91
-rw-r--r--src/ui/android/res/layout/activity_navigation.xml16
-rw-r--r--src/ui/android/res/layout/activity_semantic_graph.xml61
-rw-r--r--src/ui/android/res/layout/alternative_item.xml36
-rw-r--r--src/ui/android/res/layout/checkbox_input_list_item.xml13
-rw-r--r--src/ui/android/res/layout/first_person_utterance.xml11
-rw-r--r--src/ui/android/res/layout/fragment_phrase_list.xml16
-rw-r--r--src/ui/android/res/layout/fragment_translator.xml60
-rw-r--r--src/ui/android/res/layout/input.xml9
-rw-r--r--src/ui/android/res/layout/keyboard_languages_options.xml20
-rw-r--r--src/ui/android/res/layout/languages_item.xml8
-rw-r--r--src/ui/android/res/layout/lexical_item.xml27
-rw-r--r--src/ui/android/res/layout/number_input_list_item.xml28
-rw-r--r--src/ui/android/res/layout/phrase_list_item.xml13
-rw-r--r--src/ui/android/res/layout/second_person_utterance.xml12
-rw-r--r--src/ui/android/res/layout/spinner_input_list_item.xml19
-rw-r--r--src/ui/android/res/menu/main.xml10
-rw-r--r--src/ui/android/res/values-sw600dp/dimens.xml8
-rw-r--r--src/ui/android/res/values-sw720dp-land/dimens.xml9
-rw-r--r--src/ui/android/res/values-v11/styles.xml11
-rw-r--r--src/ui/android/res/values-v14/styles.xml12
-rw-r--r--src/ui/android/res/values/attrs.xml6
-rw-r--r--src/ui/android/res/values/colors.xml9
-rw-r--r--src/ui/android/res/values/dimens.xml10
-rw-r--r--src/ui/android/res/values/strings.xml38
-rw-r--r--src/ui/android/res/values/styles.xml24
-rw-r--r--src/ui/android/res/xml/cyrillic.xml76
-rw-r--r--src/ui/android/res/xml/devanagari_page1.xml67
-rw-r--r--src/ui/android/res/xml/devanagari_page2.xml67
-rw-r--r--src/ui/android/res/xml/method.xml6
-rw-r--r--src/ui/android/res/xml/nordic.xml77
-rw-r--r--src/ui/android/res/xml/popup_keyboard.xml5
-rw-r--r--src/ui/android/res/xml/qwerty.xml74
-rw-r--r--src/ui/android/res/xml/searchable.xml8
-rw-r--r--src/ui/android/res/xml/symbols_page1.xml73
-rw-r--r--src/ui/android/res/xml/symbols_page2.xml71
-rw-r--r--src/ui/android/res/xml/thai_page1.xml86
-rw-r--r--src/ui/android/res/xml/thai_page2.xml83
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/ASR.java240
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/AlternativesActivity.java674
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/CompletionsView.java291
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/ConversationView.java242
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/GFTranslator.java22
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/HelpActivity.java15
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/Language.java62
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/LanguageSelector.java55
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/LanguagesAdapter.java16
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/LexiconSuggestionProvider.java52
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/LocaleUtils.java42
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/MainActivity.java377
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/ParseTreeView.java270
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/RotationGestureDetector.java109
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraph.java235
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraphActivity.java102
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraphManager.java101
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraphView.java144
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/TTS.java75
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/Translator.java777
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/TranslatorInputMethodService.java666
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/TranslatorKeyboard.java107
-rw-r--r--src/ui/android/src/org/grammaticalframework/ui/android/TranslatorKeyboardView.java128
-rw-r--r--src/ui/android/src/se/chalmers/phrasebook/backend/Model.java206
-rw-r--r--src/ui/android/src/se/chalmers/phrasebook/backend/syntax/ChoiceContext.java61
-rw-r--r--src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntacticChoice.java25
-rw-r--r--src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNode.java33
-rw-r--r--src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeArgument.java15
-rw-r--r--src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeBoolean.java7
-rw-r--r--src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeCall.java52
-rw-r--r--src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeFunction.java39
-rw-r--r--src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeNumeral.java84
-rw-r--r--src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeOption.java22
-rw-r--r--src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxTree.java33
-rw-r--r--src/ui/android/src/se/chalmers/phrasebook/gui/activities/NavigationActivity.java79
-rw-r--r--src/ui/android/src/se/chalmers/phrasebook/gui/fragments/PhraseListFragment.java86
-rw-r--r--src/ui/android/src/se/chalmers/phrasebook/gui/fragments/TranslatorFragment.java253
-rw-r--r--src/ui/android/topics.txt951
137 files changed, 0 insertions, 9841 deletions
diff --git a/src/ui/android/.classpath b/src/ui/android/.classpath
deleted file mode 100644
index 7bc01d9a9..000000000
--- a/src/ui/android/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="gen"/>
- <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
- <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
- <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
- <classpathentry kind="output" path="bin/classes"/>
-</classpath>
diff --git a/src/ui/android/.project b/src/ui/android/.project
deleted file mode 100644
index abf063e43..000000000
--- a/src/ui/android/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>GFTranslator</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.ApkBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/src/ui/android/AndroidManifest.xml b/src/ui/android/AndroidManifest.xml
deleted file mode 100644
index 84b837a08..000000000
--- a/src/ui/android/AndroidManifest.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.grammaticalframework.ui.android"
- android:versionCode="15"
- android:versionName="1.2.2"
- android:installLocation="auto" >
-
- <uses-sdk
- android:minSdkVersion="11"
- android:targetSdkVersion="18" />
-
- <uses-permission android:name="android.permission.RECORD_AUDIO" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_app"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" android:name="GFTranslator">
- <activity
- android:name=".MainActivity"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name="AlternativesActivity">
- <intent-filter>
- <action android:name="android.intent.action.VIEW"/>
- <category android:name="android.intent.category.DEFAULT"/>
- <category android:name="android.intent.category.BROWSABLE"/>
- <data android:scheme="gf-translator"/>
- </intent-filter>
- </activity>
- <activity android:name="HelpActivity"></activity>
- <activity android:name="SemanticGraphActivity"
- android:launchMode="singleTop">
- <intent-filter>
- <action android:name="android.intent.action.SEARCH" />
- </intent-filter>
- <meta-data android:name="android.app.searchable"
- android:resource="@xml/searchable"/>
- <meta-data android:name="android.app.default_searchable"
- android:value=".SearchableActivity"/>
- </activity>
-
- <activity android:name="se.chalmers.phrasebook.gui.activities.NavigationActivity"></activity>
-
- <service android:name="TranslatorInputMethodService"
- android:permission="android.permission.BIND_INPUT_METHOD">
- <intent-filter>
- <action android:name="android.view.InputMethod" />
- </intent-filter>
- <meta-data android:name="android.view.im" android:resource="@xml/method" />
- </service>
- <provider android:name=".LexiconSuggestionProvider"
- android:authorities="org.grammaticalframework.ui.android.LexiconSuggestionProvider">
- <path-permission android:pathPrefix="/search_suggest_query"
- android:readPermission="android.permission.GLOBAL_SEARCH"/>
- </provider>
- </application>
-</manifest>
diff --git a/src/ui/android/LICENSE b/src/ui/android/LICENSE
deleted file mode 100644
index cf90ceb14..000000000
--- a/src/ui/android/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
- BSD LICENSE
-
-Copyright (c) 1998, Grammatical Framework
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the <organization> nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/src/ui/android/README b/src/ui/android/README
deleted file mode 100644
index 7adb7fe50..000000000
--- a/src/ui/android/README
+++ /dev/null
@@ -1,68 +0,0 @@
-= Overview =
-
-This directory contains a sample Android app tht uses
-the Android speech recognition and TTS APIs along with
-JNI bindings to the C PGF runtime to implement a simple
-speech translation app.
-
-
-= Requirements =
-
-1. Android SDK: http://developer.android.com/sdk/
- installed in $ANDROID_SDK_LOCATION
-
-2. Android NDK: http://developer.android.com/tools/sdk/ndk/
- installed in $ANDROID_NDK_LOCATION
-
-= Building =
-
-Set up Android project:
-
-# Creates local.properties, not to be checked in
-$ $ANDROID_SDK_LOCATION/tools/android update project -p .
-
-Build libs/libjpgf.jar:
-
-$ (cd ../../runtime/java && javac org/grammaticalframework/*/*.java && jar -cf ../../ui/android/libs/jpgf.jar org/grammaticalframework/*/*.class)
-
-Build JNI code:
-
-$ cd jni
-$ $ANDROID_NDK_LOCATION/ndk-build
-
-Build the semantic database code:
-
-$ runghc glosses.hs
-
-Build APK:
-
-$ ant debug
-
-
-Install on your device:
-
-$ ant debug install
-
-or:
-
-$ adb install -r bin/MainActivity-debug.apk
-
-
-= Changing the grammar =
-
-1. Replace assets/ResourceDemo.pgf
-
-2. Edit Translator.java to point to the new file and include its metadata
-
-
-= Developing in Eclipse =
-
-1. Install Android ADT
-
-2. Eclipse > File > Import > Existing Projects into Workspace > Next
-
-3. Select root directory...
-
-4. Select GF/src/ui/android
-
-5. Finish \ No newline at end of file
diff --git a/src/ui/android/ant.properties b/src/ui/android/ant.properties
deleted file mode 100644
index 59ddc9800..000000000
--- a/src/ui/android/ant.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-key.store=/home/krasimir/dg/src/keys/dg_keystore
-key.alias=dg
diff --git a/src/ui/android/assets/help_content.html b/src/ui/android/assets/help_content.html
deleted file mode 100644
index 279a2a963..000000000
--- a/src/ui/android/assets/help_content.html
+++ /dev/null
@@ -1,157 +0,0 @@
-<html>
-<body>
-</p>
-<b>GF Offline Translator</b>:
-text and speech translation for 16 languages with
-quality control. Version 19 April 2017 (beta).
-</p>
-<p>
-<b>Speech input</b>: Tap microphone icon and talk while it is red.
-<br>
-<b>Text input</b>: Select "keyboard" from menu, tap keyboard icon.
-<br>
-<b>Correction</b>: Tap input text and edit.
-<br>
-<b>Alternatives</b>: Tap output text.
-<br>
-<b>Grammar info</b>: Tap any of the alternatives.
-<br>
-<b>Confidence</b>: colour of output text
-<ul>
-<li><span style="background-color:palegreen">Green</span>: semantic, probably correct (but has alternatives)</li>
-<li><span style="background-color:yellow">Yellow</span>: syntactic, often incorrect (has alternatives)</li>
-<li><span style="background-color:pink">Light red</span>: chunk-based, probably incorrect (has alternatives)</li>
-<li><span style="background-color:red">Dark red</span>: word-based, often very bad</li>
-</ul>
-<br>
-<b>Topics</b> (new, select from menu): Words grouped by semantic categories, with WordNet glosses.
-<br>
-<b>Phrasebook</b> (new, select from menu): Conceptual authoring with the green translations.
-</p>
-
-<hr>
-
-<h2>More details</h2>
-<p>
-GF Offline Translator is based on grammar and semantics. It is compact in size
-and gives control on quality. Its technology is inspired by compilers, which are
-programs that translate computer languages.
-Most other translators for human language are based on
-statistics and have less control of quality and are much bigger, so that
-they require either an internet connection or a huge storage on your phone.
-</p>
-The app indicates translation confidence with colours:
-<ul>
- <li><b>Green</b>:
- semantic translation, should be correct.
- But not necessarily the only correct one.
- You can tap the output to see alternatives.
- </li>
- <li><b>Yellow</b>:
- syntactic translation, should be grammatically correct.
- But can be very strange in its interpretation and choice of words.
- </li>
- <li><b>Light red</b>:
- chunk translation, probably incorrect.
- Builds the translation from small pieces.
- </li>
- <li><b>Dark red</b>:
- word-by-word translation, almost certainly incorrect.
- Builds the translation word by word.
- </li>
-</ul>
-The green translations come from a tourist phrasebook, which allows
-you to translate things like "hello" and "how far is the airport from
-the hotel".
-</p>
-
-<p>
-You can translate both speech and text, as selected in the menu in the
-upper right corner. Both kinds of input can be edited with the
-keyboard by first tapping at the input field. This is often needed
-because of <b>speech recognition errors</b>. Changing words
-from <b>upper to lower case</b> may also be needed.
-At the moment, <b>Japanese</b> and <b>Thai</b> input must be separated
-to words, whereas Chinese works without spaces.
-</p>
-<p>
-Translation works between any of the 16 supported languages, which means 240
-language pairs in the current version. But different languages are on different levels of development.
-The following table gives a rough idea of what to expect:
-</p>
-
-<p>
-<center>
-<table rules=all border=yes>
-<tr> <th></th> <th>coverage</th> <th>quality</th> <th>speed</th> <th>speech</th> </tr>
-<tr> <th>Bulgarian</th> <td bgcolor=yellow></td> <td bgcolor=yellow></td><td bgcolor=palegreen></td> <td bgcolor=yellow>in only</td></tr>
-<tr> <th>Catalan</th> <td bgcolor=pink></td> <td bgcolor=yellow></td><td bgcolor=pink></td> <td bgcolor=yellow></td></tr>
-<tr> <th>Chinese</th> <td bgcolor=pink></td> <td bgcolor=pink></td> <td bgcolor=palegreen></td> <td bgcolor=yellow></td> </tr>
-<tr> <th>Dutch</th> <td bgcolor=yellow></td> <td bgcolor=yellow></td> <td bgcolor=yellow></td> <td bgcolor=palegreen></td> </tr>
-<tr> <th>English</th> <td bgcolor=palegreen></td> <td bgcolor=palegreen></td> <td bgcolor=palegreen></td> <td bgcolor=palegreen></td> </tr>
-<tr> <th>Estonian</th> <td bgcolor=yellow></td> <td bgcolor=yellow></td><td bgcolor=pink></td> <td bgcolor=red></td></tr>
-<tr> <th>Finnish</th> <td bgcolor=yellow></td> <td bgcolor=yellow></td><td bgcolor=pink></td> <td bgcolor=yellow></td></tr>
-<tr> <th>French</th> <td bgcolor=pink></td> <td bgcolor=yellow></td><td bgcolor=pink></td> <td bgcolor=palegreen></td></tr>
-<tr> <th>German</th> <td bgcolor=pink></td> <td bgcolor=yellow></td><td bgcolor=pink></td> <td bgcolor=palegreen></td></tr>
-<tr> <th>Hindi</th> <td bgcolor=pink></td> <td bgcolor=red></td> <td bgcolor=yellow></td> <td bgcolor=yellow></td> </tr>
-<tr> <th>Italian</th> <td bgcolor=pink></td> <td bgcolor=pink></td><td bgcolor=pink></td> <td bgcolor=palegreen></td></tr>
-<tr> <th>Japanese*</th><td bgcolor=pink></td> <td bgcolor=pink></td><td bgcolor=yellow></td> <td bgcolor=palegreen></td></tr>
-<tr> <th>Russian</th> <td bgcolor=pink></td> <td bgcolor=red></td> <td bgcolor=yellow></td> <td bgcolor=yellow></td> </tr>
-<tr> <th>Spanish</th> <td bgcolor=pink></td> <td bgcolor=yellow></td><td bgcolor=pink></td> <td bgcolor=palegreen></td></tr>
-<tr> <th>Swedish</th> <td bgcolor=yellow></td> <td bgcolor=yellow></td> <td bgcolor=palegreen></td> <td bgcolor=yellow></td></tr>
-<tr> <th>Thai*</th> <td bgcolor=pink></td> <td bgcolor=pink></td><td bgcolor=yellow></td> <td bgcolor=palegreen></td></tr>
-</table>
-</center>
-* For translation from Japanese and Thai you need to separate each word with a space
-</p>
-<p>
-The speech input and output use Google's voice services. Their status
-can hence change without notice. You can make it more stable by
-installing third-party speech tools, such as SVOX, which provides
-output for most of the listed languages.
-</p>
-
-<p>
-When you tap on a translation you get a screen with <b>alternative translations</b>.
-Tapping on each of the alternatives
-gives you <b>grammatical information</b>:
-an inflection table, if it is a single word,
-and a syntax tree otherwise.
-</p>
-
-<p>
-The app also provides an <b>input method</b> which you can use as
-an alternative keyboard which allows you to do translation from
-other applications, for instance while you are entering SMS or e-mail.
-To activate it go to Settings > Language &amp; input.
-</p>
-
-<p>
-The translation works <b>completely off-line</b>, without
-internet connection, when doing text-based translation.
-Even speech works off-line in some languages,
-but being on-line may give you better
-speech input and output and more languages.
-</p>
-<p>
-You can also install third-party off-line speech engines, such as
-<a href="https://play.google.com/store/apps/developer?id=SVOX+Mobile+Voices&hl=en">SVOX</a>.
-Consult the voice/language settings on your phone to find the optimal
-speech engines, and restart the app after changing the settings.
-</p>
-
-<p>
-The GF Offline Translator is powered by
-<a href="http://www.grammaticalframework.org/">GF</a>, Grammatical Framework.
-It is open-source software,
-built by support from the GF community and from <a href="http://www.digitalgrammars.com/">Digital Grammars</a>.
-</p>
-
-<p>
-<i>Digital Grammars is a company that can tailor this app to you needs and provide good
-translation for the kind of vocabulary you need. Just tell us what you want to see
- in the green area!</i>
-</p>
-
-</body>
-</html>
diff --git a/src/ui/android/assets/phrases.xml b/src/ui/android/assets/phrases.xml
deleted file mode 100644
index 847339135..000000000
--- a/src/ui/android/assets/phrases.xml
+++ /dev/null
@@ -1,1035 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<phrasebook>
- <sentence desc="Greetings" id="PGreeting">
- <option>
- <function desc="Male Speaker" name="PGreetingMale">
- <call ref="Greeting"/>
- </function>
- <function desc="Female Speaker" name="PGreetingFemale">
- <call ref="Greeting"/>
- </function>
- </option>
- </sentence>
-
- <sentence desc="Fixed Phrases" id="PPhrase">
- <option>
- <function desc="Male Speaker" name="PGreetingMale">
- <call ref="Phrase"/>
- </function>
- <function desc="Female Speaker" name="PGreetingFemale">
- <call ref="Phrase"/>
- </function>
- </option>
- </sentence>
-
- <sentence desc="What is somebody's name?" id="QWhatName">
- <function name="PQuestion">
- <function name="QWhatName">
- <call desc="Who are we talking about?" ref="Person"/>
- </function>
- </function>
- </sentence>
-
- <sentence desc="Somebody's name is..." id="AHasName">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AHasName">
- <call ref="Person"/>
- <function name="NameNN"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="How old is someone?" id="QWhatAge">
- <function name="PQuestion">
- <function name="QWhatAge">
- <call ref="Person"/>
- </function>
- </function>
- </sentence>
-
- <sentence desc="Someone's age is..." id="AHasAge">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AHasAge">
- <call ref="Person"/>
- <function name="NNumeral">
- <numeral desc="How many years?"/>
- </function>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone loves someone" id="ALove">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="ALove">
- <call desc="Who loves someone?" ref="Person"/>
- <call desc="Who is loved?" ref="Person"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence advanced="true" desc="Someone is married" id="AMarried">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AMarried">
- <call ref="Person"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone has children" id="AHasChildren">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AHasChildren">
- <call ref="Person"/>
- <function name="NNumeral">
- <numeral desc="How many children?"/>
- </function>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone has something" id="SHave">
- <function name="SHave">
- <call ref="Person"/>
- <call desc="What do you have?" ref="Object"/>
- </function>
- </sentence>
-
- <sentence desc="Someone has currency" id="AHaveCurr">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AHaveCurr">
- <call ref="Person"/>
- <call ref="Currency"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone lives somewhere" id="ALive">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="ALive">
- <call ref="Person"/>
- <call desc="Living where?" ref="country"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone wants to go somewhere" id="AWantGo">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AWantGo">
- <call ref="Person"/>
- <call ref="Place"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone is a citizen" id="ACitizen">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="ACitizen">
- <call ref="Person"/>
- <call desc="Living where?" ref="country"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone is somewhere" id="ABePlace">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="ABePlace">
- <call ref="Person"/>
- <call ref="Place"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Something is something" id="Is">
- <call ref="phraseit">
- <function name="Is">
- <call ref="Item"/>
- <call ref="Quality"/>
- </function>
- </call>
- </sentence>
-
- <sentence desc="How far is something?" id="HowFar">
- <function name="PQuestion">
- <function name="HowFar">
- <call desc="What place are we asking about?" ref="Place"/>
- </function>
- </function>
- </sentence>
-
- <sentence desc="How far is something from somewhere?" id="HowFarFrom">
- <function name="PQuestion">
- <function name="HowFarFrom">
- <call desc="Where are we going from?" ref="Place"/>
- <call desc="Where are we going to?" ref="Place"/>
- </function>
- </function>
- </sentence>
-
- <sentence desc="Some place is open" id="PropOpen">
- <call ref="phraseit">
- <option>
- <function desc="now" name="PropOpen">
- <call ref="Place"/>
- </function>
- <function desc="on a specific date" name="PropOpenDate">
- <call ref="Place"/>
- <call ref="Date"/>
- </function>
- <function desc="on a specific day of the week" name="PropOpenDay">
- <call ref="Place"/>
- <call ref="Day"/>
- </function>
- </option>
- </call>
- </sentence>
-
- <sentence desc="Some place is closed" id="PropClosed">
- <call ref="phraseit">
- <option>
- <function desc="now" name="PropClosed">
- <call ref="Place"/>
- </function>
- <function desc="on a specific date" name="PropClosedDate">
- <call ref="Place"/>
- <call ref="Date"/>
- </function>
- <function desc="on a specific day of the week" name="PropClosedDay">
- <call ref="Place"/>
- <call ref="Day"/>
- </function>
- </option>
- </call>
- </sentence>
-
- <sentence desc="Someone wants some food" id="AWant">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AWant">
- <call desc="Who wants food?" ref="Person"/>
- <call ref="Object"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone likes some food" id="ALike">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="ALike">
- <call desc="Who likes it?" ref="Person"/>
- <call ref="Item"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone has a table" id="AHasTable">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AHasTable">
- <call ref="Person"/>
- <function name="NNumeral">
- <numeral desc="How many persons?"/>
- </function>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone has a room" id="AHasRoom">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AHasRoom">
- <call ref="Person"/>
- <function name="NNumeral">
- <numeral desc="How many persons?"/>
- </function>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone is hungry" id="AHungry">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AHungry">
- <call ref="Person"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone is thirsty" id="AThirsty">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AThirsty">
- <call ref="Person" />
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone is tired" id="ATired">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="ATired">
- <call ref="Person" />
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone is scared" id="AScared">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AScared">
- <call ref="Person"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone is ill" id="AIll">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AIll">
- <call ref="Person"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone is ready" id="AReady">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AReady">
- <call ref="Person"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone does something" id="ADoVerbPhrase">
- <call ref="phraseit">
- <function name="PropAction">
- <option desc="Modality">
- <call desc="No modality" ref="do"/>
- <call desc="can" ref="modal_do">
- <function desc="can" name="MCan"/>
- </call>
- <call desc="know" ref="modal_do">
- <function desc="know" name="MKnow"/>
- </call>
- <call desc="must" ref="modal_do">
- <function desc="must" name="MMust"/>
- </call>
- <call desc="want" ref="modal_do">
- <function desc="want" name="MWant"/>
- </call>
- </option>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone speaks a language" id="ASpeak">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="ASpeak">
- <call desc="Who speaks it?" ref="Person"/>
- <call ref="language"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone understands" id="AUnderstand">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AUnderstand">
- <call ref="Person"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone knows" id="AKnow">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AKnow">
- <call ref="Person"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Someone knows someone" id="AKnowPerson">
- <call ref="phraseit">
- <function name="PropAction">
- <function name="AKnowPerson">
- <call desc="Who knows it?" ref="Person"/>
- <call desc="Who is known?" ref="Person"/>
- </function>
- </function>
- </call>
- </sentence>
-
- <sentence desc="How much does something cost?" id="HowMuchCost">
- <function name="PQuestion">
- <function name="HowMuchCost">
- <call ref="Item"/>
- </function>
- </function>
- </sentence>
-
- <sentence desc="Something costs ..." id="ItCost">
- <call ref="phraseit">
- <function name="ItCost">
- <call ref="Item"/>
- <call ref="Price"/>
- </function>
- </call>
- </sentence>
-
- <sentence desc="Commands" id="PImperative">
- <option>
- <function desc="positive, familiar" name="PImperativeFamPos">
- <call ref="VerbPhrase"/>
- </function>
- <function desc="positive, polite" name="PImperativePolPos">
- <call ref="VerbPhrase"/>
- </function>
- <function desc="positive, plural" name="PImperativePlurPos">
- <call ref="VerbPhrase"/>
- </function>
- <function desc="negated, familiar" name="PImperativeFamNeg">
- <call ref="VerbPhrase"/>
- </function>
- <function desc="negated, polite" name="PImperativePolNeg">
- <call ref="VerbPhrase"/>
- </function>
- <function desc="negative, plural" name="PImperativePlurNeg">
- <call ref="VerbPhrase"/>
- </function>
- </option>
- </sentence>
-
- <sentence desc="Price" id="PPrice">
- <function name="PPrice">
- <call ref="Price"/>
- </function>
- </sentence>
-
- <sentence desc="Number" id="Number">
- <function name="PNumber">
- <function name="NNumeral">
- <numeral desc="Which number?"/>
- </function>
- </function>
- </sentence>
-
- <!-- ___________________________________________________________________________________________ -->
- <!--Option lists -->
- <option desc="Who are we talking about?" id="Person">
- <function desc="me (male)" name="IMale" />
- <function desc="me (female)" name="IFemale" />
- <function desc="you (a male friend)" name="YouFamMale" />
- <function desc="you (a female friend)" name="YouFamFemale" />
- <function desc="you (a male stranger)" name="YouPolMale" />
- <function desc="you (a female stranger)" name="YouPolFemale" />
- <function desc="he" name="He"/>
- <function desc="she" name="She"/>
- <function desc="we (male)" name="WeMale"/>
- <function desc="we (female)" name="WeFemale"/>
- <function desc="you (male friends)" name="YouPlurFamMale"/>
- <function desc="you (female friends)" name="YouPlurFamFemale"/>
- <function desc="you (male strangers)" name="YouPlurPolMale"/>
- <function desc="you (female strangers)" name="YouPlurPolFemale"/>
- <function desc="they (male)" name="TheyMale"/>
- <function desc="they (female)" name="TheyFemale"/>
- <function desc="Wife of ..." name="Wife">
- <call ref="Person"/>
- </function>
- <function desc="Husband of ..." name="Husband">
- <call ref="Person"/>
- </function>
- <function desc="Daughter of ..." name="Daughter">
- <call ref="Person"/>
- </function>
- <function desc="Son of ..." name="Son">
- <call ref="Person"/>
- </function>
- <function desc="Children of ..." name="Children">
- <call ref="Person"/>
- </function>
- </option>
-
- <option desc="How to phrase it?" id="phraseit">
- <function desc="As a statement" name="PSentence">
- <function name="SProp">
- <boolean desc="Reported Speech">
- <argument/>
- <function name="PropAction">
- <option>
- <function desc="As a statement" name="AKnowSentence">
- <call ref="Person"/>
- <function name="SProp">
- <argument/>
- </function>
- </function>
- <function desc="As a question" name="AKnowQuestion">
- <call ref="Person"/>
- <function name="QProp">
- <argument/>
- </function>
- </function>
- <function desc="As a negation" name="AKnowSentence">
- <call ref="Person"/>
- <function name="SPropNot">
- <argument/>
- </function>
- </function>
- </option>
- </function>
- </boolean>
- </function>
- </function>
- <function desc="As a question" name="PQuestion">
- <function name="QProp">
- <boolean desc="Reported Speech">
- <argument/>
- <function name="PropAction">
- <option>
- <function desc="As a statement" name="AKnowSentence">
- <call ref="Person"/>
- <function name="SProp">
- <argument/>
- </function>
- </function>
- <function desc="As a question" name="AKnowQuestion">
- <call ref="Person"/>
- <function name="QProp">
- <argument/>
- </function>
- </function>
- <function desc="As a negation" name="AKnowSentence">
- <call ref="Person"/>
- <function name="SPropNot">
- <argument/>
- </function>
- </function>
- </option>
- </function>
- </boolean>
- </function>
- </function>
- <function desc="As a negation" name="PSentence">
- <function name="SPropNot">
- <boolean desc="Reported Speech">
- <argument/>
- <function name="PropAction">
- <option>
- <function desc="As a statement" name="AKnowSentence">
- <call ref="Person"/>
- <function name="SProp">
- <argument/>
- </function>
- </function>
- <function desc="As a question" name="AKnowQuestion">
- <call ref="Person"/>
- <function name="QProp">
- <argument/>
- </function>
- </function>
- <function desc="As a negation" name="AKnowSentence">
- <call ref="Person"/>
- <function name="SPropNot">
- <argument/>
- </function>
- </function>
- </option>
- </function>
- </boolean>
- </function>
- </function>
- </option>
-
- <option id="language" desc="What language?">
- <function desc="Bulgarian" name="(LangNat Bulgarian)"/>
- <function desc="Catalan" name="(LangNat Catalan)"/>
- <function desc="Danish" name="(LangNat Danish)"/>
- <function desc="Dutch" name="(LangNat Dutch)"/>
- <function desc="English" name="(LangNat English)"/>
- <function desc="Finnish" name="(LangNat Finnish)"/>
- <function desc="Flemish" name="Flemish"/>
- <function desc="French" name="(LangNat French)"/>
- <function desc="German" name="(LangNat German)"/>
- <function desc="Italian" name="(LangNat Italian)"/>
- <function desc="Norwegian" name="(LangNat Norwegian)"/>
- <function desc="Polish" name="(LangNat Polish)"/>
- <function desc="Romanian" name="(LangNat Romanian)"/>
- <function desc="Russian" name="(LangNat Russian)"/>
- <function desc="Spanish" name="(LangNat Spanish)"/>
- <function desc="Swedish" name="(LangNat Swedish)"/>
- </option>
-
- <option id="Citizenship" desc="What nationality">
- <function desc="Belgian" name="Belgian"/>
- <function desc="Bulgarian" name="CitiNat Bulgarian"/>
- <function desc="Catalan" name="CitiNat Catalan"/>
- <function desc="Dutch" name="CitiNat Dutch"/>
- <function desc="Danish" name="CitiNat Danish"/>
- <function desc="English" name="CitiNat English"/>
- <function desc="Finnish" name="CitiNat Finnish"/>
- <function desc="French" name="CitiNat French"/>
- <function desc="German" name="CitiNat German"/>
- <function desc="Italian" name="CitiNat Italian"/>
- <function desc="Norwegian" name="CitiNat Norwegian"/>
- <function desc="Polish" name="CitiNat Polish"/>
- <function desc="Romanian" name="CitiNat Romanian"/>
- <function desc="Russian" name="CitiNat Russian"/>
- <function desc="Spanish" name="CitiNat Spanish"/>
- <function desc="Swedish" name="CitiNat Swedish"/>
- </option>
-
- <option desc="What place are we asking about?" id="PlaceKind">
- <function desc="airport" name="Airport"/>
- <function desc="amusement park" name="AmusementPark"/>
- <function desc="bank" name="Bank"/>
- <function desc="bar" name="Bar"/>
- <function desc="cafeteria" name="Cafeteria"/>
- <function desc="center" name="Center"/>
- <function desc="church" name="Church"/>
- <function desc="cinema" name="Cinema"/>
- <function desc="car park" name="Parking"/>
- <function desc="disco" name="Disco"/>
- <function desc="hospital" name="Hospital"/>
- <function desc="hotel" name="Hotel"/>
- <function desc="museum" name="Museum"/>
- <function desc="park" name="Park"/>
- <function desc="pharmacy" name="Pharmacy"/>
- <function desc="post office" name="PostOffice"/>
- <function desc="pub" name="Pub"/>
- <function desc="restaurant" name="Restaurant"/>
- <function desc="restaurant (National)" name="CitRestaurant">
- <call ref="Citizenship"/>
- </function>
- <function desc="school" name="School"/>
- <function desc="shop" name="Shop"/>
- <function desc="station" name="Station"/>
- <function desc="supermarket" name="Supermarket"/>
- <function desc="theatre" name="Theatre"/>
- <function desc="toilet" name="Toilet"/>
- <function desc="university" name="University"/>
- <function desc="zoo" name="Zoo"/>
- </option>
-
- <option id="Place">
- <function desc="a/an" name="APlace">
- <call ref="PlaceKind"/>
- </function>
- <function desc="the" name="ThePlace">
- <call ref="PlaceKind"/>
- </function>
- <function desc="the best" name="SuperlPlace">
- <function name="TheBest"/>
- <call ref="PlaceKind"/>
- </function>
- <function desc="the worst" name="SuperlPlace">
- <function name="TheWorst"/>
- <call ref="PlaceKind"/>
- </function>
- <function desc="the nearest" name="SuperlPlace">
- <function name="TheClosest"/>
- <call ref="PlaceKind"/>
- </function>
- <function desc="the cheapest" name="SuperlPlace">
- <function name="TheCheapest"/>
- <call ref="PlaceKind"/>
- </function>
- <function desc="the most expensive" name="SuperlPlace">
- <function name="TheMostExpensive"/>
- <call ref="PlaceKind"/>
- </function>
- <function desc="the most popular" name="SuperlPlace">
- <function name="TheMostPopular"/>
- <call ref="PlaceKind"/>
- </function>
- </option>
-
- <option id="country" desc="What nationality">
- <function desc="Belgium" name="Belgium"/>
- <function desc="Bulgaria" name="(CountryNat Bulgarian)"/>
- <function desc="Catalonia" name="(CountryNat Catalan)"/>
- <function desc="The Netherlands" name="(CountryNat Dutch)"/>
- <function desc="Denmark" name="(CountryNat Danish)"/>
- <function desc="England" name="(CountryNat English)"/>
- <function desc="Finland" name="(CountryNat Finnish)"/>
- <function desc="France" name="(CountryNat French)"/>
- <function desc="Germany" name="(CountryNat German)"/>
- <function desc="Italy" name="(CountryNat Italian)"/>
- <function desc="Norway" name="(CountryNat Norwegian)"/>
- <function desc="Poland" name="(CountryNat Polish)"/>
- <function desc="Romania" name="(CountryNat Romanian)"/>
- <function desc="Russia" name="(CountryNat Russian)"/>
- <function desc="Spain" name="(CountryNat Spanish)"/>
- <function desc="Sweden" name="(CountryNat Swedish)"/>
- </option>
-
- <option desc="What is being wanted?" id="Object">
- <function desc="a/an" name="OneObj">
- <call ref="IndefItem"/>
- </function>
- <function desc="the" name="OneObj">
- <function name="ObjItem">
- <call ref="DefItem"/>
- </function>
- </function>
- <function desc="this" name="OneObj">
- <function name="ObjItem">
- <call ref="ThisItem"/>
- </function>
- </function>
- <function desc="that" name="OneObj">
- <function name="ObjItem">
- <call ref="ThatItem"/>
- </function>
- </function>
- <function desc="(plural)" name="OneObj">
- <function name="ObjPlural">
- <call ref="Kind"/>
- </function>
- </function>
- </option>
-
- <option desc="Determiner" id="Item">
- <call desc="the" ref="DefItem"/>
- <call desc="this" ref="ThisItem"/>
- <call desc="that" ref="ThatItem"/>
- </option>
-
- <option id="IndefItem" desc="What are we talking about?">
- <function desc="apple" name="(ObjIndef Apple)"/>
- <function desc="beer" name="(ObjMass (MassDrink Beer))"/>
- <function desc="bread" name="(ObjMass Bread)"/>
- <function desc="cheese" name="(ObjMass Cheese)"/>
- <function desc="chicken" name="(ObjMass Chicken)"/>
- <function desc="coffee" name="(ObjMass (MassDrink Coffee))"/>
- <function desc="fish" name="(ObjMass Fish)"/>
- <function desc="meat" name="(ObjMass Meat)"/>
- <function desc="milk" name="(ObjMass Milk)"/>
- <function desc="pizza" name="(ObjIndef Pizza)"/>
- <function desc="salt" name="(ObjMass Salt)"/>
- <function desc="tea" name="(ObjMass (MassDrink Tea))"/>
- <function desc="water" name="(ObjMass (MassDrink Water))"/>
- <function desc="wine" name="(ObjMass (MassDrink Wine))"/>
- <function desc="(with quality)" name="ObjMass">
- <function name="SuchMassKind">
- <call ref="Quality"/>
- <call ref="MassKind"/>
- </function>
- </function>
- </option>
-
- <option id="DefItem" desc="What are we talking about?">
- <function desc="apple" name="(The Apple)"/>
- <function desc="beer" name="(TheMass (MassDrink Beer))"/>
- <function desc="bread" name="(TheMass Bread)"/>
- <function desc="cheese" name="(TheMass Cheese)"/>
- <function desc="chicken" name="(TheMass Chicken)"/>
- <function desc="coffee" name="(TheMass (MassDrink Coffee))"/>
- <function desc="fish" name="(TheMass Fish)"/>
- <function desc="meat" name="(TheMass Meat)"/>
- <function desc="milk" name="(TheMass Milk)"/>
- <function desc="pizza" name="(The Pizza)"/>
- <function desc="salt" name="(TheMass Salt)"/>
- <function desc="tea" name="(TheMass (MassDrink Tea))"/>
- <function desc="water" name="(TheMass (MassDrink Water))"/>
- <function desc="wine" name="(TheMass (MassDrink Wine))"/>
- <function desc="(with quality)" name="TheMass">
- <function name="SuchMassKind">
- <call ref="Quality"/>
- <call ref="MassKind"/>
- </function>
- </function>
- </option>
-
- <option id="ThisItem" desc="What are we talking about?">
- <function desc="apple" name="(This Apple)"/>
- <function desc="beer" name="(ThisMass (MassDrink Beer))"/>
- <function desc="bread" name="(ThisMass Bread)"/>
- <function desc="cheese" name="(ThisMass Cheese)"/>
- <function desc="chicken" name="(ThisMass Chicken)"/>
- <function desc="coffee" name="(ThisMass (MassDrink Coffee))"/>
- <function desc="fish" name="(ThisMass Fish)"/>
- <function desc="meat" name="(ThisMass Meat)"/>
- <function desc="milk" name="(ThisMass Milk)"/>
- <function desc="pizza" name="(This Pizza)"/>
- <function desc="salt" name="(ThisMass Salt)"/>
- <function desc="tea" name="(ThisMass (MassDrink Tea))"/>
- <function desc="water" name="(ThisMass (MassDrink Water))"/>
- <function desc="wine" name="(ThisMass (MassDrink Wine))"/>
- <function desc="(with quality)" name="ThisMass">
- <function name="SuchMassKind">
- <call ref="Quality"/>
- <call ref="MassKind"/>
- </function>
- </function>
- </option>
-
- <option id="ThatItem" desc="What are we talking about?">
- <function desc="apple" name="(That Apple)"/>
- <function desc="beer" name="(ThatMass (MassDrink Beer))"/>
- <function desc="bread" name="(ThatMass Bread)"/>
- <function desc="cheese" name="(ThatMass Cheese)"/>
- <function desc="chicken" name="(ThatMass Chicken)"/>
- <function desc="coffee" name="(ThatMass (MassDrink Coffee))"/>
- <function desc="fish" name="(ThatMass Fish)"/>
- <function desc="meat" name="(ThatMass Meat)"/>
- <function desc="milk" name="(ThatMass Milk)"/>
- <function desc="pizza" name="(That Pizza)"/>
- <function desc="salt" name="(ThatMass Salt)"/>
- <function desc="tea" name="(ThatMass (MassDrink Tea))"/>
- <function desc="water" name="(ThatMass (MassDrink Water))"/>
- <function desc="wine" name="(ThatMass (MassDrink Wine))"/>
- <function desc="(with quality)" name="ThatMass">
- <function name="SuchMassKind">
- <call ref="Quality"/>
- <call ref="MassKind"/>
- </function>
- </function>
- </option>
-
- <option id="MassKind" desc="What are we talking about?">
- <function desc="beer" name="(MassDrink Beer)"/>
- <function desc="bread" name="Bread"/>
- <function desc="cheese" name="Cheese"/>
- <function desc="chicken" name="Chicken"/>
- <function desc="coffee" name="(MassDrink Coffee)"/>
- <function desc="fish" name="Fish"/>
- <function desc="meat" name="Meat"/>
- <function desc="milk" name="Milk"/>
- <function desc="salt" name="Salt"/>
- <function desc="tea" name="(MassDrink Tea)"/>
- <function desc="water" name="(MassDrink Water)"/>
- <function desc="wine" name="(MassDrink Wine)"/>
- <function desc="(with quality)" name="SuchMassKind">
- <call ref="Quality"/>
- <call ref="MassKind"/>
- </function>
- </option>
-
- <option id="Kind" desc="What are we talking about?">
- <function desc="apple" name="Apple"/>
- <function desc="pizza" name="Pizza"/>
- <function desc="(with quality)" name="SuchKind">
- <call ref="Quality"/>
- <call ref="Kind"/>
- </function>
- </option>
-
- <option id="Quality" desc="What quality does it have?">
- <function desc="bad" name="(PropQuality Bad)"/>
- <function desc="boring" name="(PropQuality Boring)"/>
- <function desc="cheap" name="(PropQuality Cheap)"/>
- <function desc="cold" name="(PropQuality Cold)"/>
- <function desc="delicious" name="(PropQuality Delicious)"/>
- <function desc="expensive" name="(PropQuality Expensive)"/>
- <function desc="fresh" name="(PropQuality Fresh)"/>
- <function desc="good" name="(PropQuality Good)"/>
- <function desc="suspect" name="(PropQuality Suspect)"/>
- <function desc="warm" name="(PropQuality Warm)"/>
-
- <function desc="too bad" name="(Too Bad)"/>
- <function desc="too boring" name="(Too Boring)"/>
- <function desc="too cheap" name="(Too Cheap)"/>
- <function desc="too cold" name="(Too Cold)"/>
- <function desc="too delicious" name="(Too Delicious)"/>
- <function desc="too expensive" name="(Too Expensive)"/>
- <function desc="too fresh" name="(Too Fresh)"/>
- <function desc="too good" name="(Too Good)"/>
- <function desc="too suspect" name="(Too Suspect)"/>
- <function desc="too warm" name="(Too Warm)"/>
-
- <function desc="very bad" name="(Very Bad)"/>
- <function desc="very boring" name="(Very Boring)"/>
- <function desc="very cheap" name="(Very Cheap)"/>
- <function desc="very cold" name="(Very Cold)"/>
- <function desc="very delicious" name="(Very Delicious)"/>
- <function desc="very expensive" name="(Very Expensive)"/>
- <function desc="very fresh" name="(Very Fresh)"/>
- <function desc="very good" name="(Very Good)"/>
- <function desc="very suspect" name="(Very Suspect)"/>
- <function desc="very warm" name="(Very Warm)"/>
-
- <function desc="(with nationality)" name="PropQuality">
- <function name="PropCit">
- <call ref="Citizenship"/>
- </function>
- </function>
- </option>
-
- <function name="AmountCurrency" id="Price">
- <function name="NNumeral">
- <numeral desc="How much does it cost?"/>
- </function>
- <call ref="Currency"/>
- </function>
-
- <option id="Currency">
- <function desc="Euro" name="Euro"/>
- <function desc="Dollar" name="Dollar"/>
- <function desc="Danish Crown" name="DanishCrown"/>
- <function desc="Norwegian Crown" name="NorwegianCrown"/>
- <function desc="Swedish Crown" name="SwedishCrown"/>
- <function desc="Pound" name="Pound"/>
- <function desc="Rouble" name="Rouble"/>
- <function desc="Rupee" name="Rupee"/>
- <function desc="Lei" name="Lei"/>
- <function desc="Leva" name="Leva"/>
- <function desc="Yuan" name="Yuan"/>
- <function desc="Zloty" name="Zloty"/>
- </option>
-
- <option desc="When?" id="Date">
- <function desc="today" name="Today"/>
- <function desc="tomorrow" name="Tomorrow"/>
- <function desc="on Monday" name="(OnDay Monday)"/>
- <function desc="on Tuesday" name="(OnDay Tuesday)"/>
- <function desc="on Wednesday" name="(OnDay Wednesday)"/>
- <function desc="on Thursday" name="(OnDay Thursday)"/>
- <function desc="on Friday" name="(OnDay Friday)"/>
- <function desc="on Saturday" name="(OnDay Saturday)"/>
- <function desc="on Sunday" name="(OnDay Sunday)"/>
- </option>
-
- <option desc="On which days?" id="Day">
- <function desc="Monday" name="Monday"/>
- <function desc="Tuesday" name="Tuesday"/>
- <function desc="Wednesday" name="Wednesday"/>
- <function desc="Thursday" name="Thursday"/>
- <function desc="Friday" name="Friday"/>
- <function desc="Saturday" name="Saturday"/>
- <function desc="Sunday" name="Sunday"/>
- </option>
-
- <option dec="Greeting" id="Greeting">
- <function desc="Hello" name="GHello"/>
- <function desc="Good Day" name="GGoodDay"/>
- <function desc="Good Evening" name="GGoodEvening"/>
- <function desc="Good Morning" name="GGoodMorning"/>
- <function desc="Good Night" name="GGoodNight"/>
- <function desc="Good Luck" name="GGoodLuck"/>
- <function desc="See You Soon" name="GSeeYouSoon"/>
- <function desc="See You on a Day" name="PSeeYouDate">
- <call ref="Date"/>
- </function>
- <function desc="See You Somewhere" name="PSeeYouPlace">
- <call ref="Place"/>
- </function>
- <function desc="See You Somewhere on a Day" name="PSeeYouPlaceDate">
- <call ref="Place"/>
- <call ref="Date"/>
- </function>
- <function desc="Goodbye" name="GGoodbye"/>
- <function desc="Bye" name="GBye"/>
- <function desc="Cheers" name="GCheers"/>
- <function desc="Congratulations" name="GCongratulations"/>
- <function desc="Damn" name="GDamn"/>
- <function desc="Excuse me" name="GExcuse"/>
- <function desc="Excuse me (polite)" name="GExcusePol"/>
- <function desc="Happy Birthday" name="GHappyBirthday"/>
- <function desc="Help" name="GHelp"/>
- <function desc="How Are You" name="GHowAreYou"/>
- <function desc="Nice to Meet You" name="GNiceToMeetYou"/>
- <function desc="Sorry" name="GSorry"/>
- <function desc="Sorry (polite)" name="GSorryPol"/>
- <function desc="Thanks" name="GThanks"/>
- </option>
-
- <option dec="Phrase" id="Phrase">
- <function desc="Yes" name="PYes"/>
- <function desc="Yes (as an answer to no)" name="PYesToNo"/>
- <function desc="No" name="PNo"/>
- <function desc="What is the time?" name="GWhatTime"/>
- <function desc="The Bill" name="GTheCheck"/>
- <function desc="Look Out" name="GLookOut"/>
- <function desc="Something please" name="GObjectPlease">
- <call ref="Object"/>
- </function>
- <function desc="Please" name="GPleaseGive"/>
- <function desc="Please (polite)" name="GPleaseGivePol"/>
- </option>
-
- <option id="do">
- <function desc="In general" name="ADoVerbPhrase">
- <call ref="Person"/>
- <call ref="VerbPhrase"/>
- </function>
- <function desc="In some place" name="ADoVerbPhrasePlace">
- <call ref="Person"/>
- <call ref="VerbPhrase"/>
- <call ref="Place"/>
- </function>
- </option>
-
- <option id="modal_do">
- <function desc="In general" name="AModVerbPhrase">
- <argument/>
- <call ref="Person"/>
- <call ref="VerbPhrase"/>
- </function>
- <function desc="In some place" name="AModVerbPhrasePlace">
- <argument/>
- <call ref="Person"/>
- <call ref="VerbPhrase"/>
- <call ref="Place"/>
- </function>
- </option>
-
- <option desc="Verb" id="VerbPhrase">
- <function desc="Buy" name="V2Buy">
- <call desc="What should be bought?" ref="Object"/>
- </function>
- <function desc="Drink" name="VDrink"/>
- <function desc="Drink Something" name="V2Drink">
- <call desc="What should be drunk?" ref="Object"/>
- </function>
- <function desc="Eat" name="VEat"/>
- <function desc="Eat Something" name="V2Eat">
- <call desc="What should be eaten?" ref="Object"/>
- </function>
- <function desc="Wait for Someone" name="V2Wait">
- <call desc="Whom should we wait for?" ref="Person"/>
- </function>
- <function desc="Play" name="VPlay"/>
- <function desc="Read" name="VRead"/>
- <function desc="Run" name="VRun"/>
- <function desc="Sit" name="VSit"/>
- <function desc="Sleep" name="VSleep"/>
- <function desc="Stop" name="VStop"/>
- <function desc="Swim" name="VSwim"/>
- <function desc="Wait" name="VWait"/>
- <function desc="Walk" name="VWalk"/>
- <function desc="Write" name="VWrite"/>
- </option>
-</phrasebook>
diff --git a/src/ui/android/build.xml b/src/ui/android/build.xml
deleted file mode 100644
index d60bf62f2..000000000
--- a/src/ui/android/build.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="MainActivity" default="help">
-
- <!-- The local.properties file is created and updated by the 'android' tool.
- It contains the path to the SDK. It should *NOT* be checked into
- Version Control Systems. -->
- <property file="local.properties" />
-
- <!-- The ant.properties file can be created by you. It is only edited by the
- 'android' tool to add properties to it.
- This is the place to change some Ant specific build properties.
- Here are some properties you may want to change/update:
-
- source.dir
- The name of the source directory. Default is 'src'.
- out.dir
- The name of the output directory. Default is 'bin'.
-
- For other overridable properties, look at the beginning of the rules
- files in the SDK, at tools/ant/build.xml
-
- Properties related to the SDK location or the project target should
- be updated using the 'android' tool with the 'update' action.
-
- This file is an integral part of the build system for your
- application and should be checked into Version Control Systems.
-
- -->
- <property file="ant.properties" />
-
- <!-- if sdk.dir was not set from one of the property file, then
- get it from the ANDROID_HOME env var.
- This must be done before we load project.properties since
- the proguard config can use sdk.dir -->
- <property environment="env" />
- <condition property="sdk.dir" value="${env.ANDROID_HOME}">
- <isset property="env.ANDROID_HOME" />
- </condition>
-
- <!-- The project.properties file is created and updated by the 'android'
- tool, as well as ADT.
-
- This contains project specific properties such as project target, and library
- dependencies. Lower level build properties are stored in ant.properties
- (or in .classpath for Eclipse projects).
-
- This file is an integral part of the build system for your
- application and should be checked into Version Control Systems. -->
- <loadproperties srcFile="project.properties" />
-
- <!-- quick check on sdk.dir -->
- <fail
- message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
- unless="sdk.dir"
- />
-
- <!--
- Import per project custom build rules if present at the root of the project.
- This is the place to put custom intermediary targets such as:
- -pre-build
- -pre-compile
- -post-compile (This is typically used for code obfuscation.
- Compiled code location: ${out.classes.absolute.dir}
- If this is not done in place, override ${out.dex.input.absolute.dir})
- -post-package
- -post-build
- -pre-clean
- -->
- <import file="custom_rules.xml" optional="true" />
-
- <!-- Import the actual build file.
-
- To customize existing targets, there are two options:
- - Customize only one target:
- - copy/paste the target into this file, *before* the
- <import> task.
- - customize it to your needs.
- - Customize the whole content of build.xml
- - copy/paste the content of the rules files (minus the top node)
- into this file, replacing the <import> task.
- - customize to your needs.
-
- ***********************
- ****** IMPORTANT ******
- ***********************
- In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
- in order to avoid having your file be overridden by tools such as "android update project"
- -->
- <!-- version-tag: 1 -->
- <import file="/Users/aarne/Library/Android/apache-ant-1.9.4/fetch.xml" />
-
-</project>
diff --git a/src/ui/android/gf-translator-alignment.dot b/src/ui/android/gf-translator-alignment.dot
deleted file mode 100644
index 8eaaa72a5..000000000
--- a/src/ui/android/gf-translator-alignment.dot
+++ /dev/null
@@ -1,60 +0,0 @@
-digraph {
- rankdir=LR ;
- node [shape = record] ;
- bgcolor = "#FFFFFF00" ;
-
- struct0[label = "<n0>твоят | <n1>телефон | <n2>може | <n3>да | <n4>превежда"] ;
- struct0:n0:e -> struct1:n0:w ;
- struct0:n1:e -> struct1:n1:w ;
- struct0:n2:e -> struct1:n2:w ;
- struct0:n4:e -> struct1:n3:w ;
- struct1[label = "<n0>el teu | <n1>telèfon | <n2>sap | <n3>traduir"] ;
- struct1:n0:e -> struct2:n0:w ;
- struct1:n1:e -> struct2:n2:w ;
- struct1:n2:e -> struct2:n3:w ;
- struct1:n3:e -> struct2:n4:w ;
- struct2[label = "<n0>你 | <n1>的 | <n2>电 话 | <n3>会 | <n4>翻 译"] ;
- struct2:n0:e -> struct3:n0:w ;
- struct2:n2:e -> struct3:n1:w ;
- struct2:n3:e -> struct3:n2:w ;
- struct2:n4:e -> struct3:n3:w ;
- struct3[label = "<n0>je | <n1>telefoon | <n2>kan | <n3>vertalen"] ;
- struct3:n0:e -> struct4:n0:w ;
- struct3:n1:e -> struct4:n1:w ;
- struct3:n2:e -> struct4:n2:w ;
- struct3:n3:e -> struct4:n3:w ;
- struct4[label = "<n0>your | <n1>phone | <n2>can | <n3>translate"] ;
- struct4:n1:e -> struct5:n1:w ;
- struct4:n2:e -> struct5:n2:w ;
- struct4:n3:e -> struct5:n3:w ;
- struct5[label = "<n1>puhelimesi | <n2>osaa | <n3>kääntää"] ;
- struct5:n1:e -> struct6:n1:w ;
- struct5:n2:e -> struct6:n2:w ;
- struct5:n3:e -> struct6:n3:w ;
- struct6[label = "<n0>ton | <n1>téléphone | <n2>sait | <n3>traduire"] ;
- struct6:n0:e -> struct7:n0:w ;
- struct6:n1:e -> struct7:n1:w ;
- struct6:n2:e -> struct7:n2:w ;
- struct6:n3:e -> struct7:n3:w ;
- struct7[label = "<n0>dein | <n1>Telefon | <n2>kann | <n3>übersetzen"] ;
- struct7:n0:e -> struct8:n0:w ;
- struct7:n1:e -> struct8:n1:w ;
- struct7:n2:e -> struct8:n3:w ;
- struct7:n3:e -> struct8:n2:w ;
- struct8[label = "<n0>तुम्हारा | <n1>फोन | <n2>अनुवाद कर | <n3>सकता | <n4>है"] ;
- struct8:n0:e -> struct9:n1:w ;
- struct8:n1:e -> struct9:n2:w ;
- struct8:n2:e -> struct9:n4:w ;
- struct8:n3:e -> struct9:n3:w ;
- struct9[label = "<n0>il | <n1>tuo | <n2>telefono | <n3>sa | <n4>tradurre"] ;
- struct9:n1:e -> struct10:n0:w ;
- struct9:n2:e -> struct10:n1:w ;
- struct9:n3:e -> struct10:n2:w ;
- struct9:n4:e -> struct10:n3:w ;
- struct10[label = "<n0>tu | <n1>teléfono | <n2>sabe | <n3>traducir"] ;
- struct10:n0:e -> struct11:n0:w ;
- struct10:n1:e -> struct11:n1:w ;
- struct10:n2:e -> struct11:n2:w ;
- struct10:n3:e -> struct11:n3:w ;
- struct11[label = "<n0>din | <n1>telefon | <n2>kan | <n3>översätta"] ;
-}
diff --git a/src/ui/android/gf-translator.svg b/src/ui/android/gf-translator.svg
deleted file mode 100644
index 21eee477d..000000000
--- a/src/ui/android/gf-translator.svg
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
-"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<?xml-stylesheet type="text/css" href="http://fonts.googleapis.com/css?family=Inconsolata"?>
-
-<svg width="1024" height="500" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
- <filter id="A"><feGaussianBlur stdDeviation="2"/></filter>
- <defs>
- <linearGradient id="grad1" x1="0%" y1="0%" x2="0%" y2="100%">
- <stop offset="0%" style="stop-color:#a8d8ff;stop-opacity:1" />
- <stop offset="100%" style="stop-color:#f6f6f6;stop-opacity:1" />
- </linearGradient>
- </defs>
- <rect width="1024" height="500" style="fill:url(#grad1)"/>
- <path filter="url(#A)"
- d="M120,270 v-51 h59 m-59,0 v-53 h114 a110.5,105 0 1,1 -24,-66"
- fill="none" stroke="black" stroke-width="4" opacity="0.25"
- stroke-linejoin="round" stroke-linecap="round"/>
- <path d="M120,270 v-51 h59 m-59,0 v-53 h114 a110.5,105 0 1,1 -24,-66"
- fill="none" stroke="red" stroke-width="4"
- stroke-linejoin="round" stroke-linecap="round"/>
- <text x="310" y="120" font-size="70" font-family="Inconsolata">Offline Translation</text>
- <text x="600" y="170" font-size="35" font-family="Inconsolata">with</text>
- <text x="270" y="240" font-size="70" font-family="Inconsolata" fill="black" opacity="0.25" filter="url(#A)">Grammatical Framework</text>
- <text x="270" y="240" font-size="70" font-family="Inconsolata" fill="#06c">Grammatical Framework</text>
- <image x="0" y="270" width="1024" height="200"
- xlink:href="gf-translator-alignment.png" />
-</svg>
diff --git a/src/ui/android/glosses.hs b/src/ui/android/glosses.hs
deleted file mode 100644
index 966ec90aa..000000000
--- a/src/ui/android/glosses.hs
+++ /dev/null
@@ -1,46 +0,0 @@
-import SG
-import PGF2
-import Data.Char
-import Data.List
-
-main = do
- db <- openSG "assets/semantics.db"
- inTransaction db $ do
- ls <- fmap lines $ readFile "../../../lib/src/translator/Dictionary.gf"
- let glosses = [x | Just (fn,gloss) <- map gloss ls, x <- glossTriples fn gloss]
- topics <- fmap (map toTriple . lines) $ readFile "topics.txt"
- sequence_ [insertTriple db s p o | (s,p,o) <- glosses++topics]
- closeSG db
-
-toTriple l =
- case readTriple l of
- Just t -> t
- Nothing -> error ("topics.txt: "++l)
-
-gloss l =
- case words l of
- ("fun":fn:_) -> case dropWhile (/='\t') l of
- '\t':l -> Just (fn,l)
- _ -> Nothing
- _ -> Nothing
-
-glossTriples fn s =
- (if null gs then [] else [(fn_e,gloss,mkStr (merge gs))])++
- (if null es then [] else [(fn_e,example,mkStr (merge (map (init . tail) es)))])
- where
- fn_e = mkApp fn []
- gloss = mkApp "gloss" []
- example = mkApp "example" []
- (es,gs) = partition isExample (splitGloss s)
-
-splitGloss s =
- let (xs,s') = break (==';') s
- in trim xs : case s' of
- ';':s -> splitGloss s
- _ -> []
- where
- trim = reverse . dropWhile isSpace . reverse . dropWhile isSpace
-
-merge = intercalate "; "
-
-isExample s = not (null s) && head s == '"' && last s == '"'
diff --git a/src/ui/android/hlc.svg b/src/ui/android/hlc.svg
deleted file mode 100644
index e61e41c19..000000000
--- a/src/ui/android/hlc.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
-"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<?xml-stylesheet type="text/css" href="http://fonts.googleapis.com/css?family=Inconsolata"?>
-
-<svg width="250" height="250" version="1.1" xmlns="http://www.w3.org/2000/svg">
- <desc>Digital Grammar Logo</desc>
-
- <path d="M205,200 a110,110 0 1,1 0,-150 M125,15 v110 h80 M165,95 v60 M205,95 v60" fill="none" stroke="red" stroke-width="14" stroke-linejoin="round" stroke-linecap="round"/>
-</svg>
diff --git a/src/ui/android/jni/Android.mk b/src/ui/android/jni/Android.mk
deleted file mode 100644
index f1f697bed..000000000
--- a/src/ui/android/jni/Android.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-jni_c_files := jpgf.c jsg.c jni_utils.c
-sg_c_files := sg.c sqlite3Btree.c
-pgf_c_files := data.c expr.c graphviz.c linearizer.c literals.c parser.c parseval.c pgf.c printer.c reader.c \
-reasoner.c evaluator.c jit.c typechecker.c lookup.c aligner.c writer.c
-gu_c_files := assert.c choice.c exn.c fun.c in.c map.c out.c utf8.c \
-bits.c defs.c enum.c file.c hash.c mem.c prime.c seq.c string.c ucs.c variant.c
-
-LOCAL_MODULE := jpgf
-LOCAL_SRC_FILES := $(addprefix ../../../runtime/java/, $(jni_c_files)) \
- $(addprefix ../../../runtime/c/sg/, $(sg_c_files)) \
- $(addprefix ../../../runtime/c/pgf/, $(pgf_c_files)) \
- $(addprefix ../../../runtime/c/gu/, $(gu_c_files))
-LOCAL_C_INCLUDES := ../../../runtime/c
-
-include $(BUILD_SHARED_LIBRARY)
-
-$(realpath ../obj/local/armeabi/objs/jpgf/__/__/__/runtime/c/pgf/jit.o): lightning
-$(realpath ../obj/local/armeabi/objs-debug/jpgf/__/__/__/runtime/c/pgf/jit.o): lightning
-
-lightning:
- ln -s -f arm/asm.h ../../../runtime/c/pgf/lightning/asm.h
- ln -s -f arm/core.h ../../../runtime/c/pgf/lightning/core.h
- ln -s -f arm/fp.h ../../../runtime/c/pgf/lightning/fp.h
- ln -s -f arm/funcs.h ../../../runtime/c/pgf/lightning/funcs.h
diff --git a/src/ui/android/jni/Application.mk b/src/ui/android/jni/Application.mk
deleted file mode 100644
index 6a9876332..000000000
--- a/src/ui/android/jni/Application.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-APP_PLATFORM := android-8
-APP_CFLAGS := -std=gnu99
-APP_OPTIM := release
diff --git a/src/ui/android/proguard-project.txt b/src/ui/android/proguard-project.txt
deleted file mode 100644
index f2fe1559a..000000000
--- a/src/ui/android/proguard-project.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# To enable ProGuard in your project, edit project.properties
-# to define the proguard.config property as described in that file.
-#
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in ${sdk.dir}/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the ProGuard
-# include property in project.properties.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/src/ui/android/project.properties b/src/ui/android/project.properties
deleted file mode 100644
index 6e18427a4..000000000
--- a/src/ui/android/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-21
diff --git a/src/ui/android/res/drawable-hdpi/btn_close.png b/src/ui/android/res/drawable-hdpi/btn_close.png
deleted file mode 100644
index 47f11e5bf..000000000
--- a/src/ui/android/res/drawable-hdpi/btn_close.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-hdpi/close_arrow.png b/src/ui/android/res/drawable-hdpi/close_arrow.png
deleted file mode 100644
index bf280a05a..000000000
--- a/src/ui/android/res/drawable-hdpi/close_arrow.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-hdpi/ic_action_switch.png b/src/ui/android/res/drawable-hdpi/ic_action_switch.png
deleted file mode 100644
index 5449a32b8..000000000
--- a/src/ui/android/res/drawable-hdpi/ic_action_switch.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-hdpi/ic_app.png b/src/ui/android/res/drawable-hdpi/ic_app.png
deleted file mode 100644
index 8d9bdd820..000000000
--- a/src/ui/android/res/drawable-hdpi/ic_app.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-hdpi/ic_drawer.png b/src/ui/android/res/drawable-hdpi/ic_drawer.png
deleted file mode 100644
index c59f601ca..000000000
--- a/src/ui/android/res/drawable-hdpi/ic_drawer.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-hdpi/ic_keyboard.png b/src/ui/android/res/drawable-hdpi/ic_keyboard.png
deleted file mode 100644
index ce257a269..000000000
--- a/src/ui/android/res/drawable-hdpi/ic_keyboard.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-hdpi/ic_mic.png b/src/ui/android/res/drawable-hdpi/ic_mic.png
deleted file mode 100644
index f79ff489b..000000000
--- a/src/ui/android/res/drawable-hdpi/ic_mic.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-hdpi/ic_search_black_24dp.png b/src/ui/android/res/drawable-hdpi/ic_search_black_24dp.png
deleted file mode 100644
index c593e7ad8..000000000
--- a/src/ui/android/res/drawable-hdpi/ic_search_black_24dp.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-hdpi/open_arrow.png b/src/ui/android/res/drawable-hdpi/open_arrow.png
deleted file mode 100644
index ec7453797..000000000
--- a/src/ui/android/res/drawable-hdpi/open_arrow.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-hdpi/sym_keyboard_delete.png b/src/ui/android/res/drawable-hdpi/sym_keyboard_delete.png
deleted file mode 100644
index 5139c7179..000000000
--- a/src/ui/android/res/drawable-hdpi/sym_keyboard_delete.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-hdpi/sym_keyboard_return.png b/src/ui/android/res/drawable-hdpi/sym_keyboard_return.png
deleted file mode 100644
index 5a5670c32..000000000
--- a/src/ui/android/res/drawable-hdpi/sym_keyboard_return.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-hdpi/sym_keyboard_search.png b/src/ui/android/res/drawable-hdpi/sym_keyboard_search.png
deleted file mode 100644
index e72cde3bb..000000000
--- a/src/ui/android/res/drawable-hdpi/sym_keyboard_search.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-hdpi/sym_keyboard_shift.png b/src/ui/android/res/drawable-hdpi/sym_keyboard_shift.png
deleted file mode 100644
index 275769618..000000000
--- a/src/ui/android/res/drawable-hdpi/sym_keyboard_shift.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-hdpi/sym_keyboard_space.png b/src/ui/android/res/drawable-hdpi/sym_keyboard_space.png
deleted file mode 100644
index cef2daa5d..000000000
--- a/src/ui/android/res/drawable-hdpi/sym_keyboard_space.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-mdpi/ic_action_switch.png b/src/ui/android/res/drawable-mdpi/ic_action_switch.png
deleted file mode 100644
index ecf7d0347..000000000
--- a/src/ui/android/res/drawable-mdpi/ic_action_switch.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-mdpi/ic_app.png b/src/ui/android/res/drawable-mdpi/ic_app.png
deleted file mode 100644
index 923d0fe91..000000000
--- a/src/ui/android/res/drawable-mdpi/ic_app.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-mdpi/ic_drawer.png b/src/ui/android/res/drawable-mdpi/ic_drawer.png
deleted file mode 100644
index 1ed2c56ee..000000000
--- a/src/ui/android/res/drawable-mdpi/ic_drawer.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-mdpi/ic_mic.png b/src/ui/android/res/drawable-mdpi/ic_mic.png
deleted file mode 100644
index 8f7f55cf9..000000000
--- a/src/ui/android/res/drawable-mdpi/ic_mic.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-mdpi/ic_search_black_24dp.png b/src/ui/android/res/drawable-mdpi/ic_search_black_24dp.png
deleted file mode 100644
index 6b1634323..000000000
--- a/src/ui/android/res/drawable-mdpi/ic_search_black_24dp.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-mdpi/sym_keyboard_delete.png b/src/ui/android/res/drawable-mdpi/sym_keyboard_delete.png
deleted file mode 100644
index 6cee59682..000000000
--- a/src/ui/android/res/drawable-mdpi/sym_keyboard_delete.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-mdpi/sym_keyboard_done.png b/src/ui/android/res/drawable-mdpi/sym_keyboard_done.png
deleted file mode 100644
index c0d6d1394..000000000
--- a/src/ui/android/res/drawable-mdpi/sym_keyboard_done.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-mdpi/sym_keyboard_return.png b/src/ui/android/res/drawable-mdpi/sym_keyboard_return.png
deleted file mode 100644
index cbe2b152f..000000000
--- a/src/ui/android/res/drawable-mdpi/sym_keyboard_return.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-mdpi/sym_keyboard_search.png b/src/ui/android/res/drawable-mdpi/sym_keyboard_search.png
deleted file mode 100644
index 127755d6b..000000000
--- a/src/ui/android/res/drawable-mdpi/sym_keyboard_search.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-mdpi/sym_keyboard_shift.png b/src/ui/android/res/drawable-mdpi/sym_keyboard_shift.png
deleted file mode 100644
index d05962846..000000000
--- a/src/ui/android/res/drawable-mdpi/sym_keyboard_shift.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-mdpi/sym_keyboard_space.png b/src/ui/android/res/drawable-mdpi/sym_keyboard_space.png
deleted file mode 100644
index 09b94d9e6..000000000
--- a/src/ui/android/res/drawable-mdpi/sym_keyboard_space.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-xhdpi/ic_action_switch.png b/src/ui/android/res/drawable-xhdpi/ic_action_switch.png
deleted file mode 100644
index b5da00fb2..000000000
--- a/src/ui/android/res/drawable-xhdpi/ic_action_switch.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-xhdpi/ic_app.png b/src/ui/android/res/drawable-xhdpi/ic_app.png
deleted file mode 100644
index f7eb06682..000000000
--- a/src/ui/android/res/drawable-xhdpi/ic_app.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-xhdpi/ic_dictionary.png b/src/ui/android/res/drawable-xhdpi/ic_dictionary.png
deleted file mode 100644
index 985644ebd..000000000
--- a/src/ui/android/res/drawable-xhdpi/ic_dictionary.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-xhdpi/ic_drawer.png b/src/ui/android/res/drawable-xhdpi/ic_drawer.png
deleted file mode 100644
index a5fa74def..000000000
--- a/src/ui/android/res/drawable-xhdpi/ic_drawer.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-xhdpi/ic_mic.png b/src/ui/android/res/drawable-xhdpi/ic_mic.png
deleted file mode 100644
index 13d21274a..000000000
--- a/src/ui/android/res/drawable-xhdpi/ic_mic.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-xhdpi/ic_search_black_24dp.png b/src/ui/android/res/drawable-xhdpi/ic_search_black_24dp.png
deleted file mode 100644
index 638190268..000000000
--- a/src/ui/android/res/drawable-xhdpi/ic_search_black_24dp.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-xxhdpi/ic_app.png b/src/ui/android/res/drawable-xxhdpi/ic_app.png
deleted file mode 100644
index 6154d852a..000000000
--- a/src/ui/android/res/drawable-xxhdpi/ic_app.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-xxhdpi/ic_drawer.png b/src/ui/android/res/drawable-xxhdpi/ic_drawer.png
deleted file mode 100644
index 9c4685d6e..000000000
--- a/src/ui/android/res/drawable-xxhdpi/ic_drawer.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-xxhdpi/ic_search_black_24dp.png b/src/ui/android/res/drawable-xxhdpi/ic_search_black_24dp.png
deleted file mode 100644
index 3ae490ef9..000000000
--- a/src/ui/android/res/drawable-xxhdpi/ic_search_black_24dp.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable-xxxhdpi/ic_search_black_24dp.png b/src/ui/android/res/drawable-xxxhdpi/ic_search_black_24dp.png
deleted file mode 100644
index 21be57299..000000000
--- a/src/ui/android/res/drawable-xxxhdpi/ic_search_black_24dp.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable/first_person_utterance_bg.xml b/src/ui/android/res/drawable/first_person_utterance_bg.xml
deleted file mode 100644
index acdf9ab92..000000000
--- a/src/ui/android/res/drawable/first_person_utterance_bg.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <corners android:radius="4dp" />
- <solid android:color="#CDCDED" />
-</shape> \ No newline at end of file
diff --git a/src/ui/android/res/drawable/grid_phrasebook_button.xml b/src/ui/android/res/drawable/grid_phrasebook_button.xml
deleted file mode 100644
index 21a6ac127..000000000
--- a/src/ui/android/res/drawable/grid_phrasebook_button.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android" >
- <stroke android:width="1dp"
- android:color="@color/primary_color" />
- <padding android:left="5dp" android:top="5dp" android:right="5dp" android:bottom="5dp" />
- <corners android:radius="8dp" />
-</shape> \ No newline at end of file
diff --git a/src/ui/android/res/drawable/ic_volume_up_black_18dp.png b/src/ui/android/res/drawable/ic_volume_up_black_18dp.png
deleted file mode 100644
index 992d2c452..000000000
--- a/src/ui/android/res/drawable/ic_volume_up_black_18dp.png
+++ /dev/null
Binary files differ
diff --git a/src/ui/android/res/drawable/second_person_best_utterance_bg.xml b/src/ui/android/res/drawable/second_person_best_utterance_bg.xml
deleted file mode 100644
index 0c60864b9..000000000
--- a/src/ui/android/res/drawable/second_person_best_utterance_bg.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <corners android:radius="4dp" />
- <solid android:color="@color/primary_color" />
-</shape> \ No newline at end of file
diff --git a/src/ui/android/res/drawable/second_person_chunk_utterance_bg.xml b/src/ui/android/res/drawable/second_person_chunk_utterance_bg.xml
deleted file mode 100644
index d10d67122..000000000
--- a/src/ui/android/res/drawable/second_person_chunk_utterance_bg.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <corners android:radius="4dp" />
- <solid android:color="#FFB2A5" />
-</shape> \ No newline at end of file
diff --git a/src/ui/android/res/drawable/second_person_utterance_bg.xml b/src/ui/android/res/drawable/second_person_utterance_bg.xml
deleted file mode 100644
index e07cc10b3..000000000
--- a/src/ui/android/res/drawable/second_person_utterance_bg.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <corners android:radius="4dp" />
- <solid android:color="#FFFF99" />
-</shape> \ No newline at end of file
diff --git a/src/ui/android/res/drawable/second_person_worst_utterance_bg.xml b/src/ui/android/res/drawable/second_person_worst_utterance_bg.xml
deleted file mode 100644
index f4effe3bc..000000000
--- a/src/ui/android/res/drawable/second_person_worst_utterance_bg.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <corners android:radius="4dp" />
- <solid android:color="#FF303e" />
-</shape> \ No newline at end of file
diff --git a/src/ui/android/res/layout/activity_help.xml b/src/ui/android/res/layout/activity_help.xml
deleted file mode 100644
index 3cb88a569..000000000
--- a/src/ui/android/res/layout/activity_help.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent" >
-
- <WebView
- android:id="@+id/help_content"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- />
-</RelativeLayout>
diff --git a/src/ui/android/res/layout/activity_lexical_entry.xml b/src/ui/android/res/layout/activity_lexical_entry.xml
deleted file mode 100644
index fa49f252b..000000000
--- a/src/ui/android/res/layout/activity_lexical_entry.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="match_parent"
- android:layout_width="match_parent">
-
- <android.support.v4.widget.DrawerLayout
- android:id="@+id/drawer_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <!-- The main content view -->
- <RelativeLayout
- android:layout_height="match_parent"
- android:layout_width="match_parent">
-
- <RelativeLayout
- android:id="@+id/lexical_header"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true"
- android:layout_alignParentRight="true"
- android:padding="8dp"
- android:background="#C0C0C0">
-
- <org.grammaticalframework.ui.android.LanguageSelector
- android:id="@+id/show_language"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_alignParentLeft="true"
- android:layout_alignParentTop="true"
- android:padding="0dp"/>
-
- </RelativeLayout>
-
- <TextView
- android:id="@+id/lexical_desc"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_below="@+id/lexical_header"
- android:paddingLeft="1dp"
- android:paddingTop="4dp"
- android:paddingBottom="2dp"
- android:textSize="25sp"/>
-
- <ListView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_below="@id/lexical_desc"
- android:orientation="vertical"
- android:paddingLeft="1dp"
- android:id="@android:id/list" >
- </ListView>
- </RelativeLayout>
-
- <!-- The navigation drawer -->
- <ListView android:id="@+id/topics_list"
- android:layout_width="250dp"
- android:layout_height="match_parent"
- android:layout_gravity="start"
- android:choiceMode="singleChoice"
- android:divider="@android:color/transparent"
- android:dividerHeight="0dp"
- android:background="#FFFFE0"/>
- </android.support.v4.widget.DrawerLayout>
-
- <LinearLayout
- android:id="@+id/progressBarView"
- android:gravity="center"
- android:visibility="gone"
- android:background="#00000000"
- android:layout_height="match_parent"
- android:layout_width="match_parent">
-
- <ProgressBar
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
- </LinearLayout>
-</FrameLayout>
diff --git a/src/ui/android/res/layout/activity_main.xml b/src/ui/android/res/layout/activity_main.xml
deleted file mode 100644
index b77fe5857..000000000
--- a/src/ui/android/res/layout/activity_main.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="match_parent"
- android:layout_width="match_parent">
-
- <RelativeLayout
- android:layout_height="match_parent"
- android:layout_width="match_parent">
-
- <RelativeLayout
- android:id="@+id/top_bg"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true"
- android:layout_alignParentRight="true"
- android:padding="8dp"
- android:background="#C0C0C0">
-
- <ImageView
- android:id="@+id/start_stop"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_alignTop="@+id/source_language"
- android:layout_alignBottom="@+id/target_language"
- android:layout_alignParentRight="true"
- android:padding="8dp"
- android:src="@drawable/ic_mic"
- android:contentDescription="@string/microphone"/>
-
- <ImageView
- android:id="@+id/switch_languages"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_alignTop="@+id/source_language"
- android:layout_alignBottom="@+id/target_language"
- android:layout_toLeftOf="@id/start_stop"
- android:padding="8dp"
- android:src="@drawable/ic_action_switch"
- android:contentDescription="@string/switch_languages"/>
-
- <org.grammaticalframework.ui.android.LanguageSelector
- android:id="@+id/source_language"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_alignParentLeft="true"
- android:layout_alignParentTop="true"
- android:layout_toLeftOf="@id/switch_languages"
- android:padding="0dp"/>
-
- <org.grammaticalframework.ui.android.LanguageSelector
- android:id="@+id/target_language"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_below="@id/source_language"
- android:layout_toLeftOf="@id/switch_languages"
- android:padding="0dp"/>
- </RelativeLayout>
-
- <org.grammaticalframework.ui.android.ConversationView
- android:id="@+id/conversation"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:layout_alignParentLeft="true"
- android:layout_alignParentBottom="true"
- android:layout_alignParentRight="true"
- android:layout_below="@id/top_bg">
-
- <LinearLayout
- android:id="@+id/conversation_content"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:orientation="vertical"
- android:padding="16dp"/>
- </org.grammaticalframework.ui.android.ConversationView>
- </RelativeLayout>
-
- <LinearLayout
- android:id="@+id/progressBarView"
- android:gravity="center"
- android:visibility="gone"
- android:background="#00000000"
- android:layout_height="match_parent"
- android:layout_width="match_parent">
-
- <ProgressBar
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
- </LinearLayout>
-</FrameLayout> \ No newline at end of file
diff --git a/src/ui/android/res/layout/activity_navigation.xml b/src/ui/android/res/layout/activity_navigation.xml
deleted file mode 100644
index 44311b90d..000000000
--- a/src/ui/android/res/layout/activity_navigation.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
-<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/drawer_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".gui.activities.NavigationActivity">
-
- <!-- As the main content view, the view below consumes the entire
- space available using match_parent in both dimensions. -->
- <FrameLayout
- android:id="@+id/container"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
-</android.support.v4.widget.DrawerLayout>
diff --git a/src/ui/android/res/layout/activity_semantic_graph.xml b/src/ui/android/res/layout/activity_semantic_graph.xml
deleted file mode 100644
index 004e22a7c..000000000
--- a/src/ui/android/res/layout/activity_semantic_graph.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="match_parent"
- android:layout_width="match_parent">
-
- <RelativeLayout
- android:layout_height="match_parent"
- android:layout_width="match_parent">
-
- <RelativeLayout
- android:id="@+id/graph_header"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true"
- android:layout_alignParentRight="true"
- android:padding="8dp"
- android:background="#C0C0C0">
-
- <ImageView
- android:id="@+id/add_word"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_alignParentRight="true"
- android:padding="8dp"
- android:src="@drawable/ic_search_black_24dp"/>
-
- <org.grammaticalframework.ui.android.LanguageSelector
- android:id="@+id/show_language"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_alignParentLeft="true"
- android:layout_alignParentTop="true"
- android:layout_toLeftOf="@id/add_word"
- android:padding="0dp"/>
- </RelativeLayout>
-
- <org.grammaticalframework.ui.android.SemanticGraphView
- android:id="@+id/semantic_graph"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:layout_alignParentLeft="true"
- android:layout_alignParentBottom="true"
- android:layout_alignParentRight="true"
- android:layout_below="@id/graph_header"/>
- </RelativeLayout>
-
- <LinearLayout
- android:id="@+id/progressBarView"
- android:gravity="center"
- android:visibility="gone"
- android:background="#00000000"
- android:layout_height="match_parent"
- android:layout_width="match_parent">
-
- <ProgressBar
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
- </LinearLayout>
-</FrameLayout>
diff --git a/src/ui/android/res/layout/alternative_item.xml b/src/ui/android/res/layout/alternative_item.xml
deleted file mode 100644
index f35d1b938..000000000
--- a/src/ui/android/res/layout/alternative_item.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent" >
- <ImageView
- android:id="@+id/arrow"
- android:layout_width="30dp"
- android:layout_height="30dp"
- android:contentDescription="@string/open_image"
- android:src="@drawable/open_arrow"
- android:paddingLeft="10dp"
- android:paddingRight="5dp" />
-
- <TextView
- android:id="@+id/alternative_desc"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_toRightOf="@id/arrow"
- android:paddingLeft="10dp"
- android:textSize="25sp"/>
-
- <org.grammaticalframework.ui.android.ParseTreeView
- android:id="@+id/desc_details"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/alternative_desc"
- android:textSize="25sp"
- />
-
- <TextView
- android:id="@+id/abstract_tree"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/desc_details"
- android:textSize="15sp"/>
-</RelativeLayout> \ No newline at end of file
diff --git a/src/ui/android/res/layout/checkbox_input_list_item.xml b/src/ui/android/res/layout/checkbox_input_list_item.xml
deleted file mode 100644
index 255d0ae8d..000000000
--- a/src/ui/android/res/layout/checkbox_input_list_item.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <CheckBox
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="15sp"
- android:id="@+id/choice_checkbox" />
-
-</LinearLayout>
diff --git a/src/ui/android/res/layout/first_person_utterance.xml b/src/ui/android/res/layout/first_person_utterance.xml
deleted file mode 100644
index 97171149c..000000000
--- a/src/ui/android/res/layout/first_person_utterance.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<EditText xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_marginBottom="16dp"
- android:layout_gravity="left"
- android:padding="8dp"
- android:textSize="20sp"
- android:inputType="textNoSuggestions"
- android:background="@drawable/first_person_utterance_bg"
- />
diff --git a/src/ui/android/res/layout/fragment_phrase_list.xml b/src/ui/android/res/layout/fragment_phrase_list.xml
deleted file mode 100644
index 1868da31c..000000000
--- a/src/ui/android/res/layout/fragment_phrase_list.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:descendantFocusability="blocksDescendants"
- tools:context="se.chalmers.phrasebook.gui.fragments.PhraseListFragment">
-
- <ListView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/phrase_listView"
- android:layout_alignParentRight="true"
- android:layout_alignParentTop="true"
- />
-
-</FrameLayout>
diff --git a/src/ui/android/res/layout/fragment_translator.xml b/src/ui/android/res/layout/fragment_translator.xml
deleted file mode 100644
index 6b6584f98..000000000
--- a/src/ui/android/res/layout/fragment_translator.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/grid_phrasebook_button"
- android:layout_marginTop="10dp"
- android:layout_marginLeft="10dp"
- android:layout_marginRight="10dp"
- android:id="@+id/fragment_translation">
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="New Text"
- android:textSize="24dp"
- android:id="@+id/origin_phrase"
- android:layout_marginLeft="10dp"
- android:layout_marginRight="10dp"
- android:layout_marginTop="16dp"
- android:layout_marginBottom="16dp"
- android:maxLines="4"
- android:scrollHorizontally="false"
- />
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="New Text"
- android:textSize="24dp"
- android:id="@+id/target_phrase"
- android:layout_marginLeft="10dp"
- android:layout_marginRight="10dp"
- android:maxLines="4"
- android:scrollHorizontally="false"
- />
-
- <ImageView
- android:id="@+id/button3"
- android:layout_width="30dp"
- android:layout_height="30dp"
- android:layout_gravity="right"
- android:src="@drawable/ic_volume_up_black_18dp"/>
- </LinearLayout>
-
- <ListView xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:id="@+id/input_holder"
- android:divider="@android:color/transparent"
- android:padding="8dp"/>
-</LinearLayout>
diff --git a/src/ui/android/res/layout/input.xml b/src/ui/android/res/layout/input.xml
deleted file mode 100644
index fdef07a53..000000000
--- a/src/ui/android/res/layout/input.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<org.grammaticalframework.ui.android.TranslatorKeyboardView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/keyboard"
- android:layout_alignParentBottom="true"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- />
diff --git a/src/ui/android/res/layout/keyboard_languages_options.xml b/src/ui/android/res/layout/keyboard_languages_options.xml
deleted file mode 100644
index 17512df19..000000000
--- a/src/ui/android/res/layout/keyboard_languages_options.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<TableLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:padding="5dp"
- android:layout_margin="1dp"
- >
- <ImageButton android:id="@+id/closeButton"
- android:background="@android:color/transparent"
- android:src="@drawable/btn_close"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:layout_marginStart="8dp"
- android:padding="5dp"
- android:clickable="true"
- />
-</TableLayout> \ No newline at end of file
diff --git a/src/ui/android/res/layout/languages_item.xml b/src/ui/android/res/layout/languages_item.xml
deleted file mode 100644
index d5f47ab27..000000000
--- a/src/ui/android/res/layout/languages_item.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<TextView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:padding="8dp"
- android:textSize="20sp"
- />
diff --git a/src/ui/android/res/layout/lexical_item.xml b/src/ui/android/res/layout/lexical_item.xml
deleted file mode 100644
index 1d3835e54..000000000
--- a/src/ui/android/res/layout/lexical_item.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent" >
- <ImageView
- android:id="@+id/arrow"
- android:layout_width="30dp"
- android:layout_height="30dp"
- android:contentDescription="@string/open_image"
- android:src="@drawable/open_arrow"
- android:paddingLeft="10dp"
- android:paddingRight="5dp" />
-
- <TextView
- android:id="@+id/lexical_desc"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_toRightOf="@id/arrow"
- android:paddingLeft="10dp"
- android:textSize="25sp"/>
-
- <WebView
- android:id="@+id/desc_details"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/lexical_desc"/>
-</RelativeLayout>
diff --git a/src/ui/android/res/layout/number_input_list_item.xml b/src/ui/android/res/layout/number_input_list_item.xml
deleted file mode 100644
index a3cfa07e5..000000000
--- a/src/ui/android/res/layout/number_input_list_item.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical" android:layout_width="match_parent"
- android:layout_height="match_parent"
- >
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="New Text"
- android:textSize="15sp"
- android:id="@+id/textView_number" />
-
- <SeekBar
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:max="100"
- android:id="@+id/seekBar" />
-
- <EditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:inputType="numberPassword"
- android:ems="10"
- android:id="@+id/editNumber" />
-
-
-</LinearLayout> \ No newline at end of file
diff --git a/src/ui/android/res/layout/phrase_list_item.xml b/src/ui/android/res/layout/phrase_list_item.xml
deleted file mode 100644
index f812ad871..000000000
--- a/src/ui/android/res/layout/phrase_list_item.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="18dp"
- android:textColor="@color/text_colour_light"
- android:fontFamily="sans-serif-light"
- android:text="New Text"
- android:id="@+id/textView3"
- android:padding="8dp"
- xmlns:android="http://schemas.android.com/apk/res/android" />
-
diff --git a/src/ui/android/res/layout/second_person_utterance.xml b/src/ui/android/res/layout/second_person_utterance.xml
deleted file mode 100644
index 416d85328..000000000
--- a/src/ui/android/res/layout/second_person_utterance.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<TextView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_marginBottom="16dp"
- android:layout_marginLeft="32dp"
- android:layout_gravity="right"
- android:padding="8dp"
- android:textSize="20sp"
- android:background="@drawable/second_person_utterance_bg"
- />
diff --git a/src/ui/android/res/layout/spinner_input_list_item.xml b/src/ui/android/res/layout/spinner_input_list_item.xml
deleted file mode 100644
index be07004f4..000000000
--- a/src/ui/android/res/layout/spinner_input_list_item.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="New Text"
- android:textSize="15sp"
- android:id="@+id/text_view_spinner" />
-
- <Spinner
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/choice_spinner" />
-
-</LinearLayout>
diff --git a/src/ui/android/res/menu/main.xml b/src/ui/android/res/menu/main.xml
deleted file mode 100644
index f36095749..000000000
--- a/src/ui/android/res/menu/main.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
- <item android:id="@+id/input_mode"
- android:title="@string/keyboard_input"/>
- <item android:id="@+id/phrasebook"
- android:title="@string/phrasebook"/>
- <item android:id="@+id/topics"
- android:title="@string/topics"/>
- <item android:id="@+id/help"
- android:title="@string/help"/>
-</menu>
diff --git a/src/ui/android/res/values-sw600dp/dimens.xml b/src/ui/android/res/values-sw600dp/dimens.xml
deleted file mode 100644
index 44f01db75..000000000
--- a/src/ui/android/res/values-sw600dp/dimens.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<resources>
-
- <!--
- Customize dimensions originally defined in res/values/dimens.xml (such as
- screen margins) for sw600dp devices (e.g. 7" tablets) here.
- -->
-
-</resources>
diff --git a/src/ui/android/res/values-sw720dp-land/dimens.xml b/src/ui/android/res/values-sw720dp-land/dimens.xml
deleted file mode 100644
index 61e3fa8fb..000000000
--- a/src/ui/android/res/values-sw720dp-land/dimens.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<resources>
-
- <!--
- Customize dimensions originally defined in res/values/dimens.xml (such as
- screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
- -->
- <dimen name="activity_horizontal_margin">128dp</dimen>
-
-</resources>
diff --git a/src/ui/android/res/values-v11/styles.xml b/src/ui/android/res/values-v11/styles.xml
deleted file mode 100644
index 3c02242ad..000000000
--- a/src/ui/android/res/values-v11/styles.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<resources>
-
- <!--
- Base application theme for API 11+. This theme completely replaces
- AppBaseTheme from res/values/styles.xml on API 11+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
- <!-- API 11 theme customizations can go here. -->
- </style>
-
-</resources>
diff --git a/src/ui/android/res/values-v14/styles.xml b/src/ui/android/res/values-v14/styles.xml
deleted file mode 100644
index a91fd0372..000000000
--- a/src/ui/android/res/values-v14/styles.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
-
- <!--
- Base application theme for API 14+. This theme completely replaces
- AppBaseTheme from BOTH res/values/styles.xml and
- res/values-v11/styles.xml on API 14+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
- <!-- API 14 theme customizations can go here. -->
- </style>
-
-</resources>
diff --git a/src/ui/android/res/values/attrs.xml b/src/ui/android/res/values/attrs.xml
deleted file mode 100644
index debd08fa0..000000000
--- a/src/ui/android/res/values/attrs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <declare-styleable name="Theme">
- <attr name="parseTreeViewStyle" format="reference"/>
- </declare-styleable>
-</resources>
diff --git a/src/ui/android/res/values/colors.xml b/src/ui/android/res/values/colors.xml
deleted file mode 100644
index e7dbbada4..000000000
--- a/src/ui/android/res/values/colors.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?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">#ffffffff</color>
- <item name="primary_color" type="color">#75CD75</item>
- <item name="text_colour_light" type="color">#616161</item>
-</resources>
diff --git a/src/ui/android/res/values/dimens.xml b/src/ui/android/res/values/dimens.xml
deleted file mode 100644
index 04289dc79..000000000
--- a/src/ui/android/res/values/dimens.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<resources>
-
- <!-- Default screen margins, per the Android Design guidelines. -->
- <dimen name="activity_horizontal_margin">16dp</dimen>
- <dimen name="activity_vertical_margin">16dp</dimen>
- <dimen name="key_height">50dip</dimen>
- <dimen name="candidate_font_height">25sp</dimen>
- <dimen name="candidate_vertical_padding">6sp</dimen>
-
-</resources>
diff --git a/src/ui/android/res/values/strings.xml b/src/ui/android/res/values/strings.xml
deleted file mode 100644
index 8281a1353..000000000
--- a/src/ui/android/res/values/strings.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="app_name">GF Offline Translator</string>
-
- <string name="microphone">Microphone</string>
- <string name="switch_languages">Switch languages</string>
- <string name="open_image">Opening</string>
- <string name="mic_input">Speech Input</string>
- <string name="keyboard_input">Keyboard Input</string>
- <string name="semantic_graph">Semantic Graph</string>
- <string name="help">Help</string>
- <string name="global_preferences_key">org.grammaticalframework.ui.android.GLOBAL_PREFERENCES</string>
-
- <string name="authority_key">authority_key</string>
- <string name="source_key">source_key</string>
- <string name="target_key">target_key</string>
- <string name="alternatives_key">alternatives_key</string>
-
- <!-- Labels on soft keys -->
- <string name="label_done_key">Done</string>
- <string name="label_go_key">Go</string>
- <string name="label_next_key">Next</string>
- <string name="label_previous_key">Previous</string>
- <string name="label_send_key">Send</string>
-
- <!-- Labels for subtype -->
- <string name="normalKeyboardMode">normalKeyboardMode</string>
- <string name="internalKeyboardMode">internalKeyboardMode</string>
-
- <string name="search_hint">Search word:</string>
- <string name="search_description">Search for words in the lexicon</string>
-
- <string name="topics">Topics</string>
- <string name="topics_open">Open topics</string>
- <string name="topics_close">Close topics</string>
-
- <string name="phrasebook">Phrasebook</string>
-</resources>
diff --git a/src/ui/android/res/values/styles.xml b/src/ui/android/res/values/styles.xml
deleted file mode 100644
index c839d30a9..000000000
--- a/src/ui/android/res/values/styles.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<resources>
-
- <!--
- Base application theme, dependent on API level. This theme is replaced
- by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Light">
- <!--
- Theme customizations available in newer API levels can go in
- res/values-vXX/styles.xml, while customizations related to
- backward-compatibility can go here.
- -->
- </style>
-
- <!-- Application theme. -->
- <style name="AppTheme" parent="AppBaseTheme">
- <!-- All customizations that are NOT specific to a particular API-level can go here. -->
- <item name="parseTreeViewStyle">@style/ParseTreeViewStyle</item>
- </style>
-
- <style name="ParseTreeViewStyle">
- <item name="android:scrollbars">horizontal</item>
- </style>
-</resources>
diff --git a/src/ui/android/res/xml/cyrillic.xml b/src/ui/android/res/xml/cyrillic.xml
deleted file mode 100644
index b699d9c19..000000000
--- a/src/ui/android/res/xml/cyrillic.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
- android:keyWidth="9%p"
- android:horizontalGap="0px"
- android:verticalGap="0px"
- android:keyHeight="@dimen/key_height"
- >
-
- <Row>
- <Key android:codes="1103" android:keyLabel="я" android:horizontalGap="0.5%p" android:keyEdgeFlags="left"/>
- <Key android:codes="1074" android:keyLabel="в"/>
- <Key android:codes="1077" android:keyLabel="е" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ёєэ"/>
- <Key android:codes="1088" android:keyLabel="р"/>
- <Key android:codes="1090" android:keyLabel="т" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ћ"/>
- <Key android:codes="1098" android:keyLabel="ъ"/>
- <Key android:codes="1091" android:keyLabel="у" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ў"/>
- <Key android:codes="1080" android:keyLabel="и" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ії"/>
- <Key android:codes="1086" android:keyLabel="о"/>
- <Key android:codes="1087" android:keyLabel="п"/>
- <Key android:codes="1095" android:keyLabel="ч" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ҷҹ" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row>
- <Key android:codes="1072" android:keyLabel="а" android:horizontalGap="0.5%p" android:keyEdgeFlags="left"/>
- <Key android:codes="1089" android:keyLabel="с"/>
- <Key android:codes="1076" android:keyLabel="д" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ђ"/>
- <Key android:codes="1092" android:keyLabel="ф"/>
- <Key android:codes="1075" android:keyLabel="г" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ґѓ"/>
- <Key android:codes="1093" android:keyLabel="х"/>
- <Key android:codes="1081" android:keyLabel="й" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ј"/>
- <Key android:codes="1082" android:keyLabel="к" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ќ"/>
- <Key android:codes="1083" android:keyLabel="л" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="љ"/>
- <Key android:codes="1096" android:keyLabel="ш"/>
- <Key android:codes="1097" android:keyLabel="щ" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row>
- <Key android:codes="-1" android:keyIcon="@drawable/sym_keyboard_shift"
- android:keyWidth="14%p" android:isModifier="true"
- android:isSticky="true" android:keyEdgeFlags="left"/>
- <Key android:codes="1079" android:keyLabel="з"/>
- <Key android:codes="1100" android:keyLabel="ь" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ыѣ"/>
- <Key android:codes="1094" android:keyLabel="ц"/>
- <Key android:codes="1078" android:keyLabel="ж" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="җџ"/>
- <Key android:codes="1073" android:keyLabel="б"/>
- <Key android:codes="1085" android:keyLabel="н" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="њ"/>
- <Key android:codes="1084" android:keyLabel="м"/>
- <Key android:codes="1102" android:keyLabel="ю"/>
- <Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete"
- android:keyWidth="15%p" android:keyEdgeFlags="right"
- android:isRepeatable="true"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/normalKeyboardMode">
- <Key android:codes="-100" android:keyLabel="Sr" android:keyWidth="13%p" android:keyEdgeFlags="left"/>
- <Key android:codes="-200" android:keyLabel="Tr" android:keyWidth="13%p"/>
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="13%p"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
- android:keyWidth="29%p" android:isRepeatable="true"/>
- <Key android:codes="46" android:keyLabel="." android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters=","
- android:keyWidth="14%p"/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="19%p" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/internalKeyboardMode">
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="15%p" android:horizontalGap="10%p" android:keyEdgeFlags="left"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
- android:keyWidth="30%p" android:isRepeatable="true"/>
- <Key android:codes="46" android:keyLabel="." android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters=","
- android:keyWidth="15%p"/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="20%p" android:keyEdgeFlags="right"/>
- </Row>
-</Keyboard>
diff --git a/src/ui/android/res/xml/devanagari_page1.xml b/src/ui/android/res/xml/devanagari_page1.xml
deleted file mode 100644
index 14e87a4f3..000000000
--- a/src/ui/android/res/xml/devanagari_page1.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
- android:keyWidth="10%p"
- android:horizontalGap="0px"
- android:verticalGap="0px"
- android:keyHeight="@dimen/key_height"
- >
-
- <Row>
- <Key android:codes="2325" android:keyLabel="क" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="क़०" android:keyEdgeFlags="left"/>
- <Key android:codes="2326" android:keyLabel="ख" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ख़१"/>
- <Key android:codes="2327" android:keyLabel="ग" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ग़२"/>
- <Key android:codes="2328" android:keyLabel="घ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="३"/>
- <Key android:codes="2329" android:keyLabel="ङ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="४"/>
- <Key android:codes="2330" android:keyLabel="च" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="५"/>
- <Key android:codes="2331" android:keyLabel="छ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="६"/>
- <Key android:codes="2332" android:keyLabel="ज" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ज़७"/>
- <Key android:codes="2333" android:keyLabel="झ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="८"/>
- <Key android:codes="2334" android:keyLabel="ञ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="९" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row>
- <Key android:codes="2335" android:keyLabel="ट" android:keyEdgeFlags="left"/>
- <Key android:codes="2336" android:keyLabel="ठ"/>
- <Key android:codes="2337" android:keyLabel="ड" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ड़"/>
- <Key android:codes="2338" android:keyLabel="ढ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ढ़"/>
- <Key android:codes="2339" android:keyLabel="ण"/>
- <Key android:codes="2340" android:keyLabel="त"/>
- <Key android:codes="2341" android:keyLabel="थ"/>
- <Key android:codes="2342" android:keyLabel="द"/>
- <Key android:codes="2343" android:keyLabel="ध"/>
- <Key android:codes="2344" android:keyLabel="न" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row>
- <Key android:codes="-10" android:keyLabel="1/2" android:horizontalGap="3%p" android:keyEdgeFlags="left"/>
- <Key android:codes="2309" android:keyLabel="अ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="आा"/>
- <Key android:codes="2311" android:keyLabel="इ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ीईि"/>
- <Key android:codes="2313" android:keyLabel="उ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ूऊु"/>
- <Key android:codes="2319" android:keyLabel="ए" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ॅऐैेऍ"/>
- <Key android:codes="2323" android:keyLabel="ओ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ॉौऔोऑ"/>
- <Key android:codes="2315" android:keyLabel="ऋ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ॄॠृ"/>
- <Key android:codes="2305" android:keyLabel="ँ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ंः"/>
- <Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete"
- android:keyWidth="15%p" android:keyEdgeFlags="right"
- android:isRepeatable="true"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/normalKeyboardMode">
- <Key android:codes="-100" android:keyLabel="Sr" android:keyWidth="13%p" android:horizontalGap="6%p" android:keyEdgeFlags="left"/>
- <Key android:codes="-200" android:keyLabel="Tr" android:keyWidth="13%p"/>
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="13%p"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
- android:keyWidth="29%p" android:isRepeatable="true"/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="19%p" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/internalKeyboardMode">
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="18%p" android:horizontalGap="15%p" android:keyEdgeFlags="left"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
- android:keyWidth="30%p" android:isRepeatable="true"/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="20%p" android:keyEdgeFlags="right"/>
- </Row>
-</Keyboard> \ No newline at end of file
diff --git a/src/ui/android/res/xml/devanagari_page2.xml b/src/ui/android/res/xml/devanagari_page2.xml
deleted file mode 100644
index 982adb277..000000000
--- a/src/ui/android/res/xml/devanagari_page2.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
- android:keyWidth="10%p"
- android:horizontalGap="0px"
- android:verticalGap="0px"
- android:keyHeight="@dimen/key_height"
- >
-
- <Row>
- <Key android:codes="2346" android:keyLabel="प" android:keyEdgeFlags="left"/>
- <Key android:codes="2347" android:keyLabel="फ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="फ़"/>
- <Key android:codes="2348" android:keyLabel="ब"/>
- <Key android:codes="2349" android:keyLabel="भ"/>
- <Key android:codes="2350" android:keyLabel="म"/>
- <Key android:codes="2351" android:keyLabel="य" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="य़"/>
- <Key android:codes="2352" android:keyLabel="र" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ऱ"/>
- <Key android:codes="2354" android:keyLabel="ल"/>
- <Key android:codes="2355" android:keyLabel="ळ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ऴ"/>
- <Key android:codes="2357" android:keyLabel="व" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row>
- <Key android:codes="2358" android:keyLabel="श" android:keyEdgeFlags="left"/>
- <Key android:codes="2359" android:keyLabel="ष"/>
- <Key android:codes="2360" android:keyLabel="स"/>
- <Key android:codes="2361" android:keyLabel="ह"/>
- <Key android:codes="2325,2381,2359" android:keyLabel="क्ष"/>
- <Key android:codes="2340,2381,2352" android:keyLabel="त्र"/>
- <Key android:codes="2332,2381,2334" android:keyLabel="ज्ञ"/>
- <Key android:codes="2358,2381,2352" android:keyLabel="श्र"/>
- <Key android:codes="2364" android:keyLabel="़"/>
- <Key android:codes="2381" android:keyLabel="्"/>"आ"
- </Row>
-
- <Row>
- <Key android:codes="-10" android:keyLabel="2/2" android:horizontalGap="3%p" android:keyEdgeFlags="left"/>
- <Key android:codes="2310" android:keyLabel="आ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="अा"/>
- <Key android:codes="2312" android:keyLabel="ई" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ीइि"/>
- <Key android:codes="2314" android:keyLabel="ऊ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ूउु"/>
- <Key android:codes="2320" android:keyLabel="ऐ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ॅैएेऍ"/>
- <Key android:codes="2324" android:keyLabel="औ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ॉौओोऑ"/>
- <Key android:codes="2400" android:keyLabel="ॠ" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ॄऋृ"/>
- <Key android:codes="2306" android:keyLabel="ं" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ँः"/>
- <Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete"
- android:keyWidth="15%p" android:keyEdgeFlags="right"
- android:isRepeatable="true"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/normalKeyboardMode">
- <Key android:codes="-100" android:keyLabel="Sr" android:keyWidth="13%p" android:horizontalGap="6%p" android:keyEdgeFlags="left"/>
- <Key android:codes="-200" android:keyLabel="Tr" android:keyWidth="13%p"/>
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="13%p"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
- android:keyWidth="29%p" android:isRepeatable="true"/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="19%p" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/internalKeyboardMode">
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="18%p" android:horizontalGap="15%p" android:keyEdgeFlags="left"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
- android:keyWidth="30%p" android:isRepeatable="true"/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="20%p" android:keyEdgeFlags="right"/>
- </Row>
-</Keyboard> \ No newline at end of file
diff --git a/src/ui/android/res/xml/method.xml b/src/ui/android/res/xml/method.xml
deleted file mode 100644
index af83761ca..000000000
--- a/src/ui/android/res/xml/method.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- The attributes in this XML file provide configuration information -->
-<!-- for the Search Manager. -->
-
-<input-method xmlns:android="http://schemas.android.com/apk/res/android">
-</input-method>
diff --git a/src/ui/android/res/xml/nordic.xml b/src/ui/android/res/xml/nordic.xml
deleted file mode 100644
index 80b1d6e51..000000000
--- a/src/ui/android/res/xml/nordic.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
- android:keyWidth="9%p"
- android:horizontalGap="0px"
- android:verticalGap="0px"
- android:keyHeight="@dimen/key_height"
- >
-
- <Row>
- <Key android:codes="113" android:keyLabel="q" android:horizontalGap="0.5%p" android:keyEdgeFlags="left"/>
- <Key android:codes="119" android:keyLabel="w"/>
- <Key android:codes="101" android:keyLabel="e" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="èéêěëę"/>
- <Key android:codes="114" android:keyLabel="r"/>
- <Key android:codes="116" android:keyLabel="t"/>
- <Key android:codes="121" android:keyLabel="y" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ỳýÿ"/>
- <Key android:codes="117" android:keyLabel="u" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ùúûǔūü"/>
- <Key android:codes="105" android:keyLabel="i" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ìíîǐï"/>
- <Key android:codes="111" android:keyLabel="o" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="òóôõöǫœø"/>
- <Key android:codes="112" android:keyLabel="p"/>
- <Key android:codes="229" android:keyLabel="å" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row>
- <Key android:codes="97" android:keyLabel="a" android:horizontalGap="0.5%p"
- android:keyEdgeFlags="left" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="àáâǎãäåæ"/>
- <Key android:codes="115" android:keyLabel="s" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ŝšß"/>
- <Key android:codes="100" android:keyLabel="d" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="đ"/>
- <Key android:codes="102" android:keyLabel="f"/>
- <Key android:codes="103" android:keyLabel="g" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ǵ"/>
- <Key android:codes="104" android:keyLabel="h"/>
- <Key android:codes="106" android:keyLabel="j" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ǰ"/>
- <Key android:codes="107" android:keyLabel="k" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ḱ"/>
- <Key android:codes="108" android:keyLabel="l"/>
- <Key android:codes="246" android:keyLabel="ö"/>
- <Key android:codes="228" android:keyLabel="ä" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row>
- <Key android:codes="-1" android:keyIcon="@drawable/sym_keyboard_shift"
- android:keyWidth="15%p" android:isModifier="true"
- android:isSticky="true" android:keyEdgeFlags="left"/>
- <Key android:codes="122" android:keyLabel="z" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ẑž" android:keyWidth="10%p"/>
- <Key android:codes="120" android:keyLabel="x" android:keyWidth="10%p"/>
- <Key android:codes="99" android:keyLabel="c" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ćč" android:keyWidth="10%p"/>
- <Key android:codes="118" android:keyLabel="v" android:keyWidth="10%p"/>
- <Key android:codes="98" android:keyLabel="b" android:keyWidth="10%p"/>
- <Key android:codes="110" android:keyLabel="n" android:keyWidth="10%p" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ńñ"/>
- <Key android:codes="109" android:keyLabel="m" android:keyWidth="10%p"/>
- <Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete"
- android:keyWidth="15%p" android:keyEdgeFlags="right"
- android:isRepeatable="true"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/normalKeyboardMode">
- <Key android:codes="-100" android:keyLabel="Sr" android:keyWidth="13%p" android:keyEdgeFlags="left"/>
- <Key android:codes="-200" android:keyLabel="Tr" android:keyWidth="13%p"/>
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="13%p"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
- android:keyWidth="29%p" android:isRepeatable="true"/>
- <Key android:codes="46" android:keyLabel="." android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters=","
- android:keyWidth="14%p"/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="19%p" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/internalKeyboardMode">
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="15%p" android:horizontalGap="10%p" android:keyEdgeFlags="left"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
- android:keyWidth="30%p" android:isRepeatable="true"/>
- <Key android:codes="46" android:keyLabel="." android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters=","
- android:keyWidth="15%p"/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="20%p" android:keyEdgeFlags="right"/>
- </Row>
-</Keyboard>
-
diff --git a/src/ui/android/res/xml/popup_keyboard.xml b/src/ui/android/res/xml/popup_keyboard.xml
deleted file mode 100644
index 521d3d278..000000000
--- a/src/ui/android/res/xml/popup_keyboard.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
- android:keyWidth="10%p"
- android:keyHeight="10%p">
-</Keyboard> \ No newline at end of file
diff --git a/src/ui/android/res/xml/qwerty.xml b/src/ui/android/res/xml/qwerty.xml
deleted file mode 100644
index a0021d4b4..000000000
--- a/src/ui/android/res/xml/qwerty.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
- android:keyWidth="10%p"
- android:horizontalGap="0px"
- android:verticalGap="0px"
- android:keyHeight="@dimen/key_height"
- >
-
- <Row>
- <Key android:codes="113" android:keyLabel="q" android:keyEdgeFlags="left"/>
- <Key android:codes="119" android:keyLabel="w"/>
- <Key android:codes="101" android:keyLabel="e" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="èéêěëę"/>
- <Key android:codes="114" android:keyLabel="r"/>
- <Key android:codes="116" android:keyLabel="t"/>
- <Key android:codes="121" android:keyLabel="y" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ỳýÿ"/>
- <Key android:codes="117" android:keyLabel="u" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ùúûǔūü"/>
- <Key android:codes="105" android:keyLabel="i" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ìíîǐï"/>
- <Key android:codes="111" android:keyLabel="o" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="òóôõöǫœø"/>
- <Key android:codes="112" android:keyLabel="p" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row>
- <Key android:codes="97" android:keyLabel="a" android:horizontalGap="5%p"
- android:keyEdgeFlags="left" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="àáâǎãäåæ"/>
- <Key android:codes="115" android:keyLabel="s" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ŝšß"/>
- <Key android:codes="100" android:keyLabel="d" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="đ"/>
- <Key android:codes="102" android:keyLabel="f"/>
- <Key android:codes="103" android:keyLabel="g" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ǵ"/>
- <Key android:codes="104" android:keyLabel="h"/>
- <Key android:codes="106" android:keyLabel="j" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ǰ"/>
- <Key android:codes="107" android:keyLabel="k" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ḱ"/>
- <Key android:codes="108" android:keyLabel="l" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row>
- <Key android:codes="-1" android:keyIcon="@drawable/sym_keyboard_shift"
- android:keyWidth="15%p" android:isModifier="true"
- android:isSticky="true" android:keyEdgeFlags="left"/>
- <Key android:codes="122" android:keyLabel="z" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ẑž"/>
- <Key android:codes="120" android:keyLabel="x"/>
- <Key android:codes="99" android:keyLabel="c" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ćč"/>
- <Key android:codes="118" android:keyLabel="v"/>
- <Key android:codes="98" android:keyLabel="b"/>
- <Key android:codes="110" android:keyLabel="n" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters="ńñ"/>
- <Key android:codes="109" android:keyLabel="m"/>
- <Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete"
- android:keyWidth="15%p" android:keyEdgeFlags="right"
- android:isRepeatable="true"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/normalKeyboardMode">
- <Key android:codes="-100" android:keyLabel="Sr" android:keyWidth="13%p" android:keyEdgeFlags="left"/>
- <Key android:codes="-200" android:keyLabel="Tr" android:keyWidth="13%p"/>
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="13%p"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
- android:keyWidth="29%p" android:isRepeatable="true"/>
- <Key android:codes="46" android:keyLabel="." android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters=","
- android:keyWidth="14%p"/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="19%p" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/internalKeyboardMode">
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="15%p" android:horizontalGap="10%p" android:keyEdgeFlags="left"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
- android:keyWidth="30%p" android:isRepeatable="true"/>
- <Key android:codes="46" android:keyLabel="." android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters=","
- android:keyWidth="15%p"/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="20%p" android:keyEdgeFlags="right"/>
- </Row>
-</Keyboard>
-
diff --git a/src/ui/android/res/xml/searchable.xml b/src/ui/android/res/xml/searchable.xml
deleted file mode 100644
index 7e7b6a846..000000000
--- a/src/ui/android/res/xml/searchable.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<searchable xmlns:android="http://schemas.android.com/apk/res/android"
- android:label="@string/app_name"
- android:hint="@string/search_hint"
- android:searchSuggestAuthority="org.grammaticalframework.ui.android.LexiconSuggestionProvider"
- android:includeInGlobalSearch="true"
- android:searchSettingsDescription="@string/search_description">
-</searchable>
diff --git a/src/ui/android/res/xml/symbols_page1.xml b/src/ui/android/res/xml/symbols_page1.xml
deleted file mode 100644
index 509bb79ae..000000000
--- a/src/ui/android/res/xml/symbols_page1.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
- android:keyWidth="10%p"
- android:horizontalGap="0px"
- android:verticalGap="0px"
- android:keyHeight="@dimen/key_height"
- >
-
- <Row>
- <Key android:codes="49" android:keyLabel="1" android:keyEdgeFlags="left"/>
- <Key android:codes="50" android:keyLabel="2"/>
- <Key android:codes="51" android:keyLabel="3"/>
- <Key android:codes="52" android:keyLabel="4"/>
- <Key android:codes="53" android:keyLabel="5"/>
- <Key android:codes="54" android:keyLabel="6"/>
- <Key android:codes="55" android:keyLabel="7"/>
- <Key android:codes="56" android:keyLabel="8"/>
- <Key android:codes="57" android:keyLabel="9"/>
- <Key android:codes="48" android:keyLabel="0" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row>
- <Key android:codes="64" android:keyLabel="\@" android:keyEdgeFlags="left"/>
- <Key android:codes="35" android:keyLabel="\#"/>
- <Key android:codes="36" android:keyLabel="$"/>
- <Key android:codes="37" android:keyLabel="%"/>
- <Key android:codes="38" android:keyLabel="&amp;"/>
- <Key android:codes="42" android:keyLabel="*"/>
- <Key android:codes="45" android:keyLabel="-"/>
- <Key android:codes="61" android:keyLabel="="/>
- <Key android:codes="40" android:keyLabel="("/>
- <Key android:codes="41" android:keyLabel=")" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row>
- <Key android:codes="-1" android:keyIcon="@drawable/sym_keyboard_shift"
- android:keyWidth="15%p" android:isModifier="true"
- android:isSticky="true" android:keyEdgeFlags="left"/>
- <Key android:codes="33" android:keyLabel="!" />
- <Key android:codes="34" android:keyLabel="&quot;"/>
- <Key android:codes="39" android:keyLabel="\'"/>
- <Key android:codes="58" android:keyLabel=":"/>
- <Key android:codes="59" android:keyLabel=";"/>
- <Key android:codes="47" android:keyLabel="/" />
- <Key android:codes="63" android:keyLabel="\?"/>
- <Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete"
- android:keyWidth="15%p" android:keyEdgeFlags="right"
- android:isRepeatable="true"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/normalKeyboardMode">
- <Key android:codes="-200" android:keyLabel="Tr" android:horizontalGap="5%p"
- android:keyWidth="13%p" android:keyEdgeFlags="left" />
- <Key android:codes="-2" android:keyLabel="ABC" android:keyWidth="15%p" />
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" android:keyWidth="30%p"
- android:isRepeatable="true"/>
- <Key android:codes="46" android:keyLabel="." android:keyWidth="15%p" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters=","/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="20%p" android:keyEdgeFlags="right"
- />
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/internalKeyboardMode">
- <Key android:codes="-2" android:keyLabel="ABC" android:keyWidth="15%p" android:horizontalGap="10%p"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" android:keyWidth="30%p"
- android:isRepeatable="true"/>
- <Key android:codes="46" android:keyLabel="." android:keyWidth="15%p" android:popupKeyboard="@xml/popup_keyboard" android:popupCharacters=","/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="20%p" android:keyEdgeFlags="right"
- />
- </Row>
-</Keyboard> \ No newline at end of file
diff --git a/src/ui/android/res/xml/symbols_page2.xml b/src/ui/android/res/xml/symbols_page2.xml
deleted file mode 100644
index b55e6f521..000000000
--- a/src/ui/android/res/xml/symbols_page2.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
- android:keyWidth="10%p"
- android:horizontalGap="0px"
- android:verticalGap="0px"
- android:keyHeight="@dimen/key_height"
- >
-
- <Row>
- <Key android:codes="126" android:keyLabel="~" android:keyEdgeFlags="left"/>
- <Key android:codes="177" android:keyLabel="±"/>
- <Key android:codes="215" android:keyLabel="×"/>
- <Key android:codes="247" android:keyLabel="÷"/>
- <Key android:codes="8226" android:keyLabel="•"/>
- <Key android:codes="176" android:keyLabel="°"/>
- <Key android:codes="96" android:keyLabel="`"/>
- <Key android:codes="180" android:keyLabel="´"/>
- <Key android:codes="123" android:keyLabel="{"/>
- <Key android:codes="125" android:keyLabel="}" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row>
- <Key android:codes="169" android:keyLabel="©" android:keyEdgeFlags="left"/>
- <Key android:codes="163" android:keyLabel="£"/>
- <Key android:codes="8364" android:keyLabel="€"/>
- <Key android:codes="94" android:keyLabel="^"/>
- <Key android:codes="174" android:keyLabel="®"/>
- <Key android:codes="165" android:keyLabel="¥"/>
- <Key android:codes="95" android:keyLabel="_"/>
- <Key android:codes="43" android:keyLabel="+"/>
- <Key android:codes="91" android:keyLabel="["/>
- <Key android:codes="93" android:keyLabel="]" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row>
- <Key android:codes="-1" android:keyIcon="@drawable/sym_keyboard_shift"
- android:keyWidth="15%p" android:isModifier="true"
- android:isSticky="true" android:keyEdgeFlags="left"/>
- <Key android:codes="161" android:keyLabel="¡" />
- <Key android:codes="60" android:keyLabel="&lt;"/>
- <Key android:codes="62" android:keyLabel="&gt;"/>
- <Key android:codes="162" android:keyLabel="¢"/>
- <Key android:codes="124" android:keyLabel="|"/>
- <Key android:codes="92" android:keyLabel="\\" />
- <Key android:codes="191" android:keyLabel="¿"/>
- <Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete"
- android:keyWidth="15%p" android:keyEdgeFlags="right"
- android:isRepeatable="true"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/normalKeyboardMode">
- <Key android:codes="-200" android:keyLabel="Tr" android:horizontalGap="5%p"
- android:keyWidth="13%p" android:keyEdgeFlags="left" />
- <Key android:codes="-2" android:keyLabel="ABC" android:keyWidth="15%p" />
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" android:keyWidth="30%p"
- android:isRepeatable="true"/>
- <Key android:codes="8230" android:keyLabel="…" android:keyWidth="15%p" />
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="20%p" android:keyEdgeFlags="right" />
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/internalKeyboardMode">
- <Key android:codes="-2" android:keyLabel="ABC" android:keyWidth="15%p" android:horizontalGap="10%p"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" android:keyWidth="30%p"
- android:isRepeatable="true"/>
- <Key android:codes="8230" android:keyLabel="…" android:keyWidth="15%p" />
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="20%p" android:keyEdgeFlags="right" />
- </Row>
-</Keyboard>
diff --git a/src/ui/android/res/xml/thai_page1.xml b/src/ui/android/res/xml/thai_page1.xml
deleted file mode 100644
index bcc2aee39..000000000
--- a/src/ui/android/res/xml/thai_page1.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
- android:keyWidth="9%p"
- android:horizontalGap="0px"
- android:verticalGap="0px"
- android:keyHeight="@dimen/key_height"
- >
-
- <Row android:keyWidth="8%p">
- <Key android:codes="3653" android:keyLabel="ๅ" android:horizontalGap="2%p"/>
- <Key android:codes="3613" android:keyLabel="ฝ"/>
- <Key android:codes="3622" android:keyLabel="ฦ"/>
- <Key android:codes="3616" android:keyLabel="ภ"/>
- <Key android:codes="3606" android:keyLabel="ถ"/>
- <Key android:codes="3640" android:keyLabel="ุ"/>
- <Key android:codes="3638" android:keyLabel="ึ"/>
- <Key android:codes="3588" android:keyLabel="ค"/>
- <Key android:codes="3605" android:keyLabel="ต"/>
- <Key android:codes="3592" android:keyLabel="จ"/>
- <Key android:codes="3586" android:keyLabel="ข"/>
- <Key android:codes="3594" android:keyLabel="ช"/>
- </Row>
-
- <Row>
- <Key android:codes="3654" android:keyLabel="ๆ" android:horizontalGap="1%p"/>
- <Key android:codes="3652" android:keyLabel="ไ"/>
- <Key android:codes="3614" android:keyLabel="พ"/>
- <Key android:codes="3632" android:keyLabel="ะ"/>
- <Key android:codes="3633" android:keyLabel="ั"/>
- <Key android:codes="3637" android:keyLabel="ี"/>
- <Key android:codes="3619" android:keyLabel="ร"/>
- <Key android:codes="3609" android:keyLabel="น"/>
- <Key android:codes="3618" android:keyLabel="ย"/>
- <Key android:codes="3610" android:keyLabel="บ"/>
- <Key android:codes="3621" android:keyLabel="ล"/>
- </Row>
-
- <Row>
- <Key android:codes="3615" android:keyLabel="ฟ" android:horizontalGap="1%p"/>
- <Key android:codes="3627" android:keyLabel="ห"/>
- <Key android:codes="3585" android:keyLabel="ก"/>
- <Key android:codes="3604" android:keyLabel="ด"/>
- <Key android:codes="3648" android:keyLabel="เ"/>
- <Key android:codes="3657" android:keyLabel="้"/>
- <Key android:codes="3656" android:keyLabel="่"/>
- <Key android:codes="3634" android:keyLabel="า"/>
- <Key android:codes="3626" android:keyLabel="ส"/>
- <Key android:codes="3623" android:keyLabel="ว"/>
- <Key android:codes="3591" android:keyLabel="ง"/>
- </Row>
-
- <Row android:keyWidth="8%p">
- <Key android:codes="-10" android:keyLabel="1/2" android:horizontalGap="2%p" android:keyEdgeFlags="left"/>
- <Key android:codes="3612" android:keyLabel="ผ"/>
- <Key android:codes="3611" android:keyLabel="ป"/>
- <Key android:codes="3649" android:keyLabel="แ"/>
- <Key android:codes="3629" android:keyLabel="อ"/>
- <Key android:codes="3636" android:keyLabel="ิ"/>
- <Key android:codes="3639" android:keyLabel="ื"/>
- <Key android:codes="3607" android:keyLabel="ท"/>
- <Key android:codes="3617" android:keyLabel="ม"/>
- <Key android:codes="3651" android:keyLabel="ใ"/>
- <Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete"
- android:keyWidth="15%p" android:keyEdgeFlags="right"
- android:isRepeatable="true"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/normalKeyboardMode">
- <Key android:codes="-100" android:keyLabel="Sr" android:keyWidth="13%p" android:horizontalGap="6%p" android:keyEdgeFlags="left"/>
- <Key android:codes="-200" android:keyLabel="Tr" android:keyWidth="13%p"/>
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="13%p"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
- android:keyWidth="29%p" android:isRepeatable="true"/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="19%p" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/internalKeyboardMode">
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="18%p" android:horizontalGap="15%p" android:keyEdgeFlags="left"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
- android:keyWidth="30%p" android:isRepeatable="true"/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="20%p" android:keyEdgeFlags="right"/>
- </Row>
-</Keyboard>
diff --git a/src/ui/android/res/xml/thai_page2.xml b/src/ui/android/res/xml/thai_page2.xml
deleted file mode 100644
index 00e76f525..000000000
--- a/src/ui/android/res/xml/thai_page2.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
- android:keyWidth="9%p"
- android:horizontalGap="0px"
- android:verticalGap="0px"
- android:keyHeight="@dimen/key_height"
- >
-
- <Row>
- <Key android:codes="43" android:keyLabel="+"/>
- <Key android:codes="3665" android:keyLabel="๑"/>
- <Key android:codes="3666" android:keyLabel="๒"/>
- <Key android:codes="3667" android:keyLabel="๓"/>
- <Key android:codes="3668" android:keyLabel="๔"/>
- <Key android:codes="3647" android:keyLabel="฿"/>
- <Key android:codes="3669" android:keyLabel="๕"/>
- <Key android:codes="3670" android:keyLabel="๖"/>
- <Key android:codes="3671" android:keyLabel="๗"/>
- <Key android:codes="3672" android:keyLabel="๘"/>
- <Key android:codes="3673" android:keyLabel="๙"/>
- </Row>
-
- <Row android:keyWidth="8%p">
- <Key android:codes="3664" android:keyLabel="๐" android:horizontalGap="2%p"/>
- <Key android:codes="34" android:keyLabel='"'/>
- <Key android:codes="3598" android:keyLabel="ฎ"/>
- <Key android:codes="3601" android:keyLabel="ฑ"/>
- <Key android:codes="3608" android:keyLabel="ธ"/>
- <Key android:codes="3661" android:keyLabel="ํ"/>
- <Key android:codes="3658" android:keyLabel="๊"/>
- <Key android:codes="3603" android:keyLabel="ณ"/>
- <Key android:codes="3631" android:keyLabel="ฯ"/>
- <Key android:codes="3597" android:keyLabel="ญ"/>
- <Key android:codes="3600" android:keyLabel="ฐ"/>
- <Key android:codes="3587" android:keyLabel="ฃ"/>
- </Row>
-
- <Row>
- <Key android:codes="3620" android:keyLabel="ฤ" android:horizontalGap="1%p"/>
- <Key android:codes="3590" android:keyLabel="ฆ"/>
- <Key android:codes="3599" android:keyLabel="ฏ"/>
- <Key android:codes="3650" android:keyLabel="โ"/>
- <Key android:codes="3596" android:keyLabel="ฌ"/>
- <Key android:codes="3655" android:keyLabel="็"/>
- <Key android:codes="3659" android:keyLabel="๋"/>
- <Key android:codes="3625" android:keyLabel="ษ"/>
- <Key android:codes="3624" android:keyLabel="ศ"/>
- <Key android:codes="3595" android:keyLabel="ซ"/>
- <Key android:codes="3589" android:keyLabel="ฅ"/>
- </Row>
-
- <Row>
- <Key android:codes="-10" android:keyLabel="2/2" android:horizontalGap="8%p" android:keyEdgeFlags="left"/>
- <Key android:codes="3593" android:keyLabel="ฉ"/>
- <Key android:codes="3630" android:keyLabel="ฮ"/>
- <Key android:codes="3642" android:keyLabel="ฺ"/>
- <Key android:codes="3660" android:keyLabel="์"/>
- <Key android:codes="3602" android:keyLabel="ฒ"/>
- <Key android:codes="3628" android:keyLabel="ฬ"/>
- <Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete"
- android:keyWidth="15%p" android:keyEdgeFlags="right"
- android:isRepeatable="true"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/normalKeyboardMode">
- <Key android:codes="-100" android:keyLabel="Sr" android:keyWidth="13%p" android:horizontalGap="6%p" android:keyEdgeFlags="left"/>
- <Key android:codes="-200" android:keyLabel="Tr" android:keyWidth="13%p"/>
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="13%p"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
- android:keyWidth="29%p" android:isRepeatable="true"/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="19%p" android:keyEdgeFlags="right"/>
- </Row>
-
- <Row android:rowEdgeFlags="bottom" android:keyboardMode="@string/internalKeyboardMode">
- <Key android:codes="-2" android:keyLabel="123" android:keyWidth="18%p" android:horizontalGap="15%p" android:keyEdgeFlags="left"/>
- <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
- android:keyWidth="30%p" android:isRepeatable="true"/>
- <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
- android:keyWidth="20%p" android:keyEdgeFlags="right"/>
- </Row>
-</Keyboard>
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/ASR.java b/src/ui/android/src/org/grammaticalframework/ui/android/ASR.java
deleted file mode 100644
index 8d683e1f5..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/ASR.java
+++ /dev/null
@@ -1,240 +0,0 @@
-
-package org.grammaticalframework.ui.android;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.speech.RecognitionListener;
-import android.speech.RecognizerIntent;
-import android.speech.SpeechRecognizer;
-import android.text.TextUtils;
-import android.util.Log;
-
-import java.util.ArrayList;
-
-/**
- * Convenience wrapper around the {@link SpeechRecognizer} API.
- */
-public class ASR {
-
- private static final boolean DBG = false;
- private static final String TAG = "ASR";
-
- private final Context mContext;
-
- private SpeechRecognizer mSpeechRecognizer;
-
- private String mLanguage = null;
-
- private State mState = State.IDLE;
-
- private Listener mListener;
-
- public static enum State {
- IDLE, INITIALIZING, WAITING_FOR_SPEECH, RECORDING, WAITING_FOR_RESULTS;
- }
-
- public ASR(Context context) {
- mContext = context;
- if (SpeechRecognizer.isRecognitionAvailable(context)) {
- mSpeechRecognizer = SpeechRecognizer.createSpeechRecognizer(context);
- mSpeechRecognizer.setRecognitionListener(new MyRecognitionListener());
- }
- }
-
- public void setListener(Listener listener) {
- mListener = listener;
- }
-
- public void setLanguage(String language) {
- mLanguage = language;
- }
-
- public void startRecognition() {
- Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
- if (!TextUtils.isEmpty(mLanguage)) {
- intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, mLanguage);
- }
- intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
- RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
- intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 2);
- intent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
- // Weird, this shouldn't be required, but on ICS it seems to be
- intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
- mContext.getPackageName());
-
- mSpeechRecognizer.startListening(intent);
- setState(State.INITIALIZING);
- }
-
- public void stopRecognition() {
- mSpeechRecognizer.stopListening();
- setState(State.IDLE);
- }
-
- public boolean isRunning() {
- return mState != State.IDLE;
- }
-
- private void setState(State newState) {
- if (DBG) Log.d(TAG, "Entering state: " + newState);
- mState = newState;
- if (mListener != null) {
- mListener.onStateChanged(mState);
- }
- }
-
- public State getState() {
- return mState;
- }
-
- public void destroy() {
- if (mSpeechRecognizer != null) {
- mSpeechRecognizer.destroy();
- mSpeechRecognizer = null;
- }
- }
-
- private void handlePartialInput(String text) {
- if (mListener != null) {
- mListener.onPartialInput(text);
- }
- }
-
- private void handleSpeechInput(String text) {
- if (mListener != null) {
- mListener.onSpeechInput(text);
- }
- }
-
- private class MyRecognitionListener implements RecognitionListener {
- @Override
- public void onReadyForSpeech(Bundle params) {
- if (DBG) Log.d(TAG, "onReadyForSpeech");
- setState(State.WAITING_FOR_SPEECH);
- }
-
- @Override
- public void onBeginningOfSpeech() {
- if (DBG) Log.d(TAG, "onBeginningOfSpeech");
- setState(State.RECORDING);
- }
-
- @Override
- public void onBufferReceived(byte[] buffer) {
- // Ignore
- }
-
- @Override
- public void onRmsChanged(float rmsdB) {
- if (DBG) Log.d(TAG, "onRmsChanged(" + rmsdB + ")");
- }
-
- @Override
- public void onEndOfSpeech() {
- if (DBG) Log.d(TAG, "onEndOfSpeech");
- setState(State.WAITING_FOR_RESULTS);
- }
-
- @Override
- public void onError(int error) {
- if (DBG) Log.d(TAG, "Error: " + errorMessage(error) + " (" + error + ")");
- setState(State.IDLE);
- }
-
- private String errorMessage(int speechRecognizerError) {
- switch(speechRecognizerError) {
- case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
- return "network timeout";
- case SpeechRecognizer.ERROR_NETWORK:
- return "network";
- case SpeechRecognizer.ERROR_AUDIO:
- return "audio";
- case SpeechRecognizer.ERROR_SERVER:
- return "server";
- case SpeechRecognizer.ERROR_CLIENT:
- return "client";
- case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
- return "timeout waiting for speech";
- case SpeechRecognizer.ERROR_NO_MATCH:
- return "no match found";
- case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
- return "recognizer busy";
- case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
- return "insufficient permissions (missing RECORD_AUDIO?)";
- default:
- return "unknown";
- }
- }
-
- @Override
- public void onEvent(int eventType, Bundle params) {
- if (DBG) Log.d(TAG, "onEvent(" + eventType + ")");
- }
-
- @Override
- public void onPartialResults(Bundle bundle) {
- if (DBG) {
- StringBuilder sb = new StringBuilder();
- sb.append("onPartialResults:");
- appendResults(sb, bundle);
- Log.d(TAG, sb.toString());
- }
-
- String result = getResult(bundle);
- if (!TextUtils.isEmpty(result)) {
- handlePartialInput(result);
- }
- }
-
- @Override
- public void onResults(Bundle bundle) {
- if (DBG) {
- StringBuilder sb = new StringBuilder();
- sb.append("onResults:");
- appendResults(sb, bundle);
- Log.d(TAG, sb.toString());
- }
-
- setState(State.IDLE);
-
- String result = getResult(bundle);
- if (!TextUtils.isEmpty(result)) {
- handleSpeechInput(result);
- }
- }
-
- private String getResult(Bundle bundle) {
- ArrayList<String> results =
- bundle.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
- if (results != null && !results.isEmpty()) {
- return results.get(0);
- } else {
- return null;
- }
- }
-
- private void appendResults(StringBuilder sb, Bundle bundle) {
- ArrayList<String> results =
- bundle.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
- float[] scores = bundle.getFloatArray(SpeechRecognizer.CONFIDENCE_SCORES);
-
- if (results != null) {
- int size = results.size();
- for (int i = 0; i < size; i++) {
- sb.append("\n> ").append(results.get(i));
- if (scores != null && i < scores.length) {
- sb.append(" [").append(scores[i]).append("]");
- }
- }
- }
- }
- }
-
- public interface Listener {
- void onPartialInput(String input);
- void onSpeechInput(String input);
- void onStateChanged(State newState);
- }
-
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/AlternativesActivity.java b/src/ui/android/src/org/grammaticalframework/ui/android/AlternativesActivity.java
deleted file mode 100644
index 4f39a04e1..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/AlternativesActivity.java
+++ /dev/null
@@ -1,674 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import java.util.*;
-
-import android.app.Activity;
-import android.app.ListActivity;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.view.*;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.view.ViewGroup.LayoutParams;
-import android.view.MenuItem;
-import android.view.LayoutInflater;
-import android.webkit.WebView;
-import android.widget.BaseAdapter;
-import android.widget.ListAdapter;
-import android.widget.ArrayAdapter;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-import android.widget.CheckBox;
-import android.widget.CompoundButton;
-import android.widget.ListView;
-import android.widget.AdapterView;
-import android.util.Log;
-import android.support.v4.widget.DrawerLayout;
-import android.support.v4.app.ActionBarDrawerToggle;
-
-import org.grammaticalframework.pgf.*;
-import org.grammaticalframework.ui.android.LanguageSelector.OnLanguageSelectedListener;
-
-public class AlternativesActivity extends ListActivity {
-
- private Translator mTranslator;
- private LanguageSelector mShowLanguageView;
- private View mProgressBarView = null;
- private AlternativesAdapter mAdapter = null;
- private DrawerLayout mDrawerLayout;
- private ListView mDrawerList;
- private ActionBarDrawerToggle mDrawerToggle;
-
- /** Called when the activity is first created. */
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_lexical_entry);
-
- mTranslator = ((GFTranslator) getApplicationContext()).getTranslator();
-
- mShowLanguageView = (LanguageSelector) findViewById(R.id.show_language);
- mShowLanguageView.setLanguages(mTranslator.getAvailableLanguages());
- mShowLanguageView.setOnLanguageSelectedListener(new OnLanguageSelectedListener() {
- @Override
- public void onLanguageSelected(final Language language) {
- new AsyncTask<Void,Void,Void>() {
- @Override
- protected void onPreExecute() {
- showProgressBar();
- }
-
- @Override
- protected Void doInBackground(Void... params) {
- mTranslator.setTargetLanguage(language);
- mTranslator.isTargetLanguageLoaded();
- return null;
- }
-
- @Override
- protected void onPostExecute(Void result) {
- mAdapter.notifyDataSetChanged();
- collapse();
- hideProgressBar();
- }
- }.execute();
- }
- });
-
- mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
- mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
- R.drawable.ic_drawer,
- R.string.topics_open,
- R.string.topics_close);
- mDrawerLayout.setDrawerListener(mDrawerToggle);
-
- getActionBar().setDisplayHomeAsUpEnabled(true);
- getActionBar().setHomeButtonEnabled(true);
-
- TextView descrView = (TextView) findViewById(R.id.lexical_desc);
-
- if (getIntent().getData() != null) {
- String authority = getIntent().getData().getAuthority();
- String source = getIntent().getData().getQueryParameter("source");
-
- List analyses = new ArrayList();
- for (String an : getIntent().getData().getQueryParameters("alternative")) {
- analyses.add(Expr.readExpr(an));
- }
- descrView.setText(source);
-
- mAdapter = new AlternativesAdapter(this, authority, analyses);
- } else {
- mDrawerLayout.openDrawer(Gravity.LEFT);
-
- mAdapter = new AlternativesAdapter(this, Translator.WORDS);
- }
-
- expandedView = null;
- setListAdapter(mAdapter);
-
- mDrawerList = (ListView) findViewById(R.id.topics_list);
- mDrawerList.setAdapter(mAdapter.getTopicsAdapter());
-
- mProgressBarView = findViewById(R.id.progressBarView);
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- mShowLanguageView.setSelectedLanguage(mTranslator.getTargetLanguage());
- }
-
- private void showProgressBar() {
- mProgressBarView.setVisibility(View.VISIBLE);
- }
-
- private void hideProgressBar() {
- mProgressBarView.setVisibility(View.GONE);
- }
-
- private View expandedView;
-
- private void collapse() {
- if (expandedView == null)
- return;
-
- ImageView arrow = (ImageView) expandedView.findViewById(R.id.arrow);
- arrow.setImageResource(R.drawable.open_arrow);
-
- View view = (View) expandedView.findViewById(R.id.desc_details);
- ((RelativeLayout) expandedView).removeView(view);
-
- TextView textView = (TextView) expandedView.findViewById(R.id.abstract_tree);
- if (textView != null)
- ((RelativeLayout) expandedView).removeView(textView);
-
- expandedView = null;
- }
-
- private void expandWord(View view, Expr lemma) {
- String html = mTranslator.getInflectionTable(lemma);
- if (html == null)
- return;
-
- ImageView arrow = (ImageView) view.findViewById(R.id.arrow);
- arrow.setImageResource(R.drawable.close_arrow);
-
- WebView inflectionView = (WebView) view.findViewById(R.id.desc_details);
- if (inflectionView == null) {
- inflectionView = new WebView(this);
- inflectionView.setId(R.id.desc_details);
- RelativeLayout.LayoutParams params =
- new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
- params.addRule(RelativeLayout.BELOW, R.id.lexical_desc);
- ((RelativeLayout) view).addView(inflectionView, params);
- }
-
- inflectionView.loadData(html, "text/html; charset=UTF-8", null);
-
- expandedView = view;
- }
-
- private void expandSentence(View view, Expr expr) {
- ImageView arrow = (ImageView) view.findViewById(R.id.arrow);
- arrow.setImageResource(R.drawable.close_arrow);
-
- ParseTreeView parseView = (ParseTreeView) view.findViewById(R.id.desc_details);
- if (parseView == null) {
- parseView = new ParseTreeView(this);
- parseView.setId(R.id.desc_details);
- RelativeLayout.LayoutParams params =
- new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
- params.addRule(RelativeLayout.BELOW, R.id.alternative_desc);
- ((RelativeLayout) view).addView(parseView, params);
- }
-
- Object[] brackets = mTranslator.bracketedLinearize(expr);
- if (brackets[0] instanceof Bracket) {
- Bracket b = (Bracket) brackets[0];
- if (b.children[0].equals("*") ||
- b.children[0].equals("+")) {
- Object[] children = new Object[b.children.length-1];
- for (int i = 1; i < b.children.length; i++)
- children[i-1] = b.children[i];
- b = new Bracket(b.cat, b.fun, b.fid, b.lindex, children);
- brackets[0] = b;
- }
- }
- parseView.setBrackets(brackets);
-
- TextView textView = (TextView) view.findViewById(R.id.abstract_tree);
- if (textView == null) {
- textView = new TextView(this);
- textView.setId(R.id.abstract_tree);
- textView.setTextSize(15);
- RelativeLayout.LayoutParams params =
- new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
- params.addRule(RelativeLayout.BELOW, R.id.desc_details);
- ((RelativeLayout) view).addView(textView, params);
- }
- textView.setText(expr.toString());
-
- expandedView = view;
- }
-
- private class Topic {
- public String name;
- public Expr expr;
- public boolean isChecked;
- public boolean isAvailable;
-
- public Topic(String name, Expr expr) {
- this.name = name;
- this.expr = expr;
- this.isChecked = false;
- this.isAvailable = true;
- }
- }
-
- private class AlternativesAdapter extends BaseAdapter implements ListAdapter {
- /**
- * Contains the list of objects that represent the alternatives
- */
- private List<Expr> mAlternatives;
-
- private Context mContext;
-
- // A copy of the original mAlternatives array, initialized from and then used instead as soon as
- // a topic filtering is applied. mAlternatives will then only contain the filtered values.
- private ArrayList<Expr> mOriginalAlternatives;
-
- private LayoutInflater mInflater;
-
- private String mAuthority;
-
- /**
- * A list of lists of topics. Each element in this list contains
- * the list of topics for the correponding item in
- * mAlternatives/mOriginalAlternatives
- */
- private List<List<Topic>> mTopics;
-
- private Map<String,Topic> mTopicMap;
- private Topic[] mAllTopics;
- private Topic[] mOriginalAllTopics;
-
- private Topic mOtherTopic;
- private Topic mSourceTopic;
-
- private TopicsAdapter mTopicsAdapter;
-
- public AlternativesAdapter(Context context, String authority, List<Expr> alternatives) {
- mContext = context;
- mAuthority = authority;
- mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- mAlternatives = alternatives;
-
- boolean addOther = false;
- mTopics = new ArrayList<List<Topic>>();
- mTopicMap = new TreeMap<String,Topic>();
- for (Expr e : mAlternatives) {
- List<Topic> topics = new ArrayList<Topic>();
- for (Expr topicExpr : mTranslator.getTopicsOf(e)) {
- String name = mTranslator.linearizeSource(topicExpr);
- String key = name.toLowerCase();
- Topic topic = mTopicMap.get(key);
- if (topic == null) {
- topic = new Topic(name, topicExpr);
- mTopicMap.put(key,topic);
- }
- topics.add(topic);
- }
- mTopics.add(topics);
-
- if (topics.size() == 0)
- addOther = true;
- }
-
- int i = 0;
- mAllTopics = new Topic[mTopicMap.size() + (addOther ? 1 : 0)];
- for (Map.Entry<String,Topic> entry : mTopicMap.entrySet()) {
- mAllTopics[i++] = entry.getValue();
- }
- if (addOther) {
- Expr topicExpr = Expr.readExpr("other_A");
- String name = mTranslator.linearizeSource(topicExpr);
- mOtherTopic = new Topic(name, topicExpr);
- mAllTopics[i++] = mOtherTopic;
- }
-
- mOriginalAllTopics = mAllTopics;
-
- mTopicsAdapter = new TopicsAdapter();
- }
-
- public AlternativesAdapter(Context context, String authority) {
- mContext = context;
- mAuthority = authority;
- mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- mAlternatives = null;
-
- mTopics = null;
-
- int i = 0;
- mTopicMap = new TreeMap<String,Topic>();
- for (Expr topicExpr : mTranslator.getTopicsOf(null)) {
- String name = mTranslator.linearizeSource(topicExpr);
- String key = name.toLowerCase();
- Topic topic = mTopicMap.get(key);
- if (topic == null) {
- topic = new Topic(name, topicExpr);
- mTopicMap.put(key,topic);
- }
- }
- mAllTopics = new Topic[mTopicMap.size()];
- for (Map.Entry<String,Topic> entry : mTopicMap.entrySet()) {
- mAllTopics[i++] = entry.getValue();
- }
-
- mOriginalAllTopics = mAllTopics;
-
- mTopicsAdapter = new TopicsAdapter();
- }
-
- /**
- * Returns the context associated with this array adapter. The context is used
- * to create views from the resource passed to the constructor.
- *
- * @return The Context associated with this adapter.
- */
- public Context getContext() {
- return mContext;
- }
-
- public String getAuthority() {
- return mAuthority;
- }
-
- /**
- * {@inheritDoc}
- */
- public int getCount() {
- if (mAlternatives == null)
- return 0;
- else
- return mAlternatives.size();
- }
-
- /**
- * {@inheritDoc}
- */
- public Expr getItem(int position) {
- return mAlternatives.get(position);
- }
-
- /**
- * Returns the position of the specified item in the array.
- *
- * @param item The item to retrieve the position of.
- *
- * @return The position of the specified item.
- */
- public int getPosition(Expr item) {
- if (mAlternatives == null)
- return -1;
- else
- return mAlternatives.indexOf(item);
- }
-
- /**
- * {@inheritDoc}
- */
- public long getItemId(int position) {
- return position;
- }
-
- public View getView(int position, View convertView, ViewGroup parent) {
- final Expr expr = getItem(position);
-
- if (mAuthority.equals(Translator.WORDS)) {
- if (convertView == null) {
- convertView = mInflater.inflate(R.layout.lexical_item, null);
- }
-
- TextView descView = (TextView)
- convertView.findViewById(R.id.lexical_desc);
-
- String phrase = mTranslator.generateLexiconEntry(expr);
- descView.setText(phrase);
-
- convertView.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- if (expandedView == view)
- collapse();
- else if (expandedView == null)
- expandWord(view, expr);
- else {
- collapse();
- expandWord(view, expr);
- }
- }
- });
- } else if (mAuthority.equals(Translator.SENTENCES)) {
- if (convertView == null) {
- convertView = mInflater.inflate(R.layout.alternative_item, null);
-
- View treeView = (View) convertView.findViewById(R.id.desc_details);
- ((RelativeLayout) convertView).removeView(treeView);
-
- TextView textView = (TextView) convertView.findViewById(R.id.abstract_tree);
- ((RelativeLayout) convertView).removeView(textView);
- }
-
- TextView descView = (TextView)
- convertView.findViewById(R.id.alternative_desc);
-
- String phrase = mTranslator.linearize(expr);
-
- // parse by words, marked by %, darkest red color
- if (phrase.charAt(0) == '%') {
- descView.setBackgroundDrawable(getResources().getDrawable(R.drawable.second_person_worst_utterance_bg));
- phrase = phrase.substring(2);
- }
-
- // parse by chunks, marked by *, red color
- else if (phrase.charAt(0) == '*') {
- descView.setBackgroundDrawable(getResources().getDrawable(R.drawable.second_person_chunk_utterance_bg));
- phrase = phrase.substring(2);
- }
-
- // parse error or unknown translations (in []) present, darkest red color
- else if (phrase.contains("parse error:") || phrase.contains("[")) {
- descView.setBackgroundDrawable(getResources().getDrawable(R.drawable.second_person_worst_utterance_bg));
- }
-
- // parse by domain grammar, marked by +, green color
- else if (phrase.charAt(0) == '+') {
- descView.setBackgroundDrawable(getResources().getDrawable(R.drawable.second_person_best_utterance_bg));
- phrase = phrase.substring(2);
- }
-
- else {
- descView.setBackgroundDrawable(getResources().getDrawable(R.drawable.second_person_utterance_bg));
- }
-
- descView.setText(phrase);
-
- convertView.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- if (expandedView == view)
- collapse();
- else if (expandedView == null)
- expandSentence(view, expr);
- else {
- collapse();
- expandSentence(view, expr);
- }
- }
- });
- }
-
- return convertView;
- }
-
- public boolean areAllItemsEnabled() {
- return true;
- }
-
- public boolean isEnabled(int position) {
- return true;
- }
-
- public TopicsAdapter getTopicsAdapter() {
- return mTopicsAdapter;
- }
-
- void filterOnTopics(List<Topic> selected_topics) {
- if (mSourceTopic != null && !selected_topics.contains(mSourceTopic)) {
- mAlternatives = null;
- mOriginalAlternatives = null;
- mTopics = null;
- mAllTopics = mOriginalAllTopics;
- }
-
- if (mAlternatives == null) {
- if (selected_topics.size() == 0) {
- notifyDataSetChanged();
- return;
- }
-
- mSourceTopic = selected_topics.get(0);
- mAlternatives = mTranslator.getTopicWords(mSourceTopic.expr);
-
- mTopics = new ArrayList<List<Topic>>();
- for (Expr e : mAlternatives) {
- List<Topic> topics = new ArrayList<Topic>();
- for (Expr topicExpr : mTranslator.getTopicsOf(e)) {
- String name = mTranslator.linearizeSource(topicExpr);
- String key = name.toLowerCase();
- topics.add(mTopicMap.get(key));
- }
- mTopics.add(topics);
- }
- }
-
- if (mOriginalAlternatives == null) {
- mOriginalAlternatives = new ArrayList<Expr>(mAlternatives);
- }
-
- mAlternatives = new ArrayList<Expr>();
- List<List<Expr>> topics = new ArrayList<List<Expr>>();
-
- for (Topic topic : mOriginalAllTopics) {
- topic.isAvailable = false;
- }
-
- int count = 0;
- for (int i = 0; i < mOriginalAlternatives.size(); i++) {
- boolean match = true;
- for (Topic topic : selected_topics) {
- if (topic == mOtherTopic) {
- if (mTopics.get(i).size() > 0) {
- match = false;
- break;
- }
- } else if (!mTopics.get(i).contains(topic)) {
- match = false;
- break;
- }
- }
- if (match) {
- mAlternatives.add(mOriginalAlternatives.get(i));
- if (mTopics.get(i).size() == 0) {
- if (!mOtherTopic.isAvailable)
- count++;
- mOtherTopic.isAvailable = true;
- } else {
- for (Topic topic : mTopics.get(i)) {
- if (!topic.isAvailable)
- count++;
- topic.isAvailable = true;
- }
- }
- }
- }
-
- int i = 0;
- mAllTopics = new Topic[count];
- for (Topic topic : mOriginalAllTopics) {
- if (topic.isAvailable)
- mAllTopics[i++] = topic;
- }
-
- notifyDataSetChanged();
- }
- }
-
- private class TopicsAdapter extends BaseAdapter implements ListAdapter {
- public TopicsAdapter() {
- }
-
- public Context getContext() {
- return mAdapter.getContext();
- }
-
- public int getCount() {
- return mAdapter.mAllTopics.length;
- }
-
- public Topic getItem(int position) {
- return mAdapter.mAllTopics[position];
- }
-
- public int getPosition(Topic topic) {
- for (int i = 0; i < mAdapter.mAllTopics.length; i++) {
- if (mAdapter.mAllTopics[i] == topic)
- return i;
- }
- return -1;
- }
-
- public long getItemId(int position) {
- return position;
- }
-
- // Shame on you Google this class should not have been here
- // but unfortuantely CheckBox.setChecked doesn't work and here
- // we need a workarround. Since the class is there now it is also
- // used to implement OnClickListener.
- private class TopicCheckBox extends CheckBox implements OnClickListener {
- private Topic mTopic;
-
- public TopicCheckBox(Context context, Topic topic) {
- super(context);
- mTopic = topic;
- setOnClickListener(this);
- }
-
- @Override
- public boolean isChecked() {
- if (mTopic == null)
- return false;
- else
- return mTopic.isChecked;
- }
-
- @Override
- public void onClick(View view) {
- mTopic.isChecked = !mTopic.isChecked;
- filterOnTopics();
- notifyDataSetChanged();
- }
- }
-
- private void filterOnTopics() {
- List<Topic> selected_topics = new ArrayList<Topic>();
- for (int i = 0; i < getCount(); i++) {
- Topic topic = getItem(i);
- if (topic.isChecked)
- selected_topics.add(topic);
- }
- mAdapter.filterOnTopics(selected_topics);
- }
-
- public View getView(int position, View convertView, ViewGroup parent) {
- Topic entry = getItem(position);
-
- CheckBox checkBox = new TopicCheckBox(getContext(), entry);
- checkBox.setText(entry.name);
- checkBox.setTextSize(25);
- checkBox.setTextColor(android.graphics.Color.parseColor("#808080"));
- return checkBox;
- }
- }
-
- @Override
- protected void onPostCreate(Bundle savedInstanceState) {
- super.onPostCreate(savedInstanceState);
- // Sync the toggle state after onRestoreInstanceState has occurred.
- mDrawerToggle.syncState();
- }
-
- @Override
- public void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- mDrawerToggle.onConfigurationChanged(newConfig);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Pass the event to ActionBarDrawerToggle, if it returns
- // true, then it has handled the app icon touch event
- if (mDrawerToggle.onOptionsItemSelected(item)) {
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/CompletionsView.java b/src/ui/android/src/org/grammaticalframework/ui/android/CompletionsView.java
deleted file mode 100644
index c59dbfe86..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/CompletionsView.java
+++ /dev/null
@@ -1,291 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.view.GestureDetector;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.inputmethod.CompletionInfo;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class CompletionsView extends View {
-
- private static final int OUT_OF_BOUNDS = -1;
-
- private TranslatorInputMethodService mService;
- private CompletionInfo[] mSuggestions;
- private int mSelectedIndex;
- private int mTouchX = OUT_OF_BOUNDS;
- private Drawable mSelectionHighlight;
- private boolean mTypedWordValid;
-
- private Rect mBgPadding;
-
- private static final int MAX_SUGGESTIONS = 32;
- private static final int SCROLL_PIXELS = 20;
-
- private int[] mWordWidth = new int[MAX_SUGGESTIONS];
- private int[] mWordX = new int[MAX_SUGGESTIONS];
-
- private static final int X_GAP = 10;
-
- private int mColorNormal;
- private int mColorRecommended;
- private int mColorOther;
- private int mVerticalPadding;
- private Paint mPaint;
- private boolean mScrolled;
- private int mTargetScrollX;
-
- private int mTotalWidth;
-
- private GestureDetector mGestureDetector;
-
- /**
- * Construct a CandidateView for showing suggested words for completion.
- * @param context
- * @param attrs
- */
- public CompletionsView(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,
- android.R.attr.state_window_focused,
- android.R.attr.state_pressed
- });
-
- Resources r = context.getResources();
-
- setBackgroundColor(r.getColor(R.color.candidate_background));
-
- mColorNormal = r.getColor(R.color.candidate_normal);
- mColorRecommended = r.getColor(R.color.candidate_recommended);
- mColorOther = r.getColor(R.color.candidate_other);
- mVerticalPadding = r.getDimensionPixelSize(R.dimen.candidate_vertical_padding);
-
- mPaint = new Paint();
- mPaint.setColor(mColorNormal);
- mPaint.setAntiAlias(true);
- mPaint.setTextSize(r.getDimensionPixelSize(R.dimen.candidate_font_height));
- mPaint.setStrokeWidth(0);
-
- mGestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
- @Override
- public boolean onScroll(MotionEvent e1, MotionEvent e2,
- float distanceX, float distanceY) {
- mScrolled = true;
- int sx = getScrollX();
- sx += distanceX;
- if (sx < 0) {
- sx = 0;
- }
- if (sx + getWidth() > mTotalWidth) {
- sx -= distanceX;
- }
- mTargetScrollX = sx;
- scrollTo(sx, getScrollY());
- invalidate();
- return true;
- }
- });
- setHorizontalFadingEdgeEnabled(true);
- setWillNotDraw(false);
- setHorizontalScrollBarEnabled(false);
- setVerticalScrollBarEnabled(false);
- }
-
- /**
- * A connection back to the service to communicate with the text field
- * @param listener
- */
- public void setService(TranslatorInputMethodService listener) {
- mService = listener;
- }
-
- @Override
- public int computeHorizontalScrollRange() {
- return mTotalWidth;
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- int measuredWidth = resolveSize(50, widthMeasureSpec);
-
- // Get the desired height of the icon menu view (last row of items does
- // not have a divider below)
- Rect padding = new Rect();
- mSelectionHighlight.getPadding(padding);
- final int desiredHeight = ((int)mPaint.getTextSize()) + mVerticalPadding
- + padding.top + padding.bottom;
-
- // Maximum possible width and desired height
- setMeasuredDimension(measuredWidth,
- resolveSize(desiredHeight, heightMeasureSpec));
- }
-
- /**
- * If the canvas is null, then only touch calculations are performed to pick the target
- * candidate.
- */
- @Override
- protected void onDraw(Canvas canvas) {
- if (canvas != null) {
- super.onDraw(canvas);
- }
- mTotalWidth = 0;
- if (mSuggestions == null) return;
-
- if (mBgPadding == null) {
- mBgPadding = new Rect(0, 0, 0, 0);
- if (getBackground() != null) {
- getBackground().getPadding(mBgPadding);
- }
- }
- int x = 0;
- final int count = mSuggestions.length;
- final int height = getHeight();
- final Rect bgPadding = mBgPadding;
- final Paint paint = mPaint;
- final int touchX = mTouchX;
- final int scrollX = getScrollX();
- final boolean scrolled = mScrolled;
- final boolean typedWordValid = mTypedWordValid;
- final int y = (int) (((height - mPaint.getTextSize()) / 2) - mPaint.ascent());
-
- for (int i = 0; i < count; i++) {
- String suggestion = mSuggestions[i].getText().toString();
- float textWidth = paint.measureText(suggestion);
- final int wordWidth = (int) textWidth + X_GAP * 2;
-
- mWordX[i] = x;
- mWordWidth[i] = wordWidth;
- paint.setColor(mColorNormal);
- if (touchX + scrollX >= x && touchX + scrollX < x + wordWidth && !scrolled) {
- if (canvas != null) {
- canvas.translate(x, 0);
- mSelectionHighlight.setBounds(0, bgPadding.top, wordWidth, height);
- mSelectionHighlight.draw(canvas);
- canvas.translate(-x, 0);
- }
- mSelectedIndex = i;
- }
-
- if (canvas != null) {
- if ((i == 1 && !typedWordValid) || (i == 0 && typedWordValid)) {
- paint.setFakeBoldText(true);
- paint.setColor(mColorRecommended);
- } else if (i != 0) {
- paint.setColor(mColorOther);
- }
- canvas.drawText(suggestion, x + X_GAP, y, paint);
- paint.setColor(mColorOther);
- canvas.drawLine(x + wordWidth + 0.5f, bgPadding.top,
- x + wordWidth + 0.5f, height + 1, paint);
- paint.setFakeBoldText(false);
- }
- x += wordWidth;
- }
- mTotalWidth = x;
- if (mTargetScrollX != getScrollX()) {
- scrollToTarget();
- }
- }
-
- private void scrollToTarget() {
- int sx = getScrollX();
- if (mTargetScrollX > sx) {
- sx += SCROLL_PIXELS;
- if (sx >= mTargetScrollX) {
- sx = mTargetScrollX;
- requestLayout();
- }
- } else {
- sx -= SCROLL_PIXELS;
- if (sx <= mTargetScrollX) {
- sx = mTargetScrollX;
- requestLayout();
- }
- }
- scrollTo(sx, getScrollY());
- invalidate();
- }
-
- @SuppressLint("WrongCall")
- public void setSuggestions(CompletionInfo[] suggestions, boolean completions,
- boolean typedWordValid) {
- clear();
- if (suggestions != null) {
- mSuggestions = suggestions;
- }
- mTypedWordValid = typedWordValid;
- scrollTo(0, 0);
- mTargetScrollX = 0;
- // Compute the total width
- onDraw(null);
- invalidate();
- requestLayout();
- }
-
- public void clear() {
- mSuggestions = new CompletionInfo[0];
- mTouchX = OUT_OF_BOUNDS;
- mSelectedIndex = -1;
- invalidate();
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent me) {
-
- if (mGestureDetector.onTouchEvent(me)) {
- return true;
- }
-
- int action = me.getAction();
- int x = (int) me.getX();
- int y = (int) me.getY();
- mTouchX = x;
-
- switch (action) {
- case MotionEvent.ACTION_DOWN:
- mScrolled = false;
- invalidate();
- break;
- case MotionEvent.ACTION_MOVE:
- if (y <= 0) {
- // Fling up!?
- if (mSelectedIndex >= 0) {
- mService.pickSuggestionManually(mSelectedIndex);
- mSelectedIndex = -1;
- }
- }
- invalidate();
- break;
- case MotionEvent.ACTION_UP:
- if (!mScrolled) {
- if (mSelectedIndex >= 0) {
- mService.pickSuggestionManually(mSelectedIndex);
- }
- }
- mSelectedIndex = -1;
- removeHighlight();
- requestLayout();
- break;
- }
- return true;
- }
-
- private void removeHighlight() {
- mTouchX = OUT_OF_BOUNDS;
- invalidate();
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/ConversationView.java b/src/ui/android/src/org/grammaticalframework/ui/android/ConversationView.java
deleted file mode 100644
index b7d118e7c..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/ConversationView.java
+++ /dev/null
@@ -1,242 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import java.io.Serializable;
-import java.util.*;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.inputmethod.EditorInfo;
-import android.view.inputmethod.InputMethodManager;
-import android.view.KeyEvent;
-import android.widget.EditText;
-import android.widget.ScrollView;
-import android.widget.TextView;
-import android.widget.TextView.OnEditorActionListener;
-
-import org.grammaticalframework.pgf.Expr;
-
-public class ConversationView extends ScrollView {
-
- private LayoutInflater mInflater;
-
- private ViewGroup mContent;
-
- private OnClickListener mAlternativesListener;
- private ASR.Listener mSpeechListener;
-
- public ConversationView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- public ConversationView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public ConversationView(Context context) {
- super(context);
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mContent = (ViewGroup) findViewById(R.id.conversation_content);
- mInflater = LayoutInflater.from(getContext());
- }
-
- private class EditorListener implements OnEditorActionListener, OnClickListener {
- @Override
- public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
- if ((actionId & EditorInfo.IME_MASK_ACTION) != 0) {
- CharSequence text = v.getText();
- InputMethodManager inputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
- if (inputMethodManager != null) {
- inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0);
- }
- v.setFocusable(false);
- mLastUtterance = v;
- if (mSpeechListener != null)
- mSpeechListener.onSpeechInput(text.toString().trim());
- return true;
- }
- return false;
- }
-
- @Override
- public void onClick(View v) {
- v.setFocusableInTouchMode(true);
- v.requestFocus();
- InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
- imm.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT);
- }
- };
-
- private EditorListener mEditorListener = new EditorListener();
- private TextView mLastUtterance = null;
-
- public void addFirstPersonUtterance(CharSequence text, boolean focused) {
- EditText edittext = (EditText)
- mInflater.inflate(R.layout.first_person_utterance, mContent, false);
- edittext.setText(text);
- edittext.setOnEditorActionListener(mEditorListener);
- edittext.setOnClickListener(mEditorListener);
- edittext.setHorizontallyScrolling(false);
- edittext.setMaxLines(Integer.MAX_VALUE);
- Bundle extras = edittext.getInputExtras(true);
- extras.putBoolean("show_language_toggle", false);
- mContent.addView(edittext);
-
- if (focused) {
- edittext.requestFocus();
- InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
- imm.showSoftInput(edittext, InputMethodManager.SHOW_IMPLICIT);
- } else {
- edittext.setFocusable(false);
- }
-
- post(new Runnable() {
- public void run() {
- fullScroll(FOCUS_DOWN);
- }
- });
-
- mLastUtterance = edittext;
- }
-
- @SuppressWarnings("deprecation")
- public CharSequence addSecondPersonUtterance(String authority, CharSequence source, CharSequence target, List<Expr> alternatives) {
- TextView view;
- if (mLastUtterance != null && mLastUtterance.getTag() != null)
- view = (TextView) mLastUtterance.getTag();
- else {
- view = (TextView)
- mInflater.inflate(R.layout.second_person_utterance, mContent, false);
- if (mAlternativesListener != null)
- view.setOnClickListener(mAlternativesListener);
- mContent.addView(view);
- post(new Runnable() {
- public void run() {
- fullScroll(FOCUS_DOWN);
- }
- });
-
- mLastUtterance.setTag(view);
- }
-
- view.setTag(R.string.authority_key, authority);
- view.setTag(R.string.source_key, source);
- view.setTag(R.string.target_key, target);
- view.setTag(R.string.alternatives_key, alternatives);
-
- // parse by words, marked by %, darkest red color
- if (target.charAt(0) == '%') {
- view.setBackgroundDrawable(getResources().getDrawable(R.drawable.second_person_worst_utterance_bg));
- target = target.subSequence(1, target.length()).toString().trim();
- }
-
- // parse by chunks, marked by *, red color
- else if (target.charAt(0) == '*') {
- view.setBackgroundDrawable(getResources().getDrawable(R.drawable.second_person_chunk_utterance_bg));
- target = target.subSequence(1, target.length()).toString().trim();
- }
-
- // parse error: darkest red color
- else if (target.toString().contains("parse error:")) {
- view.setBackgroundDrawable(getResources().getDrawable(R.drawable.second_person_worst_utterance_bg));
- }
-
- // unknown linearizations in output: darkest red color. But replace [ ] by spaces and remove _ for better speech synthesis
- else if (target.toString().contains("[")) {
- view.setBackgroundDrawable(getResources().getDrawable(R.drawable.second_person_worst_utterance_bg));
- }
-
- // parse by domain grammar, marked by +, green color
- else if (target.charAt(0) == '+') {
- view.setBackgroundDrawable(getResources().getDrawable(R.drawable.second_person_best_utterance_bg));
- target = target.subSequence(1, target.length()).toString().trim();
- }
-
- else {
- view.setBackgroundDrawable(getResources().getDrawable(R.drawable.second_person_utterance_bg));
- }
-
- view.setText(target);
- return target;
- }
-
- public void updateLastUtterance(CharSequence text) {
- if (mLastUtterance != null)
- mLastUtterance.setText(text);
- }
-
- public void setOnAlternativesListener(final OnAlternativesListener listener) {
- if (listener == null)
- mAlternativesListener = null;
- else
- mAlternativesListener = new OnClickListener() {
- @Override
- public void onClick(View v) {
- String authority = v.getTag(R.string.authority_key).toString();
- String source = v.getTag(R.string.source_key).toString();
- List<Expr> alternatives = (List<Expr>) v.getTag(R.string.alternatives_key);
- listener.onAlternativesSelected(authority, source, alternatives);
- }
- };
- }
-
- public void setSpeechInputListener(ASR.Listener listener) {
- mSpeechListener = listener;
- }
-
- public interface OnAlternativesListener {
- public void onAlternativesSelected(CharSequence authority, CharSequence word, List<Expr> althernatives);
- }
-
- public void saveConversation(Bundle state) {
- ArrayList<String> authorities = new ArrayList<String>();
- ArrayList<String> firstPersonUtterances = new ArrayList<String>();
- ArrayList<String> secondPersonUtterances = new ArrayList<String>();
- ArrayList<Object> translationAlternatives = new ArrayList<Object>();
-
- int childCount = mContent.getChildCount();
- for (int i = 0; i < childCount; i++) {
- View child = mContent.getChildAt(i);
- if (child.getClass() == TextView.class) {
- authorities.add(child.getTag(R.string.authority_key).toString());
- firstPersonUtterances.add(child.getTag(R.string.source_key).toString());
- secondPersonUtterances.add(child.getTag(R.string.target_key).toString());
- translationAlternatives.add(child.getTag(R.string.alternatives_key));
- }
- }
-
- state.putStringArrayList("authorities", authorities);
- state.putStringArrayList("first_person_uterances", firstPersonUtterances);
- state.putStringArrayList("second_person_uterances", secondPersonUtterances);
- state.putSerializable("translation_alternatives",(Serializable) translationAlternatives);
- }
-
- public void restoreConversation(Bundle state) {
- ArrayList<String> authorities = state.getStringArrayList("authorities");
- ArrayList<String> firstPersonUtterances = state.getStringArrayList("first_person_uterances");
- ArrayList<String> secondPersonUtterances = state.getStringArrayList("second_person_uterances");
- ArrayList<List<Expr>> translationAlternatives= (ArrayList<List<Expr>>) state.getSerializable("translation_alternatives");
-
- int i = 0;
- while (i < authorities.size() &&
- i < firstPersonUtterances.size() &&
- i < Math.min(secondPersonUtterances.size(), translationAlternatives.size())) {
- String text = firstPersonUtterances.get(i);
- addFirstPersonUtterance(text, false);
-
- String authority = authorities.get(i);
- String translation = secondPersonUtterances.get(i);
- List<Expr> alternatives = translationAlternatives.get(i);
- addSecondPersonUtterance(authority, text, translation, alternatives);
-
- i++;
- }
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/GFTranslator.java b/src/ui/android/src/org/grammaticalframework/ui/android/GFTranslator.java
deleted file mode 100644
index 8900b2415..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/GFTranslator.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import android.app.Application;
-
-public class GFTranslator extends Application {
- private Translator mTranslator;
- private static GFTranslator instance;
-
- @Override
- public void onCreate() {
- mTranslator = new Translator(this);
- instance = this;
- }
-
- public Translator getTranslator() {
- return mTranslator;
- }
-
- public static GFTranslator get() {
- return instance;
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/HelpActivity.java b/src/ui/android/src/org/grammaticalframework/ui/android/HelpActivity.java
deleted file mode 100644
index c6a822484..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/HelpActivity.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.webkit.WebView;
-
-public class HelpActivity extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_help);
- WebView wv = (WebView) findViewById(R.id.help_content);
- wv.loadUrl("file:///android_asset/help_content.html");
- }
-} \ No newline at end of file
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/Language.java b/src/ui/android/src/org/grammaticalframework/ui/android/Language.java
deleted file mode 100644
index 000206045..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/Language.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import java.io.Serializable;
-
-public class Language implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private final String mLangCode;
- private final String mLangName;
- private final String mConcrete;
- private final int mKeyboardPage1Resource;
- private final int mKeyboardPage2Resource;
-
- public Language(String langCode, String langName, String concrete,
- int keyboardResource) {
- mLangCode = langCode;
- mLangName = langName;
- mConcrete = concrete;
- mKeyboardPage1Resource = keyboardResource;
- mKeyboardPage2Resource = keyboardResource;
- }
-
- public Language(String langCode, String langName, String concrete,
- int keyboardPage1Resource, int keyboardPage2Resource) {
- mLangCode = langCode;
- mLangName = langName;
- mConcrete = concrete;
- mKeyboardPage1Resource = keyboardPage1Resource;
- mKeyboardPage2Resource = keyboardPage2Resource;
- }
-
- public String getLangCode() {
- return mLangCode;
- }
-
- public String getLangName() {
- return mLangName;
- }
-
- public int getKeyboardPage1Resource() {
- return mKeyboardPage1Resource;
- }
-
- public int getKeyboardPage2Resource() {
- return mKeyboardPage2Resource;
- }
-
- String getConcrete() {
- return mConcrete;
- }
-
- @Override
- public String toString() {
- return getLangName();
- }
-
- @Override
- public boolean equals(Object o) {
- Language other = (Language) o;
- return mLangCode.equals(other.mLangCode);
- }
-} \ No newline at end of file
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/LanguageSelector.java b/src/ui/android/src/org/grammaticalframework/ui/android/LanguageSelector.java
deleted file mode 100644
index de628b2b5..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/LanguageSelector.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.Spinner;
-
-import java.util.List;
-
-public class LanguageSelector extends Spinner {
-
- public LanguageSelector(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- public LanguageSelector(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public LanguageSelector(Context context) {
- super(context);
- }
-
- public void setLanguages(List<Language> languages) {
- setAdapter(new LanguagesAdapter(getContext(), languages));
- }
-
- public void setSelectedLanguage(Language selected) {
- setSelection(((LanguagesAdapter) getAdapter()).getPosition(selected));
- }
-
- public Language getSelectedLanguage() {
- return (Language) getSelectedItem();
- }
-
- public void setOnLanguageSelectedListener(final OnLanguageSelectedListener listener) {
- setOnItemSelectedListener(new OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
- if (listener != null) {
- listener.onLanguageSelected((Language) parent.getItemAtPosition(position));
- }
- }
- @Override
- public void onNothingSelected(AdapterView<?> parent) {
- }
- });
- }
-
- public interface OnLanguageSelectedListener {
- void onLanguageSelected(Language language);
- }
-
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/LanguagesAdapter.java b/src/ui/android/src/org/grammaticalframework/ui/android/LanguagesAdapter.java
deleted file mode 100644
index e39ed7bd9..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/LanguagesAdapter.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import android.content.Context;
-import android.widget.ArrayAdapter;
-import android.widget.SpinnerAdapter;
-
-
-import java.util.List;
-
-public class LanguagesAdapter extends ArrayAdapter<Language> implements SpinnerAdapter {
-
- public LanguagesAdapter(Context context, List<Language> objects) {
- super(context, R.layout.languages_item, objects);
- }
-
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/LexiconSuggestionProvider.java b/src/ui/android/src/org/grammaticalframework/ui/android/LexiconSuggestionProvider.java
deleted file mode 100644
index 7b9813b7d..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/LexiconSuggestionProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import android.content.ContentProvider;
-import android.content.ContentValues;
-import android.provider.BaseColumns;
-import android.database.Cursor;
-import android.database.MatrixCursor;
-import android.app.SearchManager;
-import android.net.Uri;
-import android.util.Log;
-import android.view.inputmethod.CompletionInfo;
-
-public class LexiconSuggestionProvider extends ContentProvider {
- private Translator mTranslator;
-
- public boolean onCreate() {
- return true;
- }
-
- public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
- mTranslator = ((GFTranslator) getContext().getApplicationContext()).getTranslator();
- String[] columns = new String[] {
- BaseColumns._ID,
- SearchManager.SUGGEST_COLUMN_TEXT_1,
- SearchManager.SUGGEST_COLUMN_QUERY
- };
-
- String query = uri.getLastPathSegment();
- MatrixCursor cursor = new MatrixCursor(columns, 100);
- for (CompletionInfo info : mTranslator.lookupWordPrefix(query)) {
- cursor.addRow(new String[] {Long.toString(info.getId()),info.getText().toString(),info.getText().toString()});
- }
-
- return cursor;
- }
-
- public Uri insert (Uri uri, ContentValues values) {
- throw new UnsupportedOperationException();
- }
-
- public int update (Uri uri, ContentValues values, String selection, String[] selectionArgs) {
- throw new UnsupportedOperationException();
- }
-
- public int delete (Uri uri, String selection, String[] selectionArgs) {
- throw new UnsupportedOperationException();
- }
-
- public String getType (Uri uri) {
- return null;
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/LocaleUtils.java b/src/ui/android/src/org/grammaticalframework/ui/android/LocaleUtils.java
deleted file mode 100644
index 9fb048908..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/LocaleUtils.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import android.text.TextUtils;
-
-import java.util.Locale;
-
-/**
- * Collections of utils to handle locales.
- */
-public class LocaleUtils {
-
- /**
- * Parses a locale string formatted by {@link Locale#toString()}.
- *
- * @return the parsed {@code Locale} or {@code defaultLocale} if the input was null or empty.
- */
- public static Locale parseJavaLocale(String localeString, Locale defaultLocale) {
- if (TextUtils.isEmpty(localeString)) {
- return defaultLocale;
- }
- final char separator = '_';
- int pos1 = localeString.indexOf(separator);
- if (pos1 == -1) {
- return new Locale(localeString);
- }
- String language = localeString.substring(0, pos1);
-
- int start2 = pos1 + 1;
- int pos2 = localeString.indexOf(separator, start2);
- if (pos2 == -1) {
- return new Locale(language, localeString.substring(start2));
- }
- String country = localeString.substring(start2, pos2);
-
- int start3 = pos2 + 1;
- int pos3 = localeString.indexOf(separator, start3);
- String variant = (pos3 == -1)
- ? localeString.substring(start3)
- : localeString.substring(start3, pos3);
- return new Locale(language, country, variant);
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/MainActivity.java b/src/ui/android/src/org/grammaticalframework/ui/android/MainActivity.java
deleted file mode 100644
index 369e542e9..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/MainActivity.java
+++ /dev/null
@@ -1,377 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import java.io.*;
-import java.util.*;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.speech.SpeechRecognizer;
-import android.net.Uri;
-import android.util.Log;
-import android.util.Pair;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnTouchListener;
-import android.widget.ImageView;
-
-import org.grammaticalframework.ui.android.ASR.State;
-import org.grammaticalframework.ui.android.LanguageSelector.OnLanguageSelectedListener;
-import org.grammaticalframework.ui.android.ConversationView.OnAlternativesListener;
-import org.grammaticalframework.pgf.*;
-
-public class MainActivity extends Activity {
-
- private static final boolean DBG = true;
- private static final String TAG = "MainActivity";
-
- private ImageView mStartStopButton;
-
- private ConversationView mConversationView;
-
- private LanguageSelector mSourceLanguageView;
-
- private LanguageSelector mTargetLanguageView;
-
- private ImageView mSwitchLanguagesButton;
-
- private ASR mAsr;
-
- private TTS mTts;
-
- private Translator mTranslator;
-
- private boolean input_mode;
-
- private SpeechInputListener mSpeechListener;
-
- private View mProgressBarView = null;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- mStartStopButton = (ImageView) findViewById(R.id.start_stop);
- mConversationView = (ConversationView) findViewById(R.id.conversation);
- mSourceLanguageView = (LanguageSelector) findViewById(R.id.source_language);
- mTargetLanguageView = (LanguageSelector) findViewById(R.id.target_language);
- mSwitchLanguagesButton = (ImageView) findViewById(R.id.switch_languages);
- mProgressBarView = findViewById(R.id.progressBarView);
-
- mStartStopButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mAsr.isRunning()) {
- stopRecognition();
- } else {
- startRecognition();
- }
- }
- });
-
- SharedPreferences pref = getPreferences(MODE_PRIVATE);
- input_mode = pref.getBoolean("input_mode", true);
- if (!SpeechRecognizer.isRecognitionAvailable(this)) {
- input_mode = false;
- }
- mStartStopButton.setImageResource(input_mode ? R.drawable.ic_mic : R.drawable.ic_keyboard);
-
- mSpeechListener = new SpeechInputListener();
-
- mConversationView.setOnAlternativesListener(new OnAlternativesListener() {
- @Override
- public void onAlternativesSelected(CharSequence authority, CharSequence input, List<Expr> alternatives) {
- Uri.Builder builder = new Uri.Builder();
- builder.scheme("gf-translator");
- builder.authority(authority.toString());
- builder.appendQueryParameter("source", input.toString());
- for (Expr e : alternatives) {
- builder.appendQueryParameter("alternative", e.toString());
- }
-
- Intent myIntent = new Intent(Intent.ACTION_VIEW, builder.build());
- MainActivity.this.startActivity(myIntent);
- }
- });
- mConversationView.setSpeechInputListener(mSpeechListener);
-
- mAsr = new ASR(this);
- mAsr.setListener(mSpeechListener);
-
- mTts = new TTS(this);
-
- mTranslator = ((GFTranslator) getApplicationContext()).getTranslator();
-
- mSourceLanguageView.setLanguages(mTranslator.getAvailableLanguages());
- mSourceLanguageView.setOnLanguageSelectedListener(new OnLanguageSelectedListener() {
- @Override
- public void onLanguageSelected(Language language) {
- onSourceLanguageSelected(language);
- }
- });
- mTargetLanguageView.setLanguages(mTranslator.getAvailableLanguages());
- mTargetLanguageView.setOnLanguageSelectedListener(new OnLanguageSelectedListener() {
- @Override
- public void onLanguageSelected(Language language) {
- onTargetLanguageSelected(language);
- }
- });
-
- mSwitchLanguagesButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- onSwitchLanguages();
- }
- });
-
- if (savedInstanceState != null) {
- mConversationView.restoreConversation(savedInstanceState);
- }
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- mSourceLanguageView.setSelectedLanguage(mTranslator.getSourceLanguage());
- mTargetLanguageView.setSelectedLanguage(mTranslator.getTargetLanguage());
- }
-
- private void showProgressBar() {
- mProgressBarView.setVisibility(View.VISIBLE);
- }
-
- private void hideProgressBar() {
- mProgressBarView.setVisibility(View.GONE);
- }
-
- @Override
- protected void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- mConversationView.saveConversation(outState);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.main, menu);
-
- menu.getItem(0).setTitle(input_mode ? R.string.keyboard_input : R.string.mic_input);
-
- if (!SpeechRecognizer.isRecognitionAvailable(this)) {
- menu.getItem(0).setEnabled(false);
- }
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle item selection
- switch (item.getItemId()) {
- case R.id.input_mode:
- if (input_mode) {
- item.setTitle(R.string.mic_input);
- mStartStopButton.setImageResource(R.drawable.ic_keyboard);
- input_mode = false;
- } else {
- item.setTitle(R.string.keyboard_input);
- mStartStopButton.setImageResource(R.drawable.ic_mic);
- input_mode = true;
- }
-
- SharedPreferences.Editor editor = getPreferences(MODE_PRIVATE).edit();
- editor.putBoolean("input_mode", input_mode);
- editor.commit();
-
- return true;
- case R.id.phrasebook: {
- Intent myIntent = new Intent(MainActivity.this, se.chalmers.phrasebook.gui.activities.NavigationActivity.class);
- MainActivity.this.startActivity(myIntent);
- return true;
- }
- case R.id.topics: {
- Intent myIntent = new Intent(MainActivity.this, AlternativesActivity.class);
- MainActivity.this.startActivity(myIntent);
- return true;
- }
- case R.id.help: {
- Intent myIntent = new Intent(MainActivity.this, HelpActivity.class);
- MainActivity.this.startActivity(myIntent);
- return true;
- }
- default:
- return super.onOptionsItemSelected(item);
- }
- }
-
- @Override
- protected void onDestroy() {
- if (mAsr != null) {
- mAsr.destroy();
- mAsr = null;
- }
- if (mTts != null) {
- mTts.destroy();
- mTts = null;
- }
- super.onDestroy();
- }
-
- void onSourceLanguageSelected(Language language) {
- mTranslator.setSourceLanguage(language);
- if (TranslatorInputMethodService.getInstance() != null) {
- TranslatorInputMethodService.getInstance().handleChangeSourceLanguage(language);
- }
- }
-
- void onTargetLanguageSelected(Language language) {
- mTranslator.setTargetLanguage(language);
- if (TranslatorInputMethodService.getInstance() != null) {
- TranslatorInputMethodService.getInstance().handleChangeTargetLanguage(language);
- }
- }
-
- public String getSourceLanguageCode() {
- return mTranslator.getSourceLanguage().getLangCode();
- }
-
- public String getTargetLanguageCode() {
- return mTranslator.getTargetLanguage().getLangCode();
- }
-
- void onSwitchLanguages() {
- mTranslator.switchLanguages();
- mSourceLanguageView.setSelectedLanguage(mTranslator.getSourceLanguage());
- mTargetLanguageView.setSelectedLanguage(mTranslator.getTargetLanguage());
-
- if (TranslatorInputMethodService.getInstance() != null) {
- TranslatorInputMethodService.getInstance().handleSwitchLanguages();
- }
- }
-
- private void startRecognition() {
- if (input_mode) {
- mConversationView.addFirstPersonUtterance("...", false);
- mAsr.setLanguage(getSourceLanguageCode());
- mAsr.startRecognition();
- } else {
- mConversationView.addFirstPersonUtterance("", true);
- }
- }
-
- private void stopRecognition() {
- mAsr.stopRecognition();
- }
-
- private void handlePartialSpeechInput(String input) {
- mConversationView.updateLastUtterance(input);
- }
-
- private void handleSpeechInput(final String input) {
- final List<MorphoAnalysis> list = mTranslator.lookupMorpho(input);
-
- mConversationView.updateLastUtterance(input);
- new AsyncTask<Void,Void,Pair<String,List<ExprProb>>>() {
- @Override
- protected void onPreExecute() {
- showProgressBar();
- }
-
- @Override
- protected Pair<String,List<ExprProb>> doInBackground(Void... params) {
- return mTranslator.translate(input);
- }
-
- @Override
- protected void onPostExecute(Pair<String,List<ExprProb>> res) {
- String text = res.first;
- List<ExprProb> transl = res.second;
-
- List<Expr> alts = null;
- String authority = null;
-
- // filter out duplicates
- int i = 0;
- if (list.size() > 0) {
- alts = new ArrayList(list.size());
- authority = Translator.WORDS;
-
- while (i < list.size()) {
- MorphoAnalysis an = list.get(i);
- boolean found = false;
- for (int j = 0; j < i; j++) {
- if (list.get(j).getLemma().equals(an.getLemma())) {
- found = true;
- break;
- }
- }
-
- if (!found) {
- alts.add(Expr.readExpr(an.getLemma()));
- }
-
- i++;
- }
- } else {
- alts = new ArrayList(transl.size());
- authority = Translator.SENTENCES;
-
- Set<String> strings = new HashSet<String>();
- while (i < transl.size()) {
- String s = mTranslator.linearize(transl.get(i).getExpr());
- if (s.length() > 0 &&
- (s.charAt(0) == '%' || s.charAt(0) == '*' || s.charAt(0) == '+')) {
- s = s.substring(2);
- }
-
- if (!strings.contains(s)) {
- strings.add(s);
- alts.add(transl.get(i).getExpr());
- }
-
- i++;
- }
- }
-
- if (DBG) Log.d(TAG, "Speaking: " + res.first);
- CharSequence text2 =
- mConversationView.addSecondPersonUtterance(authority, input, text, alts);
- text2 = text2.toString().replace('[',' ').replace(']',' ').replaceAll("_","").trim();
- mTts.speak(getTargetLanguageCode(), text2.toString());
-
- hideProgressBar();
- }
- }.execute();
- }
-
- private class SpeechInputListener implements ASR.Listener {
-
- @Override
- public void onPartialInput(String input) {
- handlePartialSpeechInput(input);
- }
-
- @Override
- public void onSpeechInput(String input) {
- handleSpeechInput(input);
- }
-
- @Override
- public void onStateChanged(State newState) {
- if (newState == ASR.State.IDLE) {
- //clear the overlay
- mStartStopButton.getDrawable().clearColorFilter();
- } else {
- mStartStopButton.getDrawable().setColorFilter(0xffff0000,android.graphics.PorterDuff.Mode.SRC_ATOP);
- }
- mStartStopButton.invalidate();
- }
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/ParseTreeView.java b/src/ui/android/src/org/grammaticalframework/ui/android/ParseTreeView.java
deleted file mode 100644
index b2ff74183..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/ParseTreeView.java
+++ /dev/null
@@ -1,270 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.PointF;
-import android.graphics.Rect;
-import android.util.AttributeSet;
-import android.util.SparseArray;
-import android.view.MotionEvent;
-import android.view.View;
-
-import org.grammaticalframework.pgf.Bracket;
-
-
-public class ParseTreeView extends View {
- private static final float SISTER_SKIP = 25;
- private static final float PARENT_SKIP = 0.5f;
- private static final float ABOVE_LINE_SKIP = 0.1f;
- private static final float BELOW_LINE_SKIP = 0.1f;
-
- private Paint paint;
- private Object[] brackets;
-
- private float lastMotionX;
- private float scrollRange;
-
- public ParseTreeView(Context context) {
- this(context, null);
- }
-
- public ParseTreeView(Context context, AttributeSet attrs) {
- super(context, attrs, R.attr.parseTreeViewStyle);
-
- paint = new Paint();
- paint.setTextSize(60);
- brackets = null;
- scrollRange = 0;
- }
-
- public Object[] getBrackets() {
- return brackets;
- }
-
- public void setBrackets(Object[] brackets) {
- this.brackets = brackets;
- awakenScrollBars();
- }
-
- static class MeasureResult {
- float width = 0.0f;
- float height = 0.0f;
- float nodeTab = 0.0f;
- float nodeCenter = 0.0f;
- float childTab = 0.0f;
- float localWidth = 0.0f;
- float localHeight = 0.0f;
- }
-
- private MeasureResult mr = new MeasureResult();
- private SparseArray<PointF> coords = new SparseArray<PointF>();
- private PointF zeroPoint = new PointF();
-
- private void measureTree(Object o) {
- if (o instanceof Bracket) {
- Bracket bracket = (Bracket) o;
-
- Rect bounds = new Rect();
- paint.getTextBounds(bracket.cat,0,bracket.cat.length(),bounds);
- float localWidth = bounds.width();
- float localHeight = bounds.height();
- float layerHeight = localHeight * (1.0f + BELOW_LINE_SKIP + ABOVE_LINE_SKIP + PARENT_SKIP);
-
- PointF local = coords.get(bracket.fid);
- if (local == null) {
- coords.put(bracket.fid, zeroPoint);
- } else {
- localWidth = 0;
- }
-
- float subWidth = 0.0f;
- float subHeight = 0.0f;
- float nodeCenter = 0.0f;
- for (int i = 0; i < bracket.children.length; i++) {
- measureTree(bracket.children[i]);
-
- if (i == 0) {
- nodeCenter += (subWidth + mr.nodeCenter) / 2.0;
- }
- if (i == bracket.children.length - 1) {
- nodeCenter += (subWidth + mr.nodeCenter) / 2.0;
- }
-
- subWidth += mr.width;
- if (i < bracket.children.length - 1) {
- subWidth += SISTER_SKIP;
- }
-
- if (subHeight < mr.height)
- subHeight = mr.height;
- }
- float localLeft = localWidth / 2.0f;
- float subLeft = nodeCenter;
- float totalLeft = Math.max(localLeft, subLeft);
- float localRight = localWidth / 2.0f;
- float subRight = subWidth - nodeCenter;
- float totalRight = Math.max(localRight, subRight);
- mr.width = totalLeft + totalRight;
- mr.height = layerHeight + subHeight;
- mr.childTab = totalLeft - subLeft;
- mr.nodeTab = totalLeft - localLeft;
- mr.nodeCenter = nodeCenter + mr.childTab;
- mr.localWidth = localWidth;
- mr.localHeight = localHeight;
- } else {
- String word = o.toString();
-
- Rect bounds = new Rect();
- paint.getTextBounds(word,0,word.length(),bounds);
- mr.width = bounds.width();
- mr.height = bounds.height();
- mr.nodeTab = 0.0f;
- mr.nodeCenter = bounds.width() / 2.0f;
- mr.childTab = 0.0f;
- mr.localWidth = bounds.width();
- mr.localHeight = bounds.height();
- }
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- if (brackets == null) {
- setMeasuredDimension(0, 0);
- return;
- }
-
- coords.clear();
-
- float width = 0.0f;
- float height = 0.0f;
- for (int i = 0; i < brackets.length; i++) {
- measureTree(brackets[i]);
-
- width += mr.width;
- if (i < brackets.length - 1) {
- width += SISTER_SKIP;
- }
-
- if (height < mr.height)
- height = mr.height;
- }
-
- height += paint.getFontMetrics().descent;
-
- int w = getPaddingLeft() + (int) width + getPaddingRight();
- int h = getPaddingTop() + (int) height + getPaddingBottom();
-
- scrollRange = w;
-
- int widthReq = MeasureSpec.getSize(widthMeasureSpec);
- if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY ||
- (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.AT_MOST && w > widthReq)) {
- w = widthReq;
- }
- int heightReq = MeasureSpec.getSize(heightMeasureSpec);
- if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY ||
- (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST && h > heightReq)) {
- h = heightReq;
- }
-
- setMeasuredDimension(w, h);
- }
-
- private void drawTree(Canvas canvas,
- float x, float y, float bottom, PointF parentPoint,
- Object o) {
- if (o instanceof Bracket) {
- Bracket bracket = (Bracket) o;
-
- PointF lineStart = coords.get(bracket.fid);
- if (lineStart == null) {
- lineStart = new PointF(x + mr.nodeCenter, y + mr.localHeight * (1.0f + BELOW_LINE_SKIP));
- coords.put(bracket.fid, lineStart);
-
- if (parentPoint != null) {
- float lineEndX = x + mr.nodeCenter;
- float lineEndY = y;
- canvas.drawLine(parentPoint.x, parentPoint.y, lineEndX, lineEndY, paint);
- }
-
- canvas.drawText(bracket.cat, x+mr.nodeTab, y+mr.localHeight, paint);
- }
-
- float layerMultiplier = (1.0f + BELOW_LINE_SKIP + ABOVE_LINE_SKIP + PARENT_SKIP);
- float layerHeight = mr.localHeight * layerMultiplier;
- float childStartX = x + mr.childTab;
- float childStartY = y + layerHeight;
- for (int i = 0; i < bracket.children.length; i++) {
- Object child = bracket.children[i];
- SparseArray<PointF> copy = coords.clone();
- measureTree(child);
- coords = copy;
- float w = mr.width;
- drawTree(canvas, childStartX, childStartY, bottom, lineStart, child);
- childStartX += w + SISTER_SKIP;
- }
- } else {
- float lineEndX = x + mr.nodeCenter;
- float lineEndY = bottom - mr.height;
- canvas.drawLine(parentPoint.x, parentPoint.y, lineEndX, lineEndY, paint);
- canvas.drawText(o.toString(), x, bottom, paint);
- }
- }
-
- @Override
- protected void onDraw (Canvas canvas) {
- super.onDraw(canvas);
-
- if (brackets == null) {
- return;
- }
-
- coords.clear();
-
- float startX = getPaddingLeft();
- for (int i = 0; i < brackets.length; i++) {
- Object child = brackets[i];
-
- SparseArray<PointF> copy = coords.clone();
- measureTree(child);
- coords = copy;
- float w = mr.width;
- drawTree(canvas, startX, getPaddingTop(), getPaddingTop()+mr.height, null, child);
- startX += w + SISTER_SKIP;
- }
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- switch (ev.getAction()) {
- case MotionEvent.ACTION_DOWN:
- // Remember where the motion event started
- lastMotionX = ev.getX();
- break;
- case MotionEvent.ACTION_MOVE:
- // Scroll to follow the motion event
- float x = ev.getX();
- final int deltaX = (int) (lastMotionX - x);
- lastMotionX = x;
- int offset = computeHorizontalScrollOffset() + deltaX;
- int range = computeHorizontalScrollRange() - computeHorizontalScrollExtent();
- if (range > 0) {
- if (offset < 0)
- offset = 0;
- if (offset > range)
- offset = range;
- scrollTo(offset, 0);
- }
- break;
- case MotionEvent.ACTION_UP:
- break;
- }
- return true;
- }
-
- @Override
- protected int computeHorizontalScrollRange() {
- return (int) scrollRange;
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/RotationGestureDetector.java b/src/ui/android/src/org/grammaticalframework/ui/android/RotationGestureDetector.java
deleted file mode 100644
index d077db1bc..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/RotationGestureDetector.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import android.view.MotionEvent;
-
-public class RotationGestureDetector {
-
- private static final int INVALID_POINTER_ID = -1;
- private float fX, fY, sX, sY, focalX, focalY;
- private int ptrID1, ptrID2;
- private float mAngle;
- private boolean firstTouch;
-
- private OnRotationGestureListener mListener;
-
- public RotationGestureDetector(OnRotationGestureListener listener) {
- mListener = listener;
- ptrID1 = INVALID_POINTER_ID;
- ptrID2 = INVALID_POINTER_ID;
- }
-
- public float getAngle() {
- return mAngle;
- }
-
- public boolean onTouchEvent(MotionEvent event){
- switch (event.getActionMasked()) {
- case MotionEvent.ACTION_DOWN:
- sX = event.getX();
- sY = event.getY();
- ptrID1 = event.getPointerId(0);
- mAngle = 0;
- firstTouch = true;
- break;
- case MotionEvent.ACTION_POINTER_DOWN:
- fX = event.getX();
- fY = event.getY();
- focalX = getMidpoint(fX, sX);
- focalY = getMidpoint(fY, sY);
- ptrID2 = event.getPointerId(event.getActionIndex());
- mAngle = 0;
- firstTouch = true;
- break;
- case MotionEvent.ACTION_MOVE:
- if(ptrID1 != INVALID_POINTER_ID && ptrID2 != INVALID_POINTER_ID) {
- float nfX, nfY, nsX, nsY;
- nsX = event.getX(event.findPointerIndex(ptrID1));
- nsY = event.getY(event.findPointerIndex(ptrID1));
- nfX = event.getX(event.findPointerIndex(ptrID2));
- nfY = event.getY(event.findPointerIndex(ptrID2));
- if (firstTouch) {
- mAngle = 0;
- firstTouch = false;
- } else {
- mAngle = angleBetweenLines(fX, fY, sX, sY, nfX, nfY, nsX, nsY);
- }
-
- if (mListener != null) {
- mListener.OnRotation(this);
- }
- fX = nfX;
- fY = nfY;
- sX = nsX;
- sY = nsY;
- }
- break;
- case MotionEvent.ACTION_UP:
- ptrID1 = INVALID_POINTER_ID;
- break;
- case MotionEvent.ACTION_POINTER_UP:
- ptrID2 = INVALID_POINTER_ID;
- break;
- }
- return true;
- }
-
- private float getMidpoint(float a, float b) {
- return (a + b) / 2;
- }
-
- private float findAngleDelta(float angle1, float angle2)
- {
- angle2 = angle2 % 360.0f;
- angle1 = angle1 % 360.0f;
-
- float dist = angle1 - angle2;
- if (dist < -180.0f)
- {
- dist += 360.0f;
- }
- else if (dist > 180.0f)
- {
- dist -= 360.0f;
- }
-
- return dist;
- }
-
- private float angleBetweenLines(float fx1, float fy1, float fx2, float fy2, float sx1, float sy1, float sx2, float sy2)
- {
- float angle1 = (float) Math.atan2((fy1 - fy2), (fx1 - fx2));
- float angle2 = (float) Math.atan2((sy1 - sy2), (sx1 - sx2));
-
- return findAngleDelta((float)Math.toDegrees(angle1),(float)Math.toDegrees(angle2));
- }
-
- public static interface OnRotationGestureListener {
- public boolean OnRotation(RotationGestureDetector detector);
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraph.java b/src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraph.java
deleted file mode 100644
index 0033404c9..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraph.java
+++ /dev/null
@@ -1,235 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import java.util.*;
-
-public class SemanticGraph {
- private Map<String,Node> nodes;
- private List<Edge> edges;
-
- private float layoutMinX;
- private float layoutMaxX;
- private float layoutMinY;
- private float layoutMaxY;
-
- public SemanticGraph() {
- nodes = new HashMap<String,Node>();
- edges = new ArrayList<Edge>();
-
- layoutMinX = 0;
- layoutMaxX = 0;
- layoutMinY = 0;
- layoutMaxY = 0;
- }
-
- public Node addNode(String lemma, List senses) {
- Node n = nodes.get(lemma);
- if (n == null) {
- n = new Node(lemma, senses);
- }
- nodes.put(lemma,n);
- return n;
- }
-
- public Node getNode(String lemma) {
- return nodes.get(lemma);
- }
-
- public Collection<Node> getNodes() {
- return Collections.unmodifiableCollection(nodes.values());
- }
-
- public Edge addEdge(Node node1, Node node2) {
- Edge edge = new Edge(node1, node2);
- edges.add(edge);
- return edge;
- }
-
- private static final int LAYOUT_ITERATIONS = 500;
- private static final float LAYOUT_K = 2;
- private static final float LAYOUT_C = 0.01f;
- private static final float LAYOUT_MAX_VERTEX_MOVEMENT = 0.5f;
- private static final float LAYOUT_MAX_REPULSIVE_FORCE_DISTANCE = 6;
-
- public void layout() {
- layoutPrepare();
- for (int i = 0; i < LAYOUT_ITERATIONS; i++) {
- layoutIteration();
- }
- layoutCalcBounds();
- }
-
- public float getLayoutMinX() {
- return layoutMinX;
- }
-
- public float getLayoutMaxX() {
- return layoutMaxX;
- }
-
- public float getLayoutMinY() {
- return layoutMinY;
- }
-
- public float getLayoutMaxY() {
- return layoutMaxY;
- }
-
- private void layoutPrepare() {
- for (Node node : nodes.values()) {
- node.layoutForceX = 0;
- node.layoutForceY = 0;
- }
- }
-
- private void layoutIteration() {
- List<Node> prev = new ArrayList<Node>();
- for(Node node1 : this.nodes.values()) {
- for (Node node2 : prev) {
- layoutRepulsive(node1, node2);
- }
- prev.add(node1);
- }
-
- // Forces on nodes due to edge attractions
- for (Edge edge : edges) {
- layoutAttractive(edge);
- }
-
- // Move by the given force
- for (Node node : nodes.values()) {
- float xmove = LAYOUT_C * node.layoutForceX;
- float ymove = LAYOUT_C * node.layoutForceY;
-
- float max = LAYOUT_MAX_VERTEX_MOVEMENT;
- if (xmove > max) xmove = max;
- if (xmove < -max) xmove = -max;
- if (ymove > max) ymove = max;
- if (ymove < -max) ymove = -max;
-
- node.layoutPosX += xmove;
- node.layoutPosY += ymove;
- node.layoutForceX = 0;
- node.layoutForceY = 0;
- }
- }
-
- private void layoutRepulsive(Node node1, Node node2) {
- float dx = node2.layoutPosX - node1.layoutPosX;
- float dy = node2.layoutPosY - node1.layoutPosY;
- float d2 = dx * dx + dy * dy;
- if (d2 < 0.01) {
- dx = (float) (0.1 * Math.random() + 0.1);
- dy = (float) (0.1 * Math.random() + 0.1);
- d2 = dx * dx + dy * dy;
- }
- float d = (float) Math.sqrt(d2);
- if (d < LAYOUT_MAX_REPULSIVE_FORCE_DISTANCE) {
- float repulsiveForce = LAYOUT_K * LAYOUT_K / d;
- node2.layoutForceX += repulsiveForce * dx / d;
- node2.layoutForceY += repulsiveForce * dy / d;
- node1.layoutForceX -= repulsiveForce * dx / d;
- node1.layoutForceY -= repulsiveForce * dy / d;
- }
- }
-
- private void layoutAttractive(Edge edge) {
- Node node1 = edge.source;
- Node node2 = edge.target;
-
- float dx = node2.layoutPosX - node1.layoutPosX;
- float dy = node2.layoutPosY - node1.layoutPosY;
- float d2 = dx * dx + dy * dy;
- if (d2 < 0.01) {
- dx = (float) (0.1 * Math.random() + 0.1);
- dy = (float) (0.1 * Math.random() + 0.1);
- d2 = dx * dx + dy * dy;
- }
- float d = (float) Math.sqrt(d2);
- if (d > LAYOUT_MAX_REPULSIVE_FORCE_DISTANCE) {
- d = LAYOUT_MAX_REPULSIVE_FORCE_DISTANCE;
- d2 = d * d;
- }
- float attractiveForce = (d2 - LAYOUT_K * LAYOUT_K) / LAYOUT_K;
- attractiveForce *= Math.log(edge.attraction) * 0.5 + 1;
-
- node2.layoutForceX -= attractiveForce * dx / d;
- node2.layoutForceY -= attractiveForce * dy / d;
- node1.layoutForceX += attractiveForce * dx / d;
- node1.layoutForceY += attractiveForce * dy / d;
- }
-
- private void layoutCalcBounds() {
- float minx = Float.POSITIVE_INFINITY,
- maxx = Float.NEGATIVE_INFINITY,
- miny = Float.POSITIVE_INFINITY,
- maxy = Float.NEGATIVE_INFINITY;
-
- for (Node node : nodes.values()) {
- float x = node.layoutPosX;
- float y = node.layoutPosY;
-
- if (x > maxx) maxx = x;
- if (x < minx) minx = x;
- if (y > maxy) maxy = y;
- if (y < miny) miny = y;
- }
-
- layoutMinX = minx;
- layoutMaxX = maxx;
- layoutMinY = miny;
- layoutMaxY = maxy;
- }
-
- public static class Node {
- private String lemma;
- private List senses;
-
- private float layoutPosX;
- private float layoutPosY;
- private float layoutForceX;
- private float layoutForceY;
-
-
- private Node(String lemma, List senses) {
- this.lemma = lemma;
- this.senses = senses;
-
- layoutPosX = 0;
- layoutPosY = 0;
- layoutForceX = 0;
- layoutForceY = 0;
- }
-
- public String getLemma() {
- return lemma;
- }
-
- public int getSenseCount() {
- return senses.size();
- }
-
- public Object getSenseId(int i) {
- return senses.get(i);
- }
-
- public float getLayoutX() {
- return layoutPosX;
- }
-
- public float getLayoutY() {
- return layoutPosY;
- }
- }
-
- public static class Edge {
- private Node source;
- private Node target;
- private float attraction;
-
- private Edge(Node source, Node target) {
- this.source = source;
- this.target = target;
- this.attraction = 1;
- }
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraphActivity.java b/src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraphActivity.java
deleted file mode 100644
index 38878cc50..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraphActivity.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import java.util.*;
-
-import android.app.Activity;
-import android.app.SearchManager;
-import android.os.Bundle;
-import android.os.AsyncTask;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.ImageView;
-import android.widget.Toast;
-import android.content.Intent;
-
-import org.grammaticalframework.pgf.MorphoAnalysis;
-import org.grammaticalframework.ui.android.LanguageSelector.OnLanguageSelectedListener;
-
-public class SemanticGraphActivity extends Activity {
- private Translator mTranslator;
-
- private LanguageSelector mLanguageView;
- private View mProgressBarView = null;
- private ImageView mAddWordButton;
- private SemanticGraphView mGraphView;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_semantic_graph);
-
- mTranslator = ((GFTranslator) getApplicationContext()).getTranslator();
-
- mLanguageView = (LanguageSelector) findViewById(R.id.show_language);
- mLanguageView.setLanguages(mTranslator.getAvailableLanguages());
- mLanguageView.setOnLanguageSelectedListener(new OnLanguageSelectedListener() {
- @Override
- public void onLanguageSelected(final Language language) {
- new AsyncTask<Void,Void,Void>() {
- @Override
- protected void onPreExecute() {
- showProgressBar();
- }
-
- @Override
- protected Void doInBackground(Void... params) {
- mTranslator.setSourceLanguage(language);
- mTranslator.isTargetLanguageLoaded();
- return null;
- }
-
- @Override
- protected void onPostExecute(Void result) {
- hideProgressBar();
- }
- }.execute();
- }
- });
-
- mAddWordButton = (ImageView) findViewById(R.id.add_word);
-
- mGraphView = (SemanticGraphView) findViewById(R.id.semantic_graph);
-
- mAddWordButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- onSearchRequested();
- }
- });
-
- mProgressBarView = findViewById(R.id.progressBarView);
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- mLanguageView.setSelectedLanguage(mTranslator.getSourceLanguage());
- }
-
- private void showProgressBar() {
- mProgressBarView.setVisibility(View.VISIBLE);
- }
-
- private void hideProgressBar() {
- mProgressBarView.setVisibility(View.GONE);
- }
-
- @Override
- protected void onNewIntent (Intent intent) {
- if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
- String query = intent.getStringExtra(SearchManager.QUERY);
- List<MorphoAnalysis> list = mTranslator.lookupMorpho(query);
- if (list == null || list.size() == 0) {
- Toast toast = Toast.makeText(this, "\""+query+"\" doesn't match", Toast.LENGTH_SHORT);
- toast.show();
- } else {
- mGraphView.getGraph().addNode(query, list);
- mGraphView.refresh();
- }
- }
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraphManager.java b/src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraphManager.java
deleted file mode 100644
index f3b26a3cf..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraphManager.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import java.io.*;
-import android.content.Context;
-import android.util.Log;
-
-import org.grammaticalframework.sg.*;
-import org.grammaticalframework.pgf.*;
-
-public class SemanticGraphManager implements Closeable {
- private final Context mContext;
- private SG mDB;
-
- public static final String DATABASE_FILE_NAME = "semantics.db";
-
- public SemanticGraphManager(Context context) {
- mContext = context;
- mDB = null;
- }
-
- private void createDatabaseFromAssets() throws SGError, IOException {
- if (mDB != null)
- return;
-
- String path = mContext.getDatabasePath(DATABASE_FILE_NAME).getPath();
-
- boolean exists = false;
-
- File file = new File(path);
- if (((GFTranslator) mContext.getApplicationContext()).getTranslator().isUpgraded("db_version")) {
- file.delete();
- } else {
- if (file.exists()) {
- exists = true;
- }
- }
-
- File dir = new File(mContext.getApplicationInfo().dataDir + "/databases");
- if (!dir.exists()) {
- dir.mkdir();
- }
-
- if (!extractDatabase(file))
- return;
-
- mDB = SG.openSG(path);
- if (exists)
- return;
- }
-
- private boolean extractDatabase(File outFile) {
- InputStream in = null;
- OutputStream out = null;
- try {
- in = mContext.getAssets().open(DATABASE_FILE_NAME);
- out = new FileOutputStream(outFile);
- copyFile(in, out);
- return true;
- } catch(IOException e) {
- Log.e("tag", "Failed to copy asset file: " + DATABASE_FILE_NAME, e);
- }
- finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- // NOOP
- }
- }
- if (out != null) {
- try {
- out.close();
- } catch (IOException e) {
- // NOOP
- }
- }
- }
-
- return false;
- }
-
- private void copyFile(InputStream in, OutputStream out) throws IOException {
- byte[] buffer = new byte[1024];
- int read;
- while((read = in.read(buffer)) != -1){
- out.write(buffer, 0, read);
- }
- }
-
- public void close() {
- if (mDB != null) {
- mDB.close();
- mDB = null;
- }
- }
-
- public TripleResult queryTriple(Expr subj, Expr pred, Expr obj) throws IOException {
- createDatabaseFromAssets();
- return mDB.queryTriple(subj, pred, obj);
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraphView.java b/src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraphView.java
deleted file mode 100644
index 81785d5ce..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/SemanticGraphView.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import android.view.View;
-import android.view.GestureDetector;
-import android.view.ScaleGestureDetector;
-import android.view.MotionEvent;
-import android.graphics.Paint;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Rect;
-import android.content.Context;
-import android.util.AttributeSet;
-import android.util.Log;
-
-public class SemanticGraphView extends View implements GestureDetector.OnGestureListener, ScaleGestureDetector.OnScaleGestureListener, RotationGestureDetector.OnRotationGestureListener {
-
- private SemanticGraph mGraph = new SemanticGraph();
-
- private float mStartX = 0;
- private float mStartY = 0;
- private float mFocusX = 0;
- private float mFocusY = 0;
- private float mScale = 1;
- private float mAngle = 0;
-
- private Paint mPaint;
-
- private GestureDetector mGD;
- private ScaleGestureDetector mSGD;
- private RotationGestureDetector mRGD;
-
- private static final float TEXT_PAD = 10;
- private static final float SENSE_POINT_RADIUS = 5;
-
- public SemanticGraphView(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- mPaint = new Paint();
- mPaint.setTextSize(60);
-
- mGD = new GestureDetector(this);
- mSGD = new ScaleGestureDetector(context,this);
- mRGD = new RotationGestureDetector(this);
- }
-
- public SemanticGraph getGraph() {
- return mGraph;
- }
-
- public void refresh() {
- mGraph.layout();
- invalidate();
- }
-
- @Override
- protected void onDraw (Canvas canvas) {
- super.onDraw(canvas);
-
- canvas.scale(mScale,mScale,mFocusX,mFocusY);
- canvas.translate(mStartX, mStartY);
- canvas.rotate(mAngle);
-
- Rect bounds = new Rect();
-
- float dx = mGraph.getLayoutMinX();
- float sx = getWidth()/(mGraph.getLayoutMaxX()-mGraph.getLayoutMinX());
- float dy = mGraph.getLayoutMinY();
- float sy = getHeight()/(mGraph.getLayoutMaxY()-mGraph.getLayoutMinY());
- for (SemanticGraph.Node node : mGraph.getNodes()) {
- mPaint.getTextBounds(node.getLemma().toCharArray(), 0, node.getLemma().length(), bounds);
-
- float left = (node.getLayoutX()-dx)*sx - TEXT_PAD;
- float base = (node.getLayoutY()-dy)*sy;
- float top = base - bounds.height() - TEXT_PAD;
- float right = left + bounds.right + TEXT_PAD;
- float bottom = base + bounds.bottom + TEXT_PAD;
- float sqrt2 = (float) Math.sqrt(2);
-
- canvas.drawText(node.getLemma(), left + TEXT_PAD, base, mPaint);
-
- float pi = (float) Math.PI;
- for (int i = 0; i < node.getSenseCount(); i++) {
- float phi = i * 2*pi / node.getSenseCount();
- float cx = ((left+right) + (right-left)*sqrt2*((float) Math.sin(phi)))/2;
- float cy = ((top+bottom) + (bottom-top)*sqrt2*((float) Math.cos(phi)))/2;
-
- canvas.drawCircle(cx,cy,SENSE_POINT_RADIUS,mPaint);
- }
- }
- }
-
- public boolean onTouchEvent(MotionEvent ev) {
- mGD.onTouchEvent(ev);
- mSGD.onTouchEvent(ev);
- mRGD.onTouchEvent(ev);
- return true;
- }
-
- public boolean onDown(MotionEvent e) {
- return true;
- }
-
- public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
- return true;
- }
-
- public void onLongPress(MotionEvent e) {
- }
-
- public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
- mStartX -= distanceX;
- mStartY -= distanceY;
- invalidate();
- return true;
- }
-
- public void onShowPress(MotionEvent e) {
- }
-
- public boolean onSingleTapUp(MotionEvent e) {
- return true;
- }
-
- public boolean onScaleBegin(ScaleGestureDetector detector) {
- return true;
- }
-
- public boolean onScale(ScaleGestureDetector detector) {
- mScale *= detector.getScaleFactor();
- mFocusX = detector.getFocusX();
- mFocusY = detector.getFocusY();
- invalidate();
- return true;
- }
-
- public void onScaleEnd(ScaleGestureDetector detector) {
- }
-
- public boolean OnRotation(RotationGestureDetector detector) {
- mAngle -= detector.getAngle();
- invalidate();
- return true;
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/TTS.java b/src/ui/android/src/org/grammaticalframework/ui/android/TTS.java
deleted file mode 100644
index 3e020f0af..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/TTS.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import android.content.Context;
-import android.media.AudioManager;
-import android.speech.tts.TextToSpeech;
-import android.util.Log;
-
-import java.util.HashMap;
-import java.util.Locale;
-
-public class TTS {
-
- private static final String TAG = "TTS";
-
- private TextToSpeech mTts;
- private AudioManager mAudioManager;
-
- public TTS(Context context) {
- mTts = new TextToSpeech(context, new InitListener());
- mAudioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
- }
-
- // TODO: handle speak() calls before service connects
- public void speak(String language, String text) {
-
-
- if (mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) {
-
- /* hack for missing TTS -- don't use for official release!
- if (language.equals("bg-BG")) {
- language = "ru-RU";
- }
- if (language.equals("ca-ES")) {
- language = "es-ES"; // hardly politically correct...
- }
- */
-
- /* Google Chinese speech input has a nonstandard code. In output, yue works for Chi in Google, but SVOX uses the standard zh-CN */
- if (language.equals("cmn-Hans-CN")) {
- language = "zh-CN";
- }
-
- Locale locale = LocaleUtils.parseJavaLocale(language.replace('-', '_'),
- Locale.getDefault());
-
- int result = mTts.setLanguage(locale);
- if (result == TextToSpeech.LANG_MISSING_DATA ||
- result == TextToSpeech.LANG_NOT_SUPPORTED) {
- Log.e(TAG, "Language is not available");
- } else {
- HashMap<String,String> params = new HashMap<String,String>();
- mTts.speak(text, TextToSpeech.QUEUE_FLUSH, params);
- }
- }
- }
-
- public void destroy() {
- if (mTts != null) {
- mTts.stop();
- mTts.shutdown();
- }
- }
-
- private class InitListener implements TextToSpeech.OnInitListener {
- @Override
- public void onInit(int status) {
- if (status == TextToSpeech.SUCCESS) {
- Log.d(TAG, "Initialized TTS");
- } else {
- Log.e(TAG, "Failed to initialize TTS");
- }
- }
-
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/Translator.java b/src/ui/android/src/org/grammaticalframework/ui/android/Translator.java
deleted file mode 100644
index 4bfe9690a..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/Translator.java
+++ /dev/null
@@ -1,777 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.util.Log;
-import android.util.Pair;
-import android.net.Uri;
-import android.view.inputmethod.CompletionInfo;
-import android.database.sqlite.SQLiteDatabase;
-import android.database.Cursor;
-
-import org.grammaticalframework.sg.*;
-import org.grammaticalframework.pgf.*;
-import java.io.*;
-import java.util.*;
-
-public class Translator {
-
- private static final String TAG = "Translator";
-
- // new
-
- // TODO: allow changing
- private String mGrammar = "App.pgf" ;
-
- // TODO: build dynamically?
- private Language[] mLanguages = {
- new Language("bg-BG", "Bulgarian", "AppBul", R.xml.cyrillic),
- new Language("ca-ES", "Catalan", "AppCat", R.xml.qwerty),
- new Language("cmn-Hans-CN", "Chinese", "AppChi", R.xml.qwerty),
- // new Language("zh-CN", "Chinese", "AppChi", R.xml.qwerty),
- // new Language("yue", "Chinese (Cantonese)", "AppChi", R.xml.qwerty),
- // new Language("cmn-Hans-CN", "Chinese (Mandarin)", "AppChi", R.xml.qwerty),
- new Language("nl-NL", "Dutch", "AppDut", R.xml.qwerty),
- new Language("en-US", "English", "AppEng", R.xml.qwerty),
- new Language("et-EE", "Estonian","AppEst", R.xml.nordic),
- new Language("fi-FI", "Finnish", "AppFin", R.xml.nordic),
- new Language("fr-FR", "French", "AppFre", R.xml.qwerty), ////
- new Language("de-DE", "German", "AppGer", R.xml.qwerty),
- new Language("hi-IN", "Hindi", "AppHin", R.xml.devanagari_page1, R.xml.devanagari_page2),
- new Language("it-IT", "Italian", "AppIta", R.xml.qwerty),
- new Language("ja-JP", "Japanese","AppJpn", R.xml.qwerty),
- new Language("ru-RU", "Russian", "AppRus", R.xml.cyrillic),
- new Language("es-ES", "Spanish", "AppSpa", R.xml.qwerty),
- new Language("sv-SE", "Swedish", "AppSwe", R.xml.nordic),
- new Language("th-TH", "Thai", "AppTha", R.xml.thai_page1, R.xml.thai_page2),
- new Language("ur-PK", "Urdu", "AppUrd", R.xml.qwerty), // TODO language code and keyboard to check
- };
-
- private Context mContext;
-
- private GrammarLoader mGrammarLoader;
- private ConcrLoader mSourceLoader;
- private ConcrLoader mTargetLoader;
- private ConcrLoader mOtherLoader;
- private SemanticGraphManager mSGManager;
-
- private static final String SOURCE_LANG_KEY = "source_lang";
- private static final String TARGET_LANG_KEY = "target_lang";
-
- public static final String WORDS = "words";
- public static final String SENTENCES = "sentences";
-
- private static final int NUM_ALT_TRANSLATIONS = 10;
-
- private SharedPreferences mSharedPref;
-
- private Language getPrefLang(String key, int def) {
- int index = mSharedPref.getInt(key, def);
- if (index < 0 || index >= mLanguages.length)
- index = def;
- return mLanguages[index];
- }
-
- private void setPrefLang(String key, Language def) {
- for (int index = 0; index < mLanguages.length; index++) {
- if (def == mLanguages[index]) {
- SharedPreferences.Editor editor = mSharedPref.edit();
- editor.putInt(key, index);
- editor.commit();
- break;
- }
- }
- }
-
- public Translator(Context context) {
- mContext = context;
-
- mSharedPref = context.getSharedPreferences(
- context.getString(R.string.global_preferences_key), Context.MODE_PRIVATE);
-
- mGrammarLoader = new GrammarLoader();
- mGrammarLoader.start();
-
- Language prefSourceLang = getPrefLang(SOURCE_LANG_KEY, 0);
- Language prefTargetLang = getPrefLang(TARGET_LANG_KEY, 1);
-
- mSourceLoader = new ConcrLoader(prefSourceLang);
- mSourceLoader.start();
-
- if (prefSourceLang == prefTargetLang) {
- mTargetLoader = mSourceLoader;
- } else {
- mTargetLoader = new ConcrLoader(prefTargetLang);
- mTargetLoader.start();
- }
-
- mOtherLoader = null;
-
- mSGManager = new SemanticGraphManager(context);
- }
-
- public List<Language> getAvailableLanguages() {
- return Arrays.asList(mLanguages);
- }
-
- public Language getSourceLanguage() {
- return mSourceLoader.getLanguage();
- }
-
- public void setSourceLanguage(Language language) {
- setPrefLang(SOURCE_LANG_KEY, language);
-
- if (mSourceLoader.getLanguage() == language)
- return;
- if (mTargetLoader.getLanguage() == language) {
- cacheOrUnloadLanguage(mSourceLoader);
- mSourceLoader = mTargetLoader;
- return;
- }
- if (mOtherLoader != null &&
- mOtherLoader.getLanguage() == language) {
- ConcrLoader tmp = mSourceLoader;
- mSourceLoader = mOtherLoader;
- mOtherLoader = tmp;
- return;
- }
-
- try {
- mSourceLoader.join();
- } catch (InterruptedException e) {
- Log.e(TAG, "Loading interrupted", e);
- }
-
- if (mSourceLoader.getLanguage() != mTargetLoader.getLanguage()) {
- cacheOrUnloadLanguage(mSourceLoader);
- }
-
- mSourceLoader = new ConcrLoader(language);
- mSourceLoader.start();
- }
-
- public boolean isSourceLanguageLoaded() {
- try {
- mSourceLoader.join();
- return true;
- } catch (InterruptedException e) {
- Log.e(TAG, "Loading interrupted", e);
- }
- return false;
- }
-
- private Concr getSourceConcr() {
- try {
- mSourceLoader.join();
- } catch (InterruptedException e) {
- Log.e(TAG, "Loading interrupted", e);
- }
- return mSourceLoader.getConcr();
- }
-
- public Language getTargetLanguage() {
- return mTargetLoader.getLanguage();
- }
-
- public void setTargetLanguage(Language language) {
- setPrefLang(TARGET_LANG_KEY, language);
-
- if (mTargetLoader.getLanguage() == language)
- return;
- if (mSourceLoader.getLanguage() == language) {
- cacheOrUnloadLanguage(mTargetLoader);
- mTargetLoader = mSourceLoader;
- return;
- }
- if (mOtherLoader != null &&
- mOtherLoader.getLanguage() == language) {
- ConcrLoader tmp = mTargetLoader;
- mTargetLoader = mOtherLoader;
- mOtherLoader = tmp;
- return;
- }
-
- try {
- mTargetLoader.join();
- } catch (InterruptedException e) {
- Log.e(TAG, "Loading interrupted", e);
- }
-
- if (mSourceLoader.getLanguage() != mTargetLoader.getLanguage()) {
- cacheOrUnloadLanguage(mTargetLoader);
- }
-
- mTargetLoader = new ConcrLoader(language);
- mTargetLoader.start();
- }
-
- public boolean isTargetLanguageLoaded() {
- try {
- mTargetLoader.join();
- return true;
- } catch (InterruptedException e) {
- Log.e(TAG, "Loading interrupted", e);
- }
- return false;
- }
-
- private Concr getTargetConcr() {
- try {
- mTargetLoader.join();
- } catch (InterruptedException e) {
- Log.e(TAG, "Loading interrupted", e);
- }
- return mTargetLoader.getConcr();
- }
-
- private void cacheOrUnloadLanguage(ConcrLoader loader) {
- if (mOtherLoader != null) {
- mOtherLoader.getConcr().unload();
- Log.d(TAG, mOtherLoader.getLanguage().getConcrete() + ".pgf_c unloaded");
- }
- mOtherLoader = loader;
- }
-
- public void switchLanguages() {
- ConcrLoader tmp = mSourceLoader;
- mSourceLoader = mTargetLoader;
- mTargetLoader = tmp;
- }
-
- private static String explode(String in) {
- String out = "";
- for (int i = 0; i < in.length(); i++) {
- if (i > 0)
- out += ' ';
- out += in.charAt(i);
- }
- return out;
- }
-
- private static String implode(String s) {
- return s.replaceAll("(?<!^[%*+])\\s","");
- }
-
- private String translateWord(String input) {
-
- String output = input.toUpperCase() ; // if all else fails, return the word itself in upper case ///in brackets
- Concr sourceLang = getSourceConcr() ;
- Concr targetLang = getTargetConcr() ;
-
- String lowerinput = input.toLowerCase() ; // also consider lower-cased versions of the word
-
- try {
- Iterator<ExprProb> iter = sourceLang.parse("Chunk", input).iterator(); // try parse as chunk
- Expr expr = iter.next().getExpr();
- output = targetLang.linearize(expr);
- return output ;
- } catch (ParseError e) { // if this fails
- List<MorphoAnalysis> morphos = lookupMorpho(input) ; // lookup morphological analyses
-
- morphos.addAll(lookupMorpho(lowerinput)) ; // including the analyses of the lower-cased word
-
- for (MorphoAnalysis ana : morphos) {
- if (targetLang.hasLinearization(ana.getLemma())) { // check that the word has linearization in target
- output = targetLang.linearize(Expr.readExpr(ana.getLemma())) ;
- break ; // if yes, don't search any more
- }
- }
- return output ;
- }
- }
-
- private String translateByLookup(String input) {
- String[] words = input.split(" ") ;
-
- String output = "%" ;
- for (String w : words) {
- output = output + " " + translateWord(w) ;
- }
-
- return output ;
- }
-
- // lowercase the first word if (1) it is not in the lexicon and (2) its lowercase version is in the lexicon
- // otherwise it will be left uppercase and treated as a name
- private String lowercaseIfBetter(String input) {
- String[] words = input.split(" ") ;
-
- String firstword = words[0] ;
-
- String lowerfirstword = firstword.toLowerCase() ;
-
- if (lookupMorpho(firstword).isEmpty() && !(lookupMorpho(lowerfirstword).isEmpty())) {
- words[0] = lowerfirstword ;
- String output = "" ;
- for (String w : words) {
- output = output + " " + w ;
- }
- return output ;
- } else {
- return input ;
- }
-
- }
-
- /**
- * Takes a lot of time. Must not be called on the main thread.
- */
- public Pair<String, List<ExprProb>> translate(String input) {
- if (getSourceLanguage().getLangCode().equals("cmn-Hans-CN")) {
- // for Chinese we need to put space after every character
- input = explode(input);
- } else {
- input = lowercaseIfBetter(input);
- } ;
-
- String output = null;
- List<ExprProb> exprs = new ArrayList<ExprProb>();
-
- try {
- Concr sourceLang = getSourceConcr();
- Concr targetLang = getTargetConcr();
-
- Map<String,LiteralCallback> callbacks = new HashMap<String,LiteralCallback>();
- callbacks.put("PN", new NercLiteralCallback(mGrammarLoader.getGrammar(), sourceLang, input));
- callbacks.put("Symb", new UnknownLiteralCallback(sourceLang, input));
-
- int count = NUM_ALT_TRANSLATIONS;
- for (ExprProb ep : sourceLang.parseWithHeuristics(getGrammar().getStartCat(), input, -1, callbacks)) {
- if (count-- <= 0)
- break;
- exprs.add(ep);
- if (output == null)
- output = targetLang.linearize(ep.getExpr());
- }
- } catch (ParseError e) {
- output = translateByLookup(input);
- }
-
- if (output == null)
- output = "% "; // make sure that we return something
-
- if (getTargetLanguage().getLangCode().equals("cmn-Hans-CN") ||
- getTargetLanguage().getLangCode().equals("ja-JP") ||
- getTargetLanguage().getLangCode().equals("th-TH"))
- output = implode(output) ;
-
- return new Pair<String,List<ExprProb>>(output, exprs);
- }
-
- public String linearize(Expr expr) {
- Concr targetLang = getTargetConcr();
- String s = targetLang.linearize(expr);
- if (s == null)
- s = "% "; // make sure that we return something
-
- if (getTargetLanguage().getLangCode().equals("cmn-Hans-CN") ||
- getTargetLanguage().getLangCode().equals("ja-JP") ||
- getTargetLanguage().getLangCode().equals("th-TH"))
- return implode(s);
- else
- return s;
- }
-
- public String linearizeSource(Expr expr) {
- Concr targetLang = getSourceConcr();
- String s = targetLang.linearize(expr);
- if (s == null)
- s = "% "; // make sure that we return something
-
- if (getSourceLanguage().getLangCode().equals("cmn-Hans-CN") ||
- getSourceLanguage().getLangCode().equals("ja-JP") ||
- getSourceLanguage().getLangCode().equals("th-TH"))
- return implode(s);
- else
- return s;
- }
-
- public Object[] bracketedLinearize(Expr expr) {
- Concr targetLang = getTargetConcr();
- return targetLang.bracketedLinearize(expr);
- }
-
- public String generateLexiconEntry(Expr lemma) {
- Concr sourceLang = getSourceConcr();
- Concr targetLang = getTargetConcr();
- String fun = lemma.toString();
- String cat = getGrammar().getFunctionType(fun).getCategory();
-
- Expr e2 = Expr.readExpr("MkTag (Inflection"+cat+" "+fun+")");
-
- if (targetLang.hasLinearization("Inflection"+cat)) {
- if (targetLang.hasLinearization(fun))
- return sourceLang.linearize(lemma) + " - " + targetLang.linearize(e2) + ". " + targetLang.linearize(lemma);
- else
- return sourceLang.linearize(lemma) + " " + targetLang.linearize(e2)+".";
- } else {
- if (targetLang.hasLinearization(fun))
- return sourceLang.linearize(lemma) + " - " + targetLang.linearize(lemma);
- else
- return sourceLang.linearize(lemma);
- }
- }
-
- private static final Expr gloss_pred = Expr.readExpr("gloss");
- private static final Expr topic_pred = Expr.readExpr("topic");
- private static final Expr example_pred = Expr.readExpr("example");
-
- public Expr getDefinition(Expr lemma, boolean withExample) {
- Expr gloss = null;
- Expr example = null;
- Map<String,Uri.Builder> topics = new TreeMap<String,Uri.Builder>();
-
- try {
- TripleResult res = mSGManager.queryTriple(lemma, null, null);
- while (res.hasNext()) {
- if (res.getPredicate().equals(gloss_pred))
- gloss = res.getObject();
- else if (res.getPredicate().equals(topic_pred))
- updateWordsMap(res.getObject(), topics);
- else if (res.getPredicate().equals(example_pred))
- example = res.getObject();
- }
- res.close();
- } catch (IOException e) {
- // nothing
- } catch (SGError e) {
- // nothing
- }
-
- Expr topic = null;
- if (topics.size() > 0) {
- StringBuilder builder = new StringBuilder();
- builder.append('(');
- buildWordsHtml(topics, builder);
- builder.append(')');
- topic = new Expr(builder.toString());
- }
- if (gloss == null)
- return topic;
- else {
- if (topic == null)
- topic = new Expr("");
- if (withExample && example != null)
- return new Expr("MkDefinitionEx", topic, gloss, example);
- else
- return new Expr("MkDefinition", topic, gloss);
- }
- }
-
- private void updateWordsMap(Expr expr, Map<String,Uri.Builder> map) {
- String word = getTargetConcr().linearize(expr);
-
- Uri.Builder builder = map.get(word);
- if (builder == null) {
- builder = new Uri.Builder();
- builder.scheme("gf-translator");
- builder.authority(WORDS);
- builder.appendQueryParameter("source", word);
- map.put(word,builder);
- }
- builder.appendQueryParameter("alternative", expr.toString());
- }
-
- private void buildWordsHtml(Map<String,Uri.Builder> map, StringBuilder sbuilder) {
- boolean first = true;
- for (Map.Entry<String,Uri.Builder> entry : map.entrySet()) {
- if (first)
- first = false;
- else
- sbuilder.append(", ");
-
- sbuilder.append("<a href=\""+entry.getValue().build()+"\">"+entry.getKey()+"</a>");
- }
- }
-
- public List<Expr> getTopicWords(Expr lemma) {
- TripleResult res = null;
- List<Expr> words = new ArrayList<Expr>();
- try {
- res = mSGManager.queryTriple(null, topic_pred, lemma);
- while (res.hasNext()) {
- words.add(res.getSubject());
- }
- } catch (IOException e) {
- // nothing
- } catch (SGError e) {
- // nothing
- } finally {
- if (res != null)
- res.close();
- }
- return words;
- }
-
- private Expr getTopicWordsHtml(Expr lemma) {
- StringBuilder sbuilder = new StringBuilder();
- TripleResult res = null;
- try {
- res = mSGManager.queryTriple(null, topic_pred, lemma);
- Map<String,Uri.Builder> map = new TreeMap<String,Uri.Builder>();
- while (res.hasNext()) {
- updateWordsMap(res.getSubject(), map);
- }
-
- StringBuilder builder = new StringBuilder();
- buildWordsHtml(map, builder);
- return new Expr(builder.toString());
- } catch (IOException e) {
- // nothing
- } catch (SGError e) {
- // nothing
- } finally {
- if (res != null)
- res.close();
- }
- return null;
- }
-
- public String getInflectionTable(Expr lemma) {
- boolean withExample =
- (getSourceLanguage().getLangCode().equals("en-US") ||
- getTargetLanguage().getLangCode().equals("en-US"));
- Expr def =
- getDefinition(lemma, withExample);
-
- String fun = lemma.toString();
- Concr targetLang = getTargetConcr();
- String cat = getGrammar().getFunctionType(fun).getCategory();
-
- if (targetLang.hasLinearization(fun) &&
- targetLang.hasLinearization("Inflection"+cat)) {
- if (def == null)
- def = Expr.readExpr("NoDefinition");
-
- Expr e = new Expr("MkDocument",
- def,
- new Expr("Inflection"+cat,lemma),
- getTopicWordsHtml(lemma));
- String html =
- "<html><head><meta charset=\"UTF-8\"/><style>a {color: #808080;}</style></head><body>" +
- targetLang.linearize(e) +
- "</body>";
- return html;
- } else if (def != null) {
- String html =
- "<html><head><meta charset=\"UTF-8\"/><style>a {color: #808080;}</style></head><body>" +
- targetLang.linearize(def) +
- "</body>";
- return html;
- } else {
- return null;
- }
- }
-
- public List<Expr> getTopicsOf(Expr lemma) {
- TripleResult res = null;
- List<Expr> topics = new ArrayList<Expr>();
- try {
- res = mSGManager.queryTriple(lemma, topic_pred, null);
- while (res.hasNext()) {
- topics.add(res.getObject());
- }
- } catch (IOException e) {
- // nothing
- } catch (SGError e) {
- // nothing
- } finally {
- if (res != null)
- res.close();
- }
- return topics;
- }
-
- private static String escapeHtml(CharSequence text) {
- StringBuilder out = new StringBuilder();
-
- for (int i = 0; i < text.length(); i++) {
- char c = text.charAt(i);
-
- if (c == '<') {
- out.append("&lt;");
- } else if (c == '>') {
- out.append("&gt;");
- } else if (c == '&') {
- out.append("&amp;");
- } else if (c == '"') {
- out.append("&quot;");
- } else if (c > 0x7E || c < ' ') {
- out.append("&#").append((int) c).append(";");
- } else if (c == ' ') {
- while (i + 1 < text.length() && text.charAt(i + 1) == ' ') {
- out.append("&nbsp;");
- i++;
- }
-
- out.append(' ');
- } else {
- out.append(c);
- }
- }
-
- return out.toString();
- }
-
- public List<MorphoAnalysis> lookupMorpho(String sentence) {
- List<MorphoAnalysis> ans = getSourceConcr().lookupMorpho(sentence);
- Collections.sort(ans, new Comparator<MorphoAnalysis>() {
- public int compare(MorphoAnalysis a1, MorphoAnalysis a2) {
- if (a1.getProb() > a2.getProb())
- return 1;
- else if (a1.getProb() < a2.getProb())
- return -1;
- else
- return 0;
- }
- });
- return ans;
- }
-
- public CompletionInfo[] lookupWordPrefix(String prefix) {
- PriorityQueue<FullFormEntry> queue =
- new PriorityQueue<FullFormEntry>(500, new Comparator<FullFormEntry>() {
- @Override
- public int compare(FullFormEntry lhs, FullFormEntry rhs) {
- return Double.compare(lhs.getProb(), rhs.getProb());
- }
- });
- for (FullFormEntry entry : getSourceConcr().lookupWordPrefix(prefix)) {
- queue.add(entry);
- if (queue.size() >= 1000)
- break;
- }
-
- CompletionInfo[] completions = new CompletionInfo[Math.min(queue.size(), 5)+1];
- completions[0] = new CompletionInfo(0, 0, prefix);
- for (int i = 1; i < completions.length; i++) {
- completions[i] = new CompletionInfo(i,i,queue.poll().getForm());
- }
-
- if (completions.length > 1) {
- Arrays.sort(completions, 1, completions.length-1, new Comparator<CompletionInfo>() {
- @Override
- public int compare(CompletionInfo arg0, CompletionInfo arg1) {
- return ((String) arg0.getText()).compareTo((String) arg1.getText());
- }
- });
- }
-
- return completions;
- }
-
- private PGF getGrammar() {
- try {
- mGrammarLoader.join();
- } catch (InterruptedException e) {
- Log.e(TAG, "Loading interrupted", e);
- }
- return mGrammarLoader.getGrammar();
- }
-
- private class GrammarLoader extends Thread {
- private PGF mPGF;
-
- public GrammarLoader() {
- mPGF = null;
- }
-
- public PGF getGrammar() {
- return mPGF;
- }
-
- public void run() {
- InputStream in = null;
-
- try {
- in = mContext.getAssets().open(mGrammar);
- Log.d(TAG, "Trying to open " + mGrammar);
- long t1 = System.currentTimeMillis();
- mPGF = PGF.readPGF(in);
- long t2 = System.currentTimeMillis();
- Log.d(TAG, mGrammar + " loaded ("+(t2-t1)+" ms)");
- } catch (FileNotFoundException e) {
- Log.e(TAG, "File not found", e);
- } catch (IOException e) {
- Log.e(TAG, "Error loading grammar", e);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- Log.e(TAG, "Error closing the stream", e);
- }
- }
- }
- }
- }
-
- private class ConcrLoader extends Thread {
- private Language mLanguage;
- private Concr mConcr;
-
- public ConcrLoader(Language lang) {
- this.mLanguage = lang;
- this.mConcr = null;
- }
-
- public Language getLanguage() {
- return mLanguage;
- }
-
- public Concr getConcr() {
- return mConcr;
- }
-
- public void run() {
- try {
- mGrammarLoader.join();
- } catch (InterruptedException e) {
- Log.d(TAG, "interrupted", e);
- }
-
- InputStream in = null;
-
- try {
- String name = mLanguage.getConcrete()+".pgf_c";
- in = mContext.getAssets().open(name);
- Log.d(TAG, "Trying to load " + name);
- long t1 = System.currentTimeMillis();
- mConcr = mGrammarLoader.getGrammar().getLanguages().get(mLanguage.getConcrete());
- mConcr.load(in);
- long t2 = System.currentTimeMillis();
- Log.d(TAG, name + " loaded ("+(t2-t1)+" ms)");
- } catch (FileNotFoundException e) {
- Log.e(TAG, "File not found", e);
- } catch (IOException e) {
- Log.e(TAG, "Error loading concrete", e);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- Log.e(TAG, "Error closing the stream", e);
- }
- }
- }
- }
- }
-
- public boolean isUpgraded(String key) {
- int old_code = mSharedPref.getInt(key, 0);
-
- int new_code = 0;
- try {
- new_code = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionCode;
- } catch (NameNotFoundException e) {
- // Huh? Really?
- }
-
- SharedPreferences.Editor editor = mSharedPref.edit();
- editor.putInt(key, new_code);
- editor.commit();
-
- return (old_code != new_code);
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/TranslatorInputMethodService.java b/src/ui/android/src/org/grammaticalframework/ui/android/TranslatorInputMethodService.java
deleted file mode 100644
index d621e2f69..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/TranslatorInputMethodService.java
+++ /dev/null
@@ -1,666 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import android.inputmethodservice.InputMethodService;
-import android.text.InputType;
-import android.text.method.MetaKeyKeyListener;
-import android.view.KeyCharacterMap;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.inputmethod.CompletionInfo;
-import android.view.inputmethod.EditorInfo;
-import android.view.inputmethod.InputConnection;
-
-
-public class TranslatorInputMethodService extends InputMethodService
- implements android.inputmethodservice.KeyboardView.OnKeyboardActionListener {
-
- private TranslatorKeyboardView mInputView;
- private CompletionsView mCandidateView;
- private CompletionInfo[] mCompletions;
-
- private StringBuilder mComposingText = new StringBuilder();
- private StringBuilder mComposingWord = new StringBuilder();
- private boolean mPredictionOn;
- private boolean mCompletionOn;
- private boolean mCapsLock;
- private long mLastShiftTime;
- private long mMetaState;
-
- private TranslatorKeyboard mSymbolsPage1Keyboard;
- private TranslatorKeyboard mSymbolsPage2Keyboard;
- private TranslatorKeyboard mLanguagePage1Keyboard;
- private TranslatorKeyboard mLanguagePage2Keyboard;
-
- private TranslatorKeyboard mCurKeyboard;
-
- private int mActionId;
-
- private Translator mTranslator;
-
- @Override
- public void onCreate() {
- super.onCreate();
-
- mTranslator = ((GFTranslator) getApplicationContext()).getTranslator();
-
- mSymbolsPage1Keyboard = null;
- mSymbolsPage2Keyboard = null;
- mLanguagePage1Keyboard = null;
- mLanguagePage2Keyboard = null;
- }
-
- @Override
- public View onCreateInputView() {
- mInputView = (TranslatorKeyboardView)
- getLayoutInflater().inflate(R.layout.input, null);
- mInputView.setOnKeyboardActionListener(this);
- mInputView.setKeyboard(mCurKeyboard);
- return mInputView;
- }
-
- @Override
- public View onCreateCandidatesView() {
- mCandidateView = new CompletionsView(this);
- mCandidateView.setService(this);
- return mCandidateView;
- }
-
- private int mModeId;
- private EditorInfo mAttribute;
- private static TranslatorInputMethodService mInstance;
-
- static TranslatorInputMethodService getInstance() {
- return mInstance;
- }
-
- @Override
- public void onStartInput(EditorInfo attribute, boolean restarting) {
- super.onStartInput(attribute, restarting);
-
- // Reset our state. We want to do this even if restarting, because
- // the underlying state of the text editor could have changed in any way.
- mComposingText.setLength(0);
- mComposingWord.setLength(0);
- updateCandidates();
-
- if (!restarting) {
- // Clear shift states.
- mMetaState = 0;
- }
-
- mPredictionOn = false;
- mCompletionOn = false;
- mCompletions = null;
-
- int res1 =
- mTranslator.getSourceLanguage().getKeyboardPage1Resource();
- int res2 =
- mTranslator.getSourceLanguage().getKeyboardPage2Resource();
- mModeId = R.string.normalKeyboardMode;
- if (attribute.extras != null &&
- !attribute.extras.getBoolean("show_language_toggle", true)) {
- mModeId = R.string.internalKeyboardMode;
- }
- mAttribute = attribute;
- mLanguagePage1Keyboard = new TranslatorKeyboard(this, res1, mModeId);
- mLanguagePage2Keyboard = new TranslatorKeyboard(this, res2, mModeId);
- mSymbolsPage1Keyboard = new TranslatorKeyboard(this, R.xml.symbols_page1, mModeId);
- mSymbolsPage2Keyboard = new TranslatorKeyboard(this, R.xml.symbols_page2, mModeId);
-
- // We are now going to initialize our state based on the type of
- // text being edited.
- switch (attribute.inputType & InputType.TYPE_MASK_CLASS) {
- case InputType.TYPE_CLASS_NUMBER:
- case InputType.TYPE_CLASS_DATETIME:
- // Numbers and dates default to the symbols keyboard, with
- // no extra features.
- mCurKeyboard = mSymbolsPage1Keyboard;
- break;
-
- case InputType.TYPE_CLASS_PHONE:
- // Phones will also default to the symbols keyboard, though
- // often you will want to have a dedicated phone keyboard.
- mCurKeyboard = mSymbolsPage1Keyboard;
- break;
-
- case InputType.TYPE_CLASS_TEXT:
- // This is general text editing. We will default to the
- // normal alphabetic keyboard, and assume that we should
- // be doing predictive text (showing candidates as the
- // user types).
- mCurKeyboard = mLanguagePage1Keyboard;
- mPredictionOn = true;
-
- // We now look for a few special variations of text that will
- // modify our behavior.
- int variation = attribute.inputType & InputType.TYPE_MASK_VARIATION;
- if (variation == InputType.TYPE_TEXT_VARIATION_PASSWORD ||
- variation == InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD ||
- variation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
- // Do not display predictions / what the user is typing
- // when they are entering a password.
- mPredictionOn = false;
- }
-
- if (variation == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS ||
- variation == InputType.TYPE_TEXT_VARIATION_URI ||
- variation == InputType.TYPE_TEXT_VARIATION_FILTER) {
- // Our predictions are not useful for e-mail addresses
- // or URIs.
- mPredictionOn = false;
- }
-
- if ((attribute.inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) {
- // If this is an auto-complete text view, then our predictions
- // will not be shown and instead we will allow the editor
- // to supply their own. We only show the editor's
- // candidates when in full-screen mode, otherwise relying
- // own it displaying its own UI.
- mPredictionOn = false;
- mCompletionOn = isFullscreenMode();
- }
-
- // We also want to look at the current state of the editor
- // to decide whether our alphabetic keyboard should start out
- // shifted.
- updateShiftKeyState(attribute);
- break;
-
- default:
- // For all unknown input types, default to the alphabetic
- // keyboard with no special features.
- mCurKeyboard = mLanguagePage1Keyboard;
- updateShiftKeyState(attribute);
- }
-
- mActionId = attribute.imeOptions & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION);
- mLanguagePage1Keyboard.setImeOptions(getResources(), attribute.imeOptions);
- mLanguagePage2Keyboard.setImeOptions(getResources(), attribute.imeOptions);
-
- mInstance = this;
- }
-
- @Override
- public void onFinishInput() {
- super.onFinishInput();
-
- // Clear current composing text and candidates.
- mComposingText.setLength(0);
- mComposingWord.setLength(0);
- updateCandidates();
-
- // We only hide the candidates window when finishing input on
- // a particular editor, to avoid popping the underlying application
- // up and down if the user is entering text into the bottom of
- // its window.
- setCandidatesViewShown(false);
-
- mCurKeyboard = mLanguagePage1Keyboard;
- if (mInputView != null) {
- mInputView.closing();
- }
-
- mInstance = null;
- mAttribute = null;
- }
-
- @Override
- public void onStartInputView(EditorInfo attribute, boolean restarting) {
- super.onStartInputView(attribute, restarting);
- // Apply the selected keyboard to the input view.
- mInputView.setKeyboard(mCurKeyboard);
- mInputView.closing();
- }
-
- @Override
- public void onUpdateSelection(int oldSelStart, int oldSelEnd,
- int newSelStart, int newSelEnd,
- int candidatesStart, int candidatesEnd) {
- super.onUpdateSelection(oldSelStart, oldSelEnd, newSelStart, newSelEnd,
- candidatesStart, candidatesEnd);
-
- // If the current selection in the text view changes, we should
- // clear whatever candidate text we have.
- if (mComposingText.length() + mComposingWord.length() > 0 &&
- (newSelStart != candidatesEnd || newSelEnd != candidatesEnd)) {
- mComposingText.setLength(0);
- mComposingWord.setLength(0);
- updateCandidates();
- InputConnection ic = getCurrentInputConnection();
- if (ic != null) {
- ic.finishComposingText();
- }
- }
- }
-
- @Override
- public void onDisplayCompletions(CompletionInfo[] completions) {
- if (mCompletionOn) {
- mCompletions = completions;
- if (completions == null) {
- setSuggestions(null, false, false);
- return;
- }
-
- setSuggestions(completions, true, true);
- }
- }
-
- /**
- * This translates incoming hard key events in to edit operations on an
- * InputConnection. It is only needed when using the
- * PROCESS_HARD_KEYS option.
- */
- private boolean translateKeyDown(int keyCode, KeyEvent event) {
- mMetaState = MetaKeyKeyListener.handleKeyDown(mMetaState,
- keyCode, event);
- int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(mMetaState));
- mMetaState = MetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
- InputConnection ic = getCurrentInputConnection();
- if (c == 0 || ic == null) {
- return false;
- }
-
- if ((c & KeyCharacterMap.COMBINING_ACCENT) != 0) {
- c = c & KeyCharacterMap.COMBINING_ACCENT_MASK;
- }
-
- if (mComposingWord.length() > 0) {
- char accent = mComposingWord.charAt(mComposingWord.length()-1);
- int composed = KeyEvent.getDeadChar(accent, c);
-
- if (composed != 0) {
- c = composed;
- mComposingWord.setLength(mComposingWord.length()-1);
- }
- }
-
- onKey(c, null);
-
- return true;
- }
-
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- switch (keyCode) {
- case KeyEvent.KEYCODE_BACK:
- // The InputMethodService already takes care of the back
- // key for us, to dismiss the input method if it is shown.
- // However, our keyboard could be showing a pop-up window
- // that back should dismiss, so we first allow it to do that.
- if (event.getRepeatCount() == 0 && mInputView != null) {
- if (mInputView.handleBack()) {
- return true;
- }
- }
- break;
-
- case KeyEvent.KEYCODE_DEL:
- // Special handling of the delete key: if we currently are
- // composing text for the user, we want to modify that instead
- // of let the application to the delete itself.
- if (mComposingText.length() + mComposingWord.length() > 0) {
- onKey(TranslatorKeyboard.KEYCODE_DELETE, null);
- return true;
- }
- break;
-
- case KeyEvent.KEYCODE_ENTER:
- // Let the underlying text editor always handle these.
- return false;
-
- default:
- if (mPredictionOn && translateKeyDown(keyCode, event)) {
- return true;
- }
- }
-
- return super.onKeyDown(keyCode, event);
- }
-
- /**
- * Helper function to commit any text being composed in to the editor.
- */
- private void commitTyped(InputConnection inputConnection) {
- if (mComposingText.length() + mComposingWord.length() > 0) {
- String s = getComposingString();
- inputConnection.commitText(s, s.length());
- mComposingText.setLength(0);
- mComposingWord.setLength(0);
- updateCandidates();
- }
- }
-
- /**
- * Helper to update the shift state of our keyboard based on the initial
- * editor state.
- */
- private void updateShiftKeyState(EditorInfo attr) {
- if (attr != null && mInputView != null &&
- (mLanguagePage1Keyboard == mInputView.getKeyboard() ||
- mLanguagePage2Keyboard == mInputView.getKeyboard())) {
- int caps = 0;
- EditorInfo ei = getCurrentInputEditorInfo();
- if (ei != null && ei.inputType != InputType.TYPE_NULL) {
- caps = getCurrentInputConnection().getCursorCapsMode(attr.inputType);
- }
- mInputView.setShifted(mCapsLock || caps != 0);
- }
- }
-
- /**
- * Helper to send a key down / key up pair to the current editor.
- */
- private void keyDownUp(int keyEventCode) {
- getCurrentInputConnection().sendKeyEvent(
- new KeyEvent(KeyEvent.ACTION_DOWN, keyEventCode));
- getCurrentInputConnection().sendKeyEvent(
- new KeyEvent(KeyEvent.ACTION_UP, keyEventCode));
- }
-
- // Implementation of KeyboardViewListener
- public void onKey(int primaryCode, int[] keyCodes) {
- if (primaryCode == TranslatorKeyboard.KEYCODE_DELETE) {
- handleBackspace();
- } else if (primaryCode == TranslatorKeyboard.KEYCODE_SHIFT) {
- handleShift();
- } else if (primaryCode == TranslatorKeyboard.KEYCODE_SOURCE_LANGUAGE
- && mInputView != null) {
- mTranslator.switchLanguages();
- handleSwitchLanguages();
- } else if (primaryCode < TranslatorKeyboard.KEYCODE_SOURCE_LANGUAGE &&
- primaryCode > TranslatorKeyboard.KEYCODE_SOURCE_LANGUAGE-TranslatorKeyboard.MAX_LANGUAGE_KEYCODES) {
- Language newSource =
- mTranslator.getAvailableLanguages().get(TranslatorKeyboard.KEYCODE_SOURCE_LANGUAGE-primaryCode-1);
- mTranslator.setSourceLanguage(newSource);
- handleChangeSourceLanguage(newSource);
- } else if (primaryCode == TranslatorKeyboard.KEYCODE_TARGET_LANGUAGE) {
- String translation = mTranslator.translate(getComposingString()).first;
- if (translation.startsWith("% ") || translation.startsWith("* ") || translation.startsWith("+ "))
- translation = translation.substring(2);
- getCurrentInputConnection().commitText(translation, 1);
- return;
- } else if (primaryCode < TranslatorKeyboard.KEYCODE_TARGET_LANGUAGE &&
- primaryCode > TranslatorKeyboard.KEYCODE_TARGET_LANGUAGE-TranslatorKeyboard.MAX_LANGUAGE_KEYCODES) {
- Language newTarget =
- mTranslator.getAvailableLanguages().get(TranslatorKeyboard.KEYCODE_TARGET_LANGUAGE-primaryCode-1);
- mTranslator.setTargetLanguage(newTarget);
- handleChangeTargetLanguage(newTarget);
- } else if (primaryCode == TranslatorKeyboard.KEYCODE_MODE_CHANGE &&
- mInputView != null) {
- TranslatorKeyboard current = (TranslatorKeyboard) mInputView.getKeyboard();
- if (current == mSymbolsPage1Keyboard || current == mSymbolsPage2Keyboard) {
- current = mLanguagePage1Keyboard;
- } else {
- current = mSymbolsPage1Keyboard;
- }
- mInputView.setKeyboard(current);
- if (current == mSymbolsPage1Keyboard) {
- current.setShifted(false);
- }
- } else if (primaryCode == TranslatorKeyboard.KEYCODE_PAGE_CHANGE &&
- mInputView != null) {
- TranslatorKeyboard current = (TranslatorKeyboard) mInputView.getKeyboard();
- if (current == mLanguagePage1Keyboard) {
- current = mLanguagePage2Keyboard;
- } else {
- current = mLanguagePage1Keyboard;
- }
- mInputView.setKeyboard(current);
- } else if (primaryCode == 10) {
- if ((mActionId & EditorInfo.IME_FLAG_NO_ENTER_ACTION) == 0)
- getCurrentInputConnection().performEditorAction(mActionId & EditorInfo.IME_MASK_ACTION);
- else
- handleCharacter(primaryCode, keyCodes);
- } else if (primaryCode == ' ') {
- if (mComposingText.length() + mComposingWord.length() == 0)
- getCurrentInputConnection().commitText(" ", 1);
- else if (mComposingWord.length() > 0) {
- mComposingText.append(mComposingWord);
- mComposingText.append(' ');
- mComposingWord.setLength(0);
- getCurrentInputConnection().setComposingText(getComposingString(), 1);
- } else {
- mComposingText.append(' ');
- getCurrentInputConnection().setComposingText(getComposingString(), 1);
- }
- } else {
- handleCharacter(primaryCode, keyCodes);
- }
- }
-
- public void onText(CharSequence text) {
- InputConnection ic = getCurrentInputConnection();
- if (ic == null) return;
- ic.beginBatchEdit();
- if (mComposingText.length() > 0) {
- commitTyped(ic);
- }
- ic.commitText(text, 0);
- ic.endBatchEdit();
- updateShiftKeyState(getCurrentInputEditorInfo());
- }
-
- /**
- * Update the list of available candidates from the current composing
- * text. This will need to be filled in by however you are determining
- * candidates.
- */
- private void updateCandidates() {
- if (!mCompletionOn) {
- if (mComposingWord.length() > 1) {
- mCompletions =
- mTranslator.lookupWordPrefix(mComposingWord.toString());
- setSuggestions(mCompletions, true, true);
- } else {
- setSuggestions(null, false, false);
- }
- }
- }
-
- public void setSuggestions(CompletionInfo[] completions, boolean isCompletions,
- boolean typedWordValid) {
- if (completions != null && completions.length > 0) {
- setCandidatesViewShown(true);
- } else if (isExtractViewShown()) {
- setCandidatesViewShown(true);
- }
- if (mCandidateView != null) {
- mCandidateView.setSuggestions(completions, isCompletions, typedWordValid);
- }
- }
-
- private void handleBackspace() {
- int wordLength = mComposingWord.length();
- int textLength = mComposingText.length();
- if (wordLength > 1) {
- mComposingWord.delete(wordLength - 1, wordLength);
- getCurrentInputConnection().setComposingText(getComposingString(), 1);
- if (mPredictionOn)
- updateCandidates();
- } else if (wordLength > 0) {
- mComposingWord.setLength(0);
- getCurrentInputConnection().setComposingText(getComposingString(), 1);
- updateCandidates();
- } else if (textLength > 0) {
- if (mComposingText.charAt(textLength - 1) == ' ') {
- mComposingText.delete(textLength - 1, textLength);
- getCurrentInputConnection().setComposingText(getComposingString(), 1);
- } else {
- mComposingText.delete(textLength - 1, textLength);
- textLength--;
- int index = mComposingText.lastIndexOf(" ");
- if (index == -1) {
- mComposingWord.append(mComposingText.toString());
- mComposingText.setLength(0);
- } else {
- mComposingWord.append(mComposingText.substring(index+1, textLength));
- mComposingText.delete(index+1, textLength);
- }
- getCurrentInputConnection().setComposingText(getComposingString(), 1);
- }
- updateCandidates();
- } else {
- keyDownUp(KeyEvent.KEYCODE_DEL);
- }
- updateShiftKeyState(getCurrentInputEditorInfo());
- }
-
- private void handleShift() {
- if (mInputView == null) {
- return;
- }
-
- TranslatorKeyboard currentKeyboard = (TranslatorKeyboard) mInputView.getKeyboard();
- if (mLanguagePage1Keyboard == currentKeyboard ||
- mLanguagePage2Keyboard == currentKeyboard) {
- // Alphabet keyboard
- checkToggleCapsLock();
- mInputView.setShifted(mCapsLock || !mInputView.isShifted());
- } else if (currentKeyboard == mSymbolsPage1Keyboard) {
- mSymbolsPage1Keyboard.setShifted(true);
- mInputView.setKeyboard(mSymbolsPage2Keyboard);
- mSymbolsPage2Keyboard.setShifted(true);
- } else if (currentKeyboard == mSymbolsPage2Keyboard) {
- mSymbolsPage2Keyboard.setShifted(false);
- mInputView.setKeyboard(mSymbolsPage1Keyboard);
- mSymbolsPage1Keyboard.setShifted(false);
- }
- }
-
- private String getComposingString() {
- return mComposingText.toString() + mComposingWord.toString();
- }
-
- private void handleCharacter(int primaryCode, int[] keyCodes) {
- if (keyCodes.length > 0 && keyCodes[0] > 0) {
- for (int i = 0; i < keyCodes.length && keyCodes[i] > 0; i++) {
- int code = keyCodes[i];
- if (mInputView.isShifted())
- code = Character.toUpperCase(code);
- mComposingWord.append((char) code);
- }
- } else {
- if (mInputView.isShifted())
- primaryCode = Character.toUpperCase(primaryCode);
- mComposingWord.append((char) primaryCode);
- }
-
- if (primaryCode == 10)
- commitTyped(getCurrentInputConnection());
- else
- getCurrentInputConnection().setComposingText(getComposingString(), 1);
- updateShiftKeyState(getCurrentInputEditorInfo());
-
- if (mPredictionOn) {
- updateCandidates();
- }
- }
-
- private void handleClose() {
- commitTyped(getCurrentInputConnection());
- requestHideSelf(0);
- mInputView.closing();
- }
-
- void handleChangeSourceLanguage(Language newSource) {
- updateLanguageKeyboard(newSource);
- mSymbolsPage1Keyboard.updateLanguageKeyLabels();
- mSymbolsPage2Keyboard.updateLanguageKeyLabels();
- if (mInputView != null) {
- mInputView.setKeyboard(mCurKeyboard);
- }
- }
-
- void handleChangeTargetLanguage(Language newTarget) {
- mLanguagePage1Keyboard.updateLanguageKeyLabels();
- mLanguagePage2Keyboard.updateLanguageKeyLabels();
- mSymbolsPage1Keyboard.updateLanguageKeyLabels();
- mSymbolsPage2Keyboard.updateLanguageKeyLabels();
- if (mInputView != null) {
- mInputView.invalidateAllKeys();
- }
- }
-
- void handleSwitchLanguages() {
- Language newSource = mTranslator.getSourceLanguage();
- updateLanguageKeyboard(newSource);
- mSymbolsPage1Keyboard.updateLanguageKeyLabels();
- mSymbolsPage2Keyboard.updateLanguageKeyLabels();
- if (mInputView != null)
- mInputView.setKeyboard(mCurKeyboard);
- }
-
- private void updateLanguageKeyboard(Language language) {
- TranslatorKeyboard keyboard1 =
- new TranslatorKeyboard(this, language.getKeyboardPage1Resource(), mModeId);
- TranslatorKeyboard keyboard2 =
- new TranslatorKeyboard(this, language.getKeyboardPage2Resource(), mModeId);
- keyboard1.setImeOptions(getResources(), mAttribute.imeOptions);
- keyboard2.setImeOptions(getResources(), mAttribute.imeOptions);
- if (mCurKeyboard == mLanguagePage1Keyboard) {
- mCurKeyboard = keyboard1;
- } else if (mCurKeyboard == mLanguagePage2Keyboard) {
- mCurKeyboard = keyboard2;
- }
- mLanguagePage1Keyboard = keyboard1;
- mLanguagePage2Keyboard = keyboard2;
- }
-
- private void checkToggleCapsLock() {
- long now = System.currentTimeMillis();
- if (mLastShiftTime + 800 > now) {
- mCapsLock = !mCapsLock;
- mLastShiftTime = 0;
- } else {
- mLastShiftTime = now;
- }
- }
-
- public void pickDefaultCandidate() {
- pickSuggestionManually(0);
- }
-
- public void pickSuggestionManually(int index) {
- if (mCompletions != null &&
- index >= 0 && index < mCompletions.length) {
- CompletionInfo ci = mCompletions[index];
-
- if (mCompletionOn)
- getCurrentInputConnection().commitCompletion(ci);
- else {
- mComposingWord.setLength(0);
- mComposingWord.append(ci.getText());
- getCurrentInputConnection().setComposingText(getComposingString(), 1);
- }
-
- if (mCandidateView != null) {
- mCandidateView.clear();
- }
- updateShiftKeyState(getCurrentInputEditorInfo());
- }
- }
-
- public void swipeRight() {
- if (mCompletionOn) {
- pickDefaultCandidate();
- }
- }
-
- public void swipeLeft() {
- handleBackspace();
- }
-
- public void swipeDown() {
- handleClose();
- }
-
- public void swipeUp() {
- }
-
- public void onPress(int primaryCode) {
- }
-
- public void onRelease(int primaryCode) {
- }
-}
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/TranslatorKeyboard.java b/src/ui/android/src/org/grammaticalframework/ui/android/TranslatorKeyboard.java
deleted file mode 100644
index 876f660da..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/TranslatorKeyboard.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import java.util.Locale;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.content.res.XmlResourceParser;
-import android.view.inputmethod.EditorInfo;
-import android.inputmethodservice.Keyboard;
-
-public class TranslatorKeyboard extends Keyboard {
-
- private Key mEnterKey;
- private Key mSourceLanguageKey;
- private Key mTargetLanguageKey;
-
- static final int KEYCODE_PAGE_CHANGE = -10;
- static final int KEYCODE_SOURCE_LANGUAGE = -100;
- static final int KEYCODE_TARGET_LANGUAGE = -200;
- static final int MAX_LANGUAGE_KEYCODES = 99;
-
- private Translator mTranslator;
-
- public TranslatorKeyboard(Context context, int xmlLayoutResId, int modeId) {
- super(context, xmlLayoutResId, modeId);
-
- mTranslator = ((GFTranslator) context.getApplicationContext()).getTranslator();
- updateLanguageKeyLabels();
- }
-
- public void updateLanguageKeyLabels() {
- if (mSourceLanguageKey != null)
- mSourceLanguageKey.label = getLanguageKeyLabel(mTranslator.getSourceLanguage());
-
- if (mTargetLanguageKey != null)
- mTargetLanguageKey.label = getLanguageKeyLabel(mTranslator.getTargetLanguage());
- }
-
- public static String getLanguageKeyLabel(Language lang) {
- if ("cmn-hans-cn".equalsIgnoreCase(lang.getLangCode())) // this one has no ISO code
- return "chi";
- else
- return
- LocaleUtils.parseJavaLocale(lang.getLangCode(), Locale.getDefault())
- .getISO3Language();
- }
-
- @Override
- protected Key createKeyFromXml(Resources res, Row parent, int x, int y,
- XmlResourceParser parser) {
- Key key = new Key(res, parent, x, y, parser);
- if (key.codes[0] == 10) {
- mEnterKey = key;
- } else if (key.codes[0] == KEYCODE_SOURCE_LANGUAGE) {
- mSourceLanguageKey = key;
- } else if (key.codes[0] == KEYCODE_TARGET_LANGUAGE) {
- mTargetLanguageKey = key;
- }
- return key;
- }
-
- /**
- * This looks at the ime options given by the current editor, to set the
- * appropriate label on the keyboard's enter key (if it has one).
- */
- void setImeOptions(Resources res, int options) {
- if (mEnterKey == null) {
- return;
- }
-
- switch (options&(EditorInfo.IME_MASK_ACTION|EditorInfo.IME_FLAG_NO_ENTER_ACTION)) {
- case EditorInfo.IME_ACTION_DONE:
- mEnterKey.iconPreview = null;
- mEnterKey.icon = null;
- mEnterKey.label = res.getText(R.string.label_done_key);
- break;
- case EditorInfo.IME_ACTION_GO:
- mEnterKey.iconPreview = null;
- mEnterKey.icon = null;
- mEnterKey.label = res.getText(R.string.label_go_key);
- break;
- case EditorInfo.IME_ACTION_NEXT:
- mEnterKey.iconPreview = null;
- mEnterKey.icon = null;
- mEnterKey.label = res.getText(R.string.label_next_key);
- break;
- case EditorInfo.IME_ACTION_PREVIOUS:
- mEnterKey.iconPreview = null;
- mEnterKey.icon = null;
- mEnterKey.label = res.getText(R.string.label_previous_key);
- break;
- case EditorInfo.IME_ACTION_SEARCH:
- mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_search);
- mEnterKey.label = null;
- break;
- case EditorInfo.IME_ACTION_SEND:
- mEnterKey.iconPreview = null;
- mEnterKey.icon = null;
- mEnterKey.label = res.getText(R.string.label_send_key);
- break;
- default:
- mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_return);
- mEnterKey.label = null;
- break;
- }
- }
-} \ No newline at end of file
diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/TranslatorKeyboardView.java b/src/ui/android/src/org/grammaticalframework/ui/android/TranslatorKeyboardView.java
deleted file mode 100644
index 0a42eca2d..000000000
--- a/src/ui/android/src/org/grammaticalframework/ui/android/TranslatorKeyboardView.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package org.grammaticalframework.ui.android;
-
-import org.grammaticalframework.ui.android.TranslatorKeyboard;
-
-import android.content.Context;
-import android.graphics.Point;
-import android.inputmethodservice.Keyboard.Key;
-import android.inputmethodservice.KeyboardView;
-import android.util.AttributeSet;
-import android.view.Display;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.WindowManager;
-import android.widget.Button;
-import android.widget.PopupWindow;
-import android.widget.TableLayout;
-import android.widget.TableRow;
-
-public class TranslatorKeyboardView extends KeyboardView {
-
- private Translator mTranslator;
-
- public TranslatorKeyboardView(Context context, AttributeSet attrs) {
- super(context, attrs);
- mTranslator = ((GFTranslator) context.getApplicationContext()).getTranslator();
- }
-
- public TranslatorKeyboardView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- mTranslator = ((GFTranslator) context.getApplicationContext()).getTranslator();
- }
-
- private PopupWindow mLanguagesPopup = null;
- private Key mLanguagesKey = null;
-
- private void showLanguageOptions(Key popupKey) {
- if (mLanguagesPopup == null) {
- LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
- Context.LAYOUT_INFLATER_SERVICE);
- TableLayout popupContainer = (TableLayout)
- inflater.inflate(R.layout.keyboard_languages_options, null);
-
- int index = 0;
- TableRow row = null;
- for (Language lang : mTranslator.getAvailableLanguages()) {
- int col_index = index % 4;
- if (col_index == 0) {
- row = new TableRow(getContext());
- popupContainer.addView(row);
- }
-
- Button item = new Button(getContext());
- item.setText(TranslatorKeyboard.getLanguageKeyLabel(lang));
- item.setTag(index);
- item.setOnClickListener(this);
- row.addView(item, col_index);
- index++;
- }
-
- WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
- Display display = wm.getDefaultDisplay();
- Point size = new Point();
- display.getSize(size);
-
- popupContainer.measure(
- MeasureSpec.makeMeasureSpec(size.x, MeasureSpec.AT_MOST),
- MeasureSpec.makeMeasureSpec(size.y, MeasureSpec.AT_MOST));
-
- mLanguagesPopup = new PopupWindow(getContext());
- mLanguagesPopup.setWidth(popupContainer.getMeasuredWidth());
- mLanguagesPopup.setHeight(popupContainer.getMeasuredHeight());
- mLanguagesPopup.setContentView(popupContainer);
-
- int[] windowOffset = new int[2];
- getLocationInWindow(windowOffset);
- int popupX = popupKey.x + popupKey.width - popupContainer.getMeasuredWidth();
- int popupY = popupKey.y - popupContainer.getMeasuredHeight();
- final int x = popupX + popupContainer.getPaddingRight() + windowOffset[0];
- final int y = popupY + popupContainer.getPaddingBottom() + windowOffset[1];
- mLanguagesPopup.showAtLocation(this, Gravity.NO_GRAVITY, x, y);
-
- View closeButton = popupContainer.findViewById(R.id.closeButton);
- if (closeButton != null) closeButton.setOnClickListener(this);
- }
-
- mLanguagesKey = popupKey;
- }
-
- private void dismissLanguages() {
- if (mLanguagesPopup != null) {
- mLanguagesPopup.dismiss();
- mLanguagesPopup = null;
- mLanguagesKey = null;
- }
- }
-
- @Override
- public void onClick(View v) {
- super.onClick(v);
-
- if (v.getTag() != null) {
- if (mLanguagesKey.codes[0] == TranslatorKeyboard.KEYCODE_SOURCE_LANGUAGE ||
- mLanguagesKey.codes[0] == TranslatorKeyboard.KEYCODE_TARGET_LANGUAGE) {
- int keyCode = mLanguagesKey.codes[0] - ((Integer) v.getTag()) - 1;
- getOnKeyboardActionListener().onKey(keyCode, new int[] {keyCode});
- }
- }
-
- dismissLanguages();
- }
-
- public void closing() {
- super.closing();
- dismissLanguages();
- }
-
- @Override
- protected boolean onLongPress(Key key) {
- if (key.codes[0] == TranslatorKeyboard.KEYCODE_SOURCE_LANGUAGE ||
- key.codes[0] == TranslatorKeyboard.KEYCODE_TARGET_LANGUAGE) {
- showLanguageOptions(key);
- return true;
- } else {
- return super.onLongPress(key);
- }
- }
-}
diff --git a/src/ui/android/src/se/chalmers/phrasebook/backend/Model.java b/src/ui/android/src/se/chalmers/phrasebook/backend/Model.java
deleted file mode 100644
index 8e4b07b21..000000000
--- a/src/ui/android/src/se/chalmers/phrasebook/backend/Model.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package se.chalmers.phrasebook.backend;
-
-import org.w3c.dom.*;
-import org.xml.sax.*;
-import org.w3c.dom.ls.*;
-
-import java.io.*;
-import java.util.*;
-import javax.xml.parsers.*;
-
-import org.grammaticalframework.pgf.Expr;
-import org.grammaticalframework.ui.android.R;
-import org.grammaticalframework.ui.android.GFTranslator;
-import se.chalmers.phrasebook.backend.syntax.*;
-
-public class Model {
- private static Model model;
-
- private List<SyntaxTree> phrases;
- private Map<String,List<SyntaxTree>> groups;
-
- private Model() {
- try {
- DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- InputStream is = GFTranslator.get().getAssets().open("phrases.xml");
- Document document = documentBuilder.parse(is);
- parseSentencesData(document);
- is.close();
- } catch (ParserConfigurationException e) {
- e.printStackTrace();
- } catch (SAXException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- public static Model getInstance() {
- if (model == null) model = getSync();
- return model;
- }
-
- private synchronized static Model getSync() {
- if (model == null) model = new Model();
- return model;
- }
-
- public List<SyntaxTree> getSentences() {
- return phrases;
- }
-
- public List<SyntaxTree> getGroup(String id) {
- return groups.get(id);
- }
-
- private void parseSentencesData(Document document) {
- phrases = new ArrayList<SyntaxTree>();
- groups = new HashMap<String,List<SyntaxTree>>();
- Map<String,SyntaxNode> ids = new HashMap<String,SyntaxNode>();
- List<SyntaxNodeCall> calls = new ArrayList<SyntaxNodeCall>();
-
- NodeList nodesList = document.getDocumentElement().getChildNodes();
- for (int i = 0; i < nodesList.getLength(); i++) {
- Node node = nodesList.item(i);
-
- if (node != null &&
- node.getNodeType() == Node.ELEMENT_NODE &&
- node.getNodeName().equals("sentence")) {
- NamedNodeMap attributes = node.getAttributes();
-
- if (attributes == null)
- continue;
-
- String desc = "";
- if (attributes.getNamedItem("desc") != null) {
- desc = attributes.getNamedItem("desc").getNodeValue();
- }
-
- SyntaxNode[] nodes = constructSyntaxNodeList(node, ids, calls);
- if (nodes.length > 0)
- phrases.add(new SyntaxTree(desc, nodes[0]));
- } else if (node != null &&
- node.getNodeType() == Node.ELEMENT_NODE &&
- node.getNodeName().equals("group")) {
-
- NamedNodeMap attributes = node.getAttributes();
- if (attributes == null)
- continue;
-
- String id = null;
- if (attributes.getNamedItem("id") != null) {
- id = attributes.getNamedItem("id").getNodeValue();
- }
- if (id == null)
- continue;
-
- List<SyntaxTree> group_phrases = new ArrayList<SyntaxTree>();
-
- NodeList nodesList2 = node.getChildNodes();
- for (int j = 0; j < nodesList2.getLength(); j++) {
- node = nodesList2.item(j);
-
- if (node != null &&
- node.getNodeType() == Node.ELEMENT_NODE &&
- node.getNodeName().equals("sentence")) {
- attributes = node.getAttributes();
-
- if (attributes == null)
- continue;
-
- String desc = "";
- if (attributes.getNamedItem("desc") != null) {
- desc = attributes.getNamedItem("desc").getNodeValue();
- }
-
- SyntaxNode[] nodes = constructSyntaxNodeList(node, ids, calls);
- if (nodes.length > 0) {
- SyntaxTree tree = new SyntaxTree(desc, nodes[0]);
- phrases.add(tree);
- group_phrases.add(tree);
- }
- }
- }
-
- groups.put(id, group_phrases);
- } else if (node.getAttributes() != null && node.getAttributes().getNamedItem("id") != null) {
- String id = node.getAttributes().getNamedItem("id").getNodeValue();
- SyntaxNode snode = constructSyntaxNode(node, ids, calls);
- if (snode == null) {
- throw new IllegalArgumentException(outerXml(node));
- }
- ids.put(id,snode);
- }
- }
-
- for (SyntaxNodeCall call : calls) {
- call.bind(ids);
- }
- }
-
- private SyntaxNode constructSyntaxNode(Node node, Map<String,SyntaxNode> ids, List<SyntaxNodeCall> calls) {
- NamedNodeMap attributes = node.getAttributes();
- if (attributes == null)
- return null;
-
- String desc = "";
- if (attributes.getNamedItem("desc") != null) {
- desc = attributes.getNamedItem("desc").getNodeValue();
- }
-
- if (node.getNodeName().equals("function")) {
- String function = attributes.getNamedItem("name").getNodeValue();
- SyntaxNode[] arguments = constructSyntaxNodeList(node, ids, calls);
- return new SyntaxNodeFunction(desc, function, arguments);
- } else if (node.getNodeName().equals("numeral")) {
- return new SyntaxNodeNumeral(desc, 1, 100);
- } else if (node.getNodeName().equals("option")) {
- SyntaxNode[] options = constructSyntaxNodeList(node, ids, calls);
- return new SyntaxNodeOption(desc, options);
- } else if (node.getNodeName().equals("boolean")) {
- SyntaxNode[] options = constructSyntaxNodeList(node, ids, calls);
- return new SyntaxNodeBoolean(desc, options);
- } else if (node.getNodeName().equals("call")) {
- if (attributes.getNamedItem("ref") == null)
- return null;
-
- String ref = attributes.getNamedItem("ref").getNodeValue();
- SyntaxNode[] arguments = constructSyntaxNodeList(node, ids, calls);
- SyntaxNodeCall call = new SyntaxNodeCall(desc, ref, arguments);
- calls.add(call);
- return call;
- } else if (node.getNodeName().equals("argument")) {
- int d = 0;
- if (attributes.getNamedItem("index") != null)
- d = Integer.parseInt(attributes.getNamedItem("index").getNodeValue());
- return new SyntaxNodeArgument(desc, d);
- }
-
- return null;
- }
-
- private SyntaxNode[] constructSyntaxNodeList(Node root, Map<String,SyntaxNode> ids, List<SyntaxNodeCall> calls) {
- NodeList nl = root.getChildNodes();
-
- int index = 0;
- SyntaxNode[] list = new SyntaxNode[nl.getLength()];
- for (int i = 0; i < nl.getLength(); i++) {
- Node node = nl.item(i);
- if (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
- list[index] = constructSyntaxNode(node, ids, calls);
- if (list[index] == null)
- throw new IllegalArgumentException(outerXml(node));
- index++;
- }
- }
- return Arrays.copyOf(list, index);
- }
-
- private String outerXml(Node node) {
- DOMImplementationLS lsImpl = (DOMImplementationLS)node.getOwnerDocument().getImplementation().getFeature("LS", "3.0");
- LSSerializer lsSerializer = lsImpl.createLSSerializer();
- lsSerializer.getDomConfig().setParameter("xml-declaration", false);
- return lsSerializer.writeToString(node);
- }
-}
-
diff --git a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/ChoiceContext.java b/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/ChoiceContext.java
deleted file mode 100644
index 3995ad063..000000000
--- a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/ChoiceContext.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package se.chalmers.phrasebook.backend.syntax;
-
-import java.util.*;
-
-public class ChoiceContext {
- private int pos;
- private List<SyntacticChoice> choices;
- private List<SyntaxNode[]> stack;
-
- public ChoiceContext() {
- this.pos = pos;
- this.choices = new ArrayList<SyntacticChoice>();
- this.stack = new ArrayList<SyntaxNode[]>();
- }
-
- public void reset() {
- pos = 0;
- stack.clear();
- }
-
- public void trim() {
- while (pos < choices.size())
- choices.remove(choices.size()-1);
- }
-
- public int choose(SyntaxNode node) {
- SyntacticChoice choice = null;
-
- if (pos < choices.size()) {
- if (choices.get(pos).getNode().unlink() == node.unlink()) {
- choice = choices.get(pos);
- } else {
- trim();
- }
- }
-
- if (choice == null) {
- choice = new SyntacticChoice(node);
- choices.add(choice);
- }
-
- pos++;
- return choice.getChoice();
- }
-
- public void push(SyntaxNode[] args) {
- stack.add(args);
- }
-
- public SyntaxNode[] pop() {
- return stack.remove(stack.size()-1);
- }
-
- public SyntaxNode getArgument(int i) {
- return stack.get(stack.size()-1)[i];
- }
-
- public List<SyntacticChoice> getChoices() {
- return choices;
- }
-}
diff --git a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntacticChoice.java b/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntacticChoice.java
deleted file mode 100644
index 709893504..000000000
--- a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntacticChoice.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package se.chalmers.phrasebook.backend.syntax;
-
-import java.io.*;
-
-public class SyntacticChoice implements Serializable {
- private int choice;
- private SyntaxNode node;
-
- public SyntacticChoice(SyntaxNode node) {
- this.node = node;
- this.choice = node.getDefaultChoice();
- }
-
- public SyntaxNode getNode() {
- return node;
- }
-
- public int getChoice() {
- return choice;
- }
-
- public void setChoice(int choice) {
- this.choice = choice;
- }
-}
diff --git a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNode.java b/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNode.java
deleted file mode 100644
index 5268e41d4..000000000
--- a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNode.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package se.chalmers.phrasebook.backend.syntax;
-
-import java.io.Serializable;
-import org.grammaticalframework.pgf.Expr;
-
-public class SyntaxNode implements Serializable {
- private String desc;
-
- public SyntaxNode(String desc) {
- this.desc = desc;
- }
-
- public String getDesc() {
- return desc;
- }
-
- public String getAbstractSyntax(ChoiceContext context) {
- return null;
- }
-
- public int getDefaultChoice() {
- return 0;
- }
-
- public SyntaxNode unlink() {
- return this;
- }
-
- @Override
- public String toString() {
- return desc;
- }
-}
diff --git a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeArgument.java b/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeArgument.java
deleted file mode 100644
index 12b13aa4b..000000000
--- a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeArgument.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package se.chalmers.phrasebook.backend.syntax;
-
-public class SyntaxNodeArgument extends SyntaxNode {
- private int index;
-
- public SyntaxNodeArgument(String desc, int index) {
- super(desc);
- this.index = index;
- }
-
- @Override
- public String getAbstractSyntax(ChoiceContext context) {
- return context.getArgument(index).getAbstractSyntax(context);
- }
-}
diff --git a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeBoolean.java b/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeBoolean.java
deleted file mode 100644
index da1e95e04..000000000
--- a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeBoolean.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package se.chalmers.phrasebook.backend.syntax;
-
-public class SyntaxNodeBoolean extends SyntaxNodeOption {
- public SyntaxNodeBoolean(String desc, SyntaxNode[] options) {
- super(desc,options);
- }
-}
diff --git a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeCall.java b/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeCall.java
deleted file mode 100644
index 199c818ae..000000000
--- a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeCall.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package se.chalmers.phrasebook.backend.syntax;
-
-import java.util.*;
-
-public class SyntaxNodeCall extends SyntaxNode {
- private String id;
- private SyntaxNode ref;
- private SyntaxNode[] arguments;
-
- public SyntaxNodeCall(String desc, String id, SyntaxNode[] arguments) {
- super(desc);
- this.id = id;
- this.ref = null;
- this.arguments = arguments;
- }
-
- public String getDesc() {
- String desc = super.getDesc();
- if (desc == null || desc.isEmpty())
- return ref.getDesc();
- return desc;
- }
-
- @Override
- public String getAbstractSyntax(ChoiceContext context) {
- context.push(arguments);
- String res = ref.getAbstractSyntax(context);
- context.pop();
- return res;
- }
-
- @Override
- public SyntaxNode unlink() {
- return ref.unlink();
- }
-
- public String getId() {
- return id;
- }
-
- public SyntaxNode getRef() {
- return ref;
- }
-
- public void bind(Map<String,SyntaxNode> ids) {
- if (ref == null) {
- ref = ids.get(id);
- if (ref == null)
- throw new IllegalArgumentException("Missing reference to "+id);
- }
- }
-}
diff --git a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeFunction.java b/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeFunction.java
deleted file mode 100644
index 2bc6e187d..000000000
--- a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeFunction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package se.chalmers.phrasebook.backend.syntax;
-
-import java.util.*;
-
-public class SyntaxNodeFunction extends SyntaxNode {
- private String function;
- private SyntaxNode[] arguments;
-
- public SyntaxNodeFunction(String desc, String function, SyntaxNode[] arguments) {
- super(desc);
- this.function = function;
- this.arguments = arguments;
- }
-
- public String getFunction() {
- return function;
- }
-
- public SyntaxNode[] getArguments() {
- return arguments;
- }
-
- @Override
- public String getAbstractSyntax(ChoiceContext context) {
- if (arguments == null || arguments.length == 0)
- return function;
-
- StringBuilder builder = new StringBuilder();
- builder.append(function);
- for (SyntaxNode argument : arguments) {
- builder.append(' ');
- builder.append('(');
- builder.append(argument.getAbstractSyntax(context));
- builder.append(')');
- }
-
- return builder.toString();
- }
-}
diff --git a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeNumeral.java b/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeNumeral.java
deleted file mode 100644
index 11a6b4103..000000000
--- a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeNumeral.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package se.chalmers.phrasebook.backend.syntax;
-
-public class SyntaxNodeNumeral extends SyntaxNode {
- private int min;
- private int max;
-
- public SyntaxNodeNumeral(String desc, int min, int max) {
- super(desc);
- this.min = min;
- this.max = max;
- }
-
- public String getAbstractSyntax(ChoiceContext context) {
- return nbrToSyntax(context.choose(this));
- }
-
- @Override
- public int getDefaultChoice() {
- return 1;
- }
-
- public int getMin() {
- return min;
- }
-
- public int getMax() {
- return max;
- }
-
- private String nbrToSyntax(int nbr) throws IllegalArgumentException {
- String syntax = "";
- if(nbr < 1000000 && nbr > 0) {
- if (nbr <=999) {
- syntax = "(num (pot2as3 " + subs1000(nbr) + "))";
- } else if(nbr % 1000 == 0) {
- syntax = "(num (pot3 " + subs1000(nbr/1000) + "))";
- } else if(nbr > 1000 && nbr%1000 != 0) {
- syntax = "(num (pot3plus " + subs1000(nbr/1000) + " " +
- subs1000(nbr%1000) + "))";
- }
- } else {
- throw new IllegalArgumentException("Input must be between 1 and 999999");
- }
- return syntax;
- }
-
- private String subs1000(int nbr) {
- String syntax = "";
- if(nbr < 100) {
- syntax = "(pot1as2 " + subs100(nbr) + ")";
- } else if(nbr % 100 == 0) {
- syntax = "(pot2 " + subs10(nbr/100) + ")";
- } else if(nbr > 100 && nbr%100 != 0) {
- syntax = "(pot2plus " + subs10(nbr/100) + " " + subs100(nbr%100) + ")";
- }
- return syntax;
- }
-
- private String subs100(int nbr) {
- String syntax = "";
- if(nbr < 10) {
- syntax = "(pot0as1 " + subs10(nbr) + ")";
- } else if(nbr == 10 || nbr == 11) {
- syntax = "pot1" + nbr;
- } else if(nbr >= 12 && nbr <= 19) {
- syntax = "(pot1to19 n" + nbr%10 + ")";
- } else if(nbr >= 20 && nbr%10 == 0) {
- syntax = "(pot1 n" + Integer.toString(nbr/10) + ")";
- } else if(nbr%10 != 0) {
- syntax = "(pot1plus n" + nbr/10 + " " + subs10(nbr%10) + ")";
- }
- return syntax;
- }
-
- private String subs10(int nbr) {
- String syntax = "";
- if (nbr == 1) {
- syntax = "pot01";
- } else if (nbr >= 2 && nbr <= 9) {
- syntax = "(pot0 n" + nbr + ")";
- }
- return syntax;
- }
-}
diff --git a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeOption.java b/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeOption.java
deleted file mode 100644
index d7dc4ca83..000000000
--- a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxNodeOption.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package se.chalmers.phrasebook.backend.syntax;
-
-import java.util.*;
-import se.chalmers.phrasebook.backend.*;
-
-public class SyntaxNodeOption extends SyntaxNode {
- private SyntaxNode[] options;
-
- public SyntaxNodeOption(String desc, SyntaxNode[] options) {
- super(desc);
- this.options = options;
- }
-
- public SyntaxNode[] getOptions() {
- return options;
- }
-
- @Override
- public String getAbstractSyntax(ChoiceContext context) {
- return options[context.choose(this)].getAbstractSyntax(context);
- }
-}
diff --git a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxTree.java b/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxTree.java
deleted file mode 100644
index 964f07d0b..000000000
--- a/src/ui/android/src/se/chalmers/phrasebook/backend/syntax/SyntaxTree.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package se.chalmers.phrasebook.backend.syntax;
-
-import java.io.Serializable;
-import org.grammaticalframework.pgf.Expr;
-
-public class SyntaxTree implements Serializable {
- private String desc;
- private SyntaxNode root;
-
- public SyntaxTree(String desc, SyntaxNode root) {
- this.desc = desc;
- this.root = root;
- }
-
- public String getDesc() {
- return desc;
- }
-
- public SyntaxNode getRoot() {
- return root;
- }
-
- public Expr getAbstractSyntax(ChoiceContext choices) {
- Expr expr = Expr.readExpr(root.getAbstractSyntax(choices));
- choices.trim();
- return expr;
- }
-
- @Override
- public String toString() {
- return desc;
- }
-}
diff --git a/src/ui/android/src/se/chalmers/phrasebook/gui/activities/NavigationActivity.java b/src/ui/android/src/se/chalmers/phrasebook/gui/activities/NavigationActivity.java
deleted file mode 100644
index 1dc754380..000000000
--- a/src/ui/android/src/se/chalmers/phrasebook/gui/activities/NavigationActivity.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package se.chalmers.phrasebook.gui.activities;
-
-import android.app.ActionBar;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.graphics.Color;
-import android.graphics.drawable.ColorDrawable;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.app.FragmentTransaction;
-import android.support.v4.content.LocalBroadcastManager;
-import android.support.v4.widget.DrawerLayout;
-
-import org.grammaticalframework.ui.android.R;
-import se.chalmers.phrasebook.backend.Model;
-import se.chalmers.phrasebook.backend.syntax.*;
-import se.chalmers.phrasebook.gui.fragments.PhraseListFragment;
-import se.chalmers.phrasebook.gui.fragments.TranslatorFragment;
-
-public class NavigationActivity extends FragmentActivity {
-
- /**
- * Used to store the last screen title. For use in {@link #restoreActionBar()}.
- */
- private CharSequence mTitle;
- private Fragment mContent;
-
- private Model mModel;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_navigation);
-
- mModel = Model.getInstance();
- mTitle = getTitle();
-
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- transaction.replace(R.id.container, PhraseListFragment.newInstance("Phrasebook"));
- transaction.commit();
- }
-
- public void switchContent(Fragment fragment, String message) {
- mContent = fragment;
-
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- transaction.replace(R.id.container, fragment);
- transaction.addToBackStack(message);
- transaction.commit();
- }
-
- public void restoreActionBar() {
- ActionBar actionBar = getActionBar();
- actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
- actionBar.setDisplayShowTitleEnabled(true);
- actionBar.setTitle(mTitle);
- }
-
- @Override
- public void onBackPressed() {
- if (getSupportFragmentManager().getBackStackEntryCount() > 1) {
- getSupportFragmentManager().popBackStack();
- getSupportFragmentManager().beginTransaction().commit();
- //Switches to the previous entry on the stack to ensure
- //that mContent is preserved
- mContent = getSupportFragmentManager().getFragments()
- .get(getSupportFragmentManager().getFragments().size() - 2);
- } else {
- super.onBackPressed();
- }
- }
-
- public void setToTranslationFragment(SyntaxTree phrase) {
- switchContent(TranslatorFragment.newInstance(phrase), "");
- }
-}
diff --git a/src/ui/android/src/se/chalmers/phrasebook/gui/fragments/PhraseListFragment.java b/src/ui/android/src/se/chalmers/phrasebook/gui/fragments/PhraseListFragment.java
deleted file mode 100644
index 7e3c09ada..000000000
--- a/src/ui/android/src/se/chalmers/phrasebook/gui/fragments/PhraseListFragment.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package se.chalmers.phrasebook.gui.fragments;
-
-import android.os.Bundle;
-
-import java.util.*;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.content.LocalBroadcastManager;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-
-import java.util.ArrayList;
-
-import org.grammaticalframework.ui.android.R;
-import se.chalmers.phrasebook.backend.Model;
-import se.chalmers.phrasebook.backend.syntax.SyntaxTree;
-import se.chalmers.phrasebook.gui.activities.NavigationActivity;
-
-
-/**
- * Created by Björn on 2016-04-25.
- */
-public class PhraseListFragment extends Fragment {
-
- protected Model model;
- private String title;
- private String id;
-
- public static PhraseListFragment newInstance(String title) {
- PhraseListFragment fragment = new PhraseListFragment();
- Bundle args = new Bundle();
- args.putString("title", title);
- fragment.setArguments(args);
- return fragment;
- }
-
- public static PhraseListFragment newInstance(String title, String id) {
- PhraseListFragment fragment = new PhraseListFragment();
- Bundle args = new Bundle();
- args.putString("title", title);
- args.putString("id", id);
- fragment.setArguments(args);
- return fragment;
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- model = Model.getInstance();
- title = getArguments().getString("title");
- id = getArguments().getString("id");
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- View view = inflater.inflate(R.layout.fragment_phrase_list, container, false);
- getActivity().getActionBar().setTitle(title);
-
- final List<SyntaxTree> sentences = (id == null) ? model.getSentences() : model.getGroup(id);
- ArrayAdapter<SyntaxTree> adapter = new ArrayAdapter<SyntaxTree>(getActivity(), R.layout.phrase_list_item, sentences);
-
- final ListView phraseListView = (ListView) view.findViewById(R.id.phrase_listView);
- phraseListView.setAdapter(adapter);
-
- phraseListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView<?> parent, View view, int position, long item_id) {
- SyntaxTree phrase = sentences.get(position);
- getActivity().getActionBar().setTitle(phrase.getDesc());
- ((NavigationActivity) getActivity()).setToTranslationFragment(phrase);
- }
- });
-
- return view;
- }
-}
diff --git a/src/ui/android/src/se/chalmers/phrasebook/gui/fragments/TranslatorFragment.java b/src/ui/android/src/se/chalmers/phrasebook/gui/fragments/TranslatorFragment.java
deleted file mode 100644
index cb5d50841..000000000
--- a/src/ui/android/src/se/chalmers/phrasebook/gui/fragments/TranslatorFragment.java
+++ /dev/null
@@ -1,253 +0,0 @@
-package se.chalmers.phrasebook.gui.fragments;
-
-import java.util.*;
-
-import android.os.Bundle;
-import android.content.Context;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentTransaction;
-import android.view.*;
-import android.widget.*;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.text.method.PasswordTransformationMethod;
-
-import org.grammaticalframework.pgf.Expr;
-import org.grammaticalframework.ui.android.Translator;
-import org.grammaticalframework.ui.android.GFTranslator;
-import org.grammaticalframework.ui.android.TTS;
-import org.grammaticalframework.ui.android.R;
-import se.chalmers.phrasebook.backend.*;
-import se.chalmers.phrasebook.backend.syntax.*;
-
-/**
- * Created by matilda on 04/04/16.
- */
-public class TranslatorFragment extends Fragment {
- protected Model model;
- Translator mTranslator;
- private TTS mTts;
-
- private TextView origin,target;
- private ListView list;
- SyntaxTree phrase;
-
- ChoiceContext mContext;
- ArrayAdapter<SyntacticChoice> mAdapter;
-
- public static TranslatorFragment newInstance(SyntaxTree phrase) {
- TranslatorFragment translatorFragment = new TranslatorFragment();
- Bundle args = new Bundle();
- args.putSerializable("phrase", phrase);
- translatorFragment.setArguments(args);
- return translatorFragment;
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- phrase = (SyntaxTree) getArguments().getSerializable("phrase");
- model = Model.getInstance();
- mTranslator = ((GFTranslator) getContext().getApplicationContext()).getTranslator();
- mTts = new TTS(getActivity());
- mContext = new ChoiceContext();
-
-
- mAdapter =
- new ArrayAdapter<SyntacticChoice>(getActivity(), R.layout.spinner_input_list_item, mContext.getChoices()) {
- LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
- @Override
- public View getView (int position, View convertView, ViewGroup parent) {
- SyntacticChoice choice = mContext.getChoices().get(position);
- View view = null;
- if (choice.getNode() instanceof SyntaxNodeBoolean) {
- view = createCheckBoxInputView(inflater, choice, (SyntaxNodeBoolean) choice.getNode(), parent);
- } else if (choice.getNode() instanceof SyntaxNodeOption) {
- view = createSpinnerInputView(inflater, choice, (SyntaxNodeOption) choice.getNode(), parent);
- } else if (choice.getNode() instanceof SyntaxNodeNumeral) {
- view = createNumeralInputView(inflater, choice, (SyntaxNodeNumeral) choice.getNode(), parent);
- }
- return view;
- }
- };
- }
-
- @Override
- public View onCreateView(final LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.fragment_translator, container, false);
- origin = (TextView) view.findViewById(R.id.origin_phrase);
- target = (TextView) view.findViewById(R.id.target_phrase);
- list = (ListView) view.findViewById(R.id.input_holder);
- list.setAdapter(mAdapter);
-
- ImageView button = (ImageView) view.findViewById(R.id.button3);
- button.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- mTts.speak(mTranslator.getTargetLanguage().getLangCode(), (String) target.getText());
- }
- });
-
- updateSyntax();
- return view;
- }
-
- private View createSpinnerInputView(LayoutInflater inflater, final SyntacticChoice choice, final SyntaxNodeOption options, ViewGroup parent) {
- View view = inflater.inflate(R.layout.spinner_input_list_item, parent, false);
- TextView viewLabel = (TextView) view.findViewById(R.id.text_view_spinner);
- Spinner spinner = (Spinner) view.findViewById(R.id.choice_spinner);
-
- String label = options.getDesc();
- if (label == null || label.isEmpty()) {
- viewLabel.setVisibility(View.GONE);
- } else {
- viewLabel.setText(label);
- }
-
- final ArrayAdapter<SyntaxNode> adapter = new ArrayAdapter<SyntaxNode>(getActivity(), android.R.layout.simple_list_item_1,options.getOptions());
- adapter.setDropDownViewResource(android.R.layout.simple_list_item_1);
- spinner.setAdapter(adapter);
-
- spinner.setSelection(choice.getChoice());
- spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
-
- @Override
- public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
- if (position != choice.getChoice()) {
- choice.setChoice(position);
- updateSyntax();
- }
- }
-
- @Override
- public void onNothingSelected(AdapterView<?> parent) {
- }
- });
-
- return view;
- }
-
- private class NumericKeyBoardTransformationMethod extends PasswordTransformationMethod {
- @Override
- public CharSequence getTransformation(CharSequence source, View view) {
- return source;
- }
- }
-
- private View createNumeralInputView(LayoutInflater inflater, final SyntacticChoice choice, final SyntaxNodeNumeral numeral, ViewGroup parent) {
- View view = inflater.inflate(R.layout.number_input_list_item, parent, false);
- TextView viewLabel = (TextView) view.findViewById(R.id.textView_number);
- final SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekBar);
- final EditText editNumber = (EditText) view.findViewById(R.id.editNumber);
-
- String label = choice.getNode().getDesc();
- if (label == null || label.isEmpty()) {
- viewLabel.setVisibility(View.GONE);
- } else {
- viewLabel.setText(label);
- }
-
- seekBar.setProgress(choice.getChoice());
- editNumber.setText(Integer.toString(choice.getChoice()));
-
- editNumber.setTransformationMethod(new NumericKeyBoardTransformationMethod());
- editNumber.requestFocus();
- seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
- @Override
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- editNumber.setText(Integer.toString(progress+1));
- }
-
- @Override
- public void onStartTrackingTouch(SeekBar seekBar) {
-
- }
-
- @Override
- public void onStopTrackingTouch(SeekBar seekBar) {
- }
- });
-
-
- editNumber.addTextChangedListener(new TextWatcher() {
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
- }
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
-
- }
-
- @Override
- public void afterTextChanged(Editable s) {
- int number;
- boolean update = false;
- try {
- if(editNumber.getText().toString().equals("")) {
- number = numeral.getMin();
- } else {
- number = Integer.parseInt(editNumber.getText().toString());
- if (number < numeral.getMin()) {
- number = numeral.getMin();
- update = true;
- }
- if (number > numeral.getMax()) {
- number = numeral.getMax();
- update = true;
- }
- editNumber.setInputType(0);
- }
- } catch (NumberFormatException e) {
- number = choice.getChoice();
- update = true;
- }
- choice.setChoice(number);
- if (update)
- editNumber.setText(Integer.toString(number));
- seekBar.setProgress(number-numeral.getMin());
- updateSyntax();
- }
- });
-
- return view;
- }
-
- private View createCheckBoxInputView(LayoutInflater inflater, final SyntacticChoice choice, final SyntaxNodeBoolean options, ViewGroup parent) {
- View view = inflater.inflate(R.layout.checkbox_input_list_item, parent, false);
- final CheckBox checkBox = (CheckBox) view.findViewById(R.id.choice_checkbox);
-
- String label = options.getDesc();
- if (label != null && !label.isEmpty()) {
- checkBox.setText(label);
- }
-
- checkBox.setChecked(choice.getChoice() == 1);
- checkBox.setOnClickListener(new View.OnClickListener() {
-
- @Override
- public void onClick(View view) {
- int position = checkBox.isChecked() ? 1 : 0;
- if (position != choice.getChoice()) {
- choice.setChoice(position);
- updateSyntax();
- }
- }
- });
-
- return view;
- }
-
- public void updateSyntax() {
- mContext.reset();
-
- Expr expr = phrase.getAbstractSyntax(mContext);
- origin.setText(mTranslator.linearizeSource(expr));
- target.setText(mTranslator.linearize(expr));
- mAdapter.notifyDataSetChanged();
- }
-}
diff --git a/src/ui/android/topics.txt b/src/ui/android/topics.txt
deleted file mode 100644
index 785d07ba4..000000000
--- a/src/ui/android/topics.txt
+++ /dev/null
@@ -1,951 +0,0 @@
-<afghanistan_PN,topic,country_N>
-<albania_PN,topic,country_N>
-<algeria_PN,topic,country_N>
-<andorra_PN,topic,country_N>
-<angola_PN,topic,country_N>
-<anguilla_PN,topic,country_N>
-<argentina_PN,topic,country_N>
-<australia_PN,topic,country_N>
-<austria_PN,topic,country_N>
-<bahamas_PN,topic,country_N>
-<bahrain_PN,topic,country_N>
-<bangladesh_PN,topic,country_N>
-<barbados_PN,topic,country_N>
-<belgium_PN,topic,country_N>
-<benin_PN,topic,country_N>
-<bermuda_PN,topic,country_N>
-<bhutan_PN,topic,country_N>
-<bolivia_PN,topic,country_N>
-<brazil_PN,topic,country_N>
-<britain_PN,topic,country_N>
-<brunei_PN,topic,country_N>
-<bulgaria_PN,topic,country_N>
-<burma_PN,topic,country_N>
-<burundi_PN,topic,country_N>
-<cambodia_PN,topic,country_N>
-<cameroon_PN,topic,country_N>
-<canada_PN,topic,country_N>
-<chad_PN,topic,country_N>
-<chile_PN,topic,country_N>
-<china_PN,topic,country_N>
-<colombia_PN,topic,country_N>
-<congo_PN,topic,country_N>
-<cuba_PN,topic,country_N>
-<cyprus_PN,topic,country_N>
-<denmark_PN,topic,country_N>
-<djibouti_PN,topic,country_N>
-<ecuador_PN,topic,country_N>
-<egypt_PN,topic,country_N>
-<el_salvador_PN,topic,country_N>
-<eritrea_PN,topic,country_N>
-<ethiopia_PN,topic,country_N>
-<fiji_PN,topic,country_N>
-<finland_PN,topic,country_N>
-<france_PN,topic,country_N>
-<gabon_PN,topic,country_N>
-<gambia_PN,topic,country_N>
-<georgia_PN,topic,country_N>
-<germany_PN,topic,country_N>
-<ghana_PN,topic,country_N>
-<gibraltar_PN,topic,country_N>
-<greece_PN,topic,country_N>
-<grenada_PN,topic,country_N>
-<guatemala_PN,topic,country_N>
-<guinea_PN,topic,country_N>
-<guyana_PN,topic,country_N>
-<haiti_PN,topic,country_N>
-<honduras_PN,topic,country_N>
-<iceland_PN,topic,country_N>
-<india_PN,topic,country_N>
-<indonesia_PN,topic,country_N>
-<iran_PN,topic,country_N>
-<iraq_PN,topic,country_N>
-<ireland_PN,topic,country_N>
-<israel_PN,topic,country_N>
-<italy_PN,topic,country_N>
-<jamaica_PN,topic,country_N>
-<japan_PN,topic,country_N>
-<jordan_PN,topic,country_N>
-<kenya_PN,topic,country_N>
-<kuwait_PN,topic,country_N>
-<lebanon_PN,topic,country_N>
-<liberia_PN,topic,country_N>
-<libya_PN,topic,country_N>
-<malawi_PN,topic,country_N>
-<malaysia_PN,topic,country_N>
-<mali_PN,topic,country_N>
-<malta_PN,topic,country_N>
-<mauritania_PN,topic,country_N>
-<mauritius_PN,topic,country_N>
-<mexico_PN,topic,country_N>
-<mongolia_PN,topic,country_N>
-<montserrat_PN,topic,country_N>
-<morocco_PN,topic,country_N>
-<mozambique_PN,topic,country_N>
-<namibia_PN,topic,country_N>
-<nauru_PN,topic,country_N>
-<nepal_PN,topic,country_N>
-<nicaragua_PN,topic,country_N>
-<niger_PN,topic,country_N>
-<nigeria_PN,topic,country_N>
-<norway_PN,topic,country_N>
-<oman_PN,topic,country_N>
-<pakistan_PN,topic,country_N>
-<palestine_PN,topic,country_N>
-<panama_PN,topic,country_N>
-<paraguay_PN,topic,country_N>
-<peru_PN,topic,country_N>
-<philippines_PN,topic,country_N>
-<poland_PN,topic,country_N>
-<portugal_PN,topic,country_N>
-<qatar_PN,topic,country_N>
-<romania_PN,topic,country_N>
-<russia_PN,topic,country_N>
-<rwanda_PN,topic,country_N>
-<samoa_PN,topic,country_N>
-<senegal_PN,topic,country_N>
-<seychelles_PN,topic,country_N>
-<singapore_PN,topic,country_N>
-<somalia_PN,topic,country_N>
-<spain_PN,topic,country_N>
-<sudan_PN,topic,country_N>
-<swaziland_PN,topic,country_N>
-<sweden_PN,topic,country_N>
-<switzerland_PN,topic,country_N>
-<syria_PN,topic,country_N>
-<taiwan_PN,topic,country_N>
-<tanzania_PN,topic,country_N>
-<thailand_PN,topic,country_N>
-<togo_PN,topic,country_N>
-<tonga_PN,topic,country_N>
-<tunisia_PN,topic,country_N>
-<turkey_PN,topic,country_N>
-<uganda_PN,topic,country_N>
-<uruguay_PN,topic,country_N>
-<venezuela_PN,topic,country_N>
-<vietnam_PN,topic,country_N>
-<yemen_PN,topic,country_N>
-<zambia_PN,topic,country_N>
-<zimbabwe_PN,topic,country_N>
-<europe_PN,topic,continent_N>
-<africa_PN,topic,continent_N>
-<mercury_PN,topic,planet_N>
-<venus_PN,topic,planet_N>
-<mars_PN,topic,planet_N>
-<earth_N,topic,planet_N>
-<jupiter_PN,topic,planet_N>
-<saturn_PN,topic,planet_N>
-<uranus_PN,topic,planet_N>
-<neptune_PN,topic,planet_N>
-<pluto_PN,topic,planet_N>
-<albania_PN,continent,europe_PN>
-<andorra_PN,continent,europe_PN>
-<austria_PN,continent,europe_PN>
-<belgium_PN,continent,europe_PN>
-<britain_PN,continent,europe_PN>
-<bulgaria_PN,continent,europe_PN>
-<denmark_PN,continent,europe_PN>
-<finland_PN,continent,europe_PN>
-<france_PN,continent,europe_PN>
-<germany_PN,continent,europe_PN>
-<gibraltar_PN,continent,europe_PN>
-<greece_PN,continent,europe_PN>
-<ireland_PN,continent,europe_PN>
-<italy_PN,continent,europe_PN>
-<malta_PN,continent,europe_PN>
-<norway_PN,continent,europe_PN>
-<poland_PN,continent,europe_PN>
-<portugal_PN,continent,europe_PN>
-<romania_PN,continent,europe_PN>
-<russia_PN,continent,europe_PN>
-<spain_PN,continent,europe_PN>
-<sweden_PN,continent,europe_PN>
-<switzerland_PN,continent,europe_PN>
-<turkey_PN,continent,europe_PN>
-<afghanistan_PN,countryAdjective,afghan_A>
-<albania_PN,countryAdjective,albanian_A>
-<algeria_PN,countryAdjective,algerian_A>
-<andorra_PN,countryAdjective,andorran_A>
-<angola_PN,countryAdjective,angolan_A>
-<anguilla_PN,countryAdjective,anguillan_A>
-<argentina_PN,countryAdjective,argentine_PN>
-<australia_PN,countryAdjective,australian_A>
-<austria_PN,countryAdjective,austrian_A>
-<bahamas_PN,countryAdjective,bahamian_A>
-<bahrain_PN,countryAdjective,bahraini_A>
-<bangladesh_PN,countryAdjective,bangladeshi_A>
-<barbados_PN,countryAdjective,barbadian_A>
-<belgium_PN,countryAdjective,belgian_A>
-<benin_PN,countryAdjective,beninese_A>
-<bermuda_PN,countryAdjective,bermudan_A>
-<bhutan_PN,countryAdjective,bhutani_A>
-<bolivia_PN,countryAdjective,bolivian_A>
-<brazil_PN,countryAdjective,brazilian_A>
-<britain_PN,countryAdjective,british_A>
-<brunei_PN,countryAdjective,bruneian_A>
-<bulgaria_PN,countryAdjective,bulgarian_A>
-<burma_PN,countryAdjective,burmese_A>
-<burundi_PN,countryAdjective,burundian_A>
-<cambodia_PN,countryAdjective,cambodian_A>
-<cameroon_PN,countryAdjective,cameroonian_A>
-<canada_PN,countryAdjective,canadian_A>
-<chad_PN,countryAdjective,chadian_A>
-<chile_PN,countryAdjective,chilean_A>
-<china_PN,countryAdjective,chinese_A>
-<colombia_PN,countryAdjective,colombian_A>
-<congo_PN,countryAdjective,congolese_A>
-<cuba_PN,countryAdjective,cuban_A>
-<cyprus_PN,countryAdjective,cypriot_A>
-<denmark_PN,countryAdjective,danish_A>
-<djibouti_PN,countryAdjective,djiboutian_A>
-<ecuador_PN,countryAdjective,ecuadorian_A>
-<egypt_PN,countryAdjective,egyptian_A>
-<el_salvador_PN,countryAdjective,salvadorean_A>
-<england_PN,countryAdjective,english_A>
-<eritrea_PN,countryAdjective,eritrean_A>
-<ethiopia_PN,countryAdjective,ethiopian_A>
-<europe_PN,countryAdjective,european_A>
-<fiji_PN,countryAdjective,fijian_A>
-<finland_PN,countryAdjective,finnish_A>
-<france_PN,countryAdjective,french_A>
-<gabon_PN,countryAdjective,gabonese_A>
-<gambia_PN,countryAdjective,gambian_A>
-<georgia_PN,countryAdjective,georgian_A>
-<germany_PN,countryAdjective,german_A>
-<ghana_PN,countryAdjective,ghanaian_A>
-<gibraltar_PN,countryAdjective,gibraltarian_A>
-<greece_PN,countryAdjective,greek_A>
-<grenada_PN,countryAdjective,grenadian_A>
-<guatemala_PN,countryAdjective,guatemalan_A>
-<guinea_PN,countryAdjective,guinean_A>
-<guyana_PN,countryAdjective,guyanese_A>
-<haiti_PN,countryAdjective,haitian_A>
-<honduras_PN,countryAdjective,honduran_A>
-<iceland_PN,countryAdjective,icelandic_A>
-<india_PN,countryAdjective,indian_A>
-<indonesia_PN,countryAdjective,indonesian_A>
-<iran_PN,countryAdjective,iranian_A>
-<iraq_PN,countryAdjective,iraqi_A>
-<ireland_PN,countryAdjective,irish_A>
-<israel_PN,countryAdjective,israeli_A>
-<italy_PN,countryAdjective,italian_A>
-<jamaica_PN,countryAdjective,jamaican_A>
-<japan_PN,countryAdjective,japanese_A>
-<jordan_PN,countryAdjective,jordanian_A>
-<kenya_PN,countryAdjective,kenyan_A>
-<kuwait_PN,countryAdjective,kuwaiti_A>
-<lebanon_PN,countryAdjective,lebanese_A>
-<liberia_PN,countryAdjective,liberian_A>
-<libya_PN,countryAdjective,libyan_A>
-<malawi_PN,countryAdjective,malawian_A>
-<malaysia_PN,countryAdjective,malaysian_A>
-<mali_PN,countryAdjective,malian_A>
-<malta_PN,countryAdjective,maltese_A>
-<mauritania_PN,countryAdjective,mauritanian_A>
-<mauritius_PN,countryAdjective,mauritian_A>
-<mexico_PN,countryAdjective,mexican_A>
-<mongolia_PN,countryAdjective,mongolian_A>
-<montserrat_PN,countryAdjective,montserratian_A>
-<morocco_PN,countryAdjective,moroccan_A>
-<mozambique_PN,countryAdjective,mozambican_A>
-<namibia_PN,countryAdjective,namibian_A>
-<nauru_PN,countryAdjective,nauruan_A>
-<nepal_PN,countryAdjective,nepalese_A>
-<nicaragua_PN,countryAdjective,nicaraguan_A>
-<niger_PN,countryAdjective,nigerien_A>
-<nigeria_PN,countryAdjective,nigerian_A>
-<norway_PN,countryAdjective,norwegian_A>
-<oman_PN,countryAdjective,omani_A>
-<pakistan_PN,countryAdjective,pakistani_A>
-<palestine_PN,countryAdjective,palestinian_A>
-<panama_PN,countryAdjective,panamanian_A>
-<paraguay_PN,countryAdjective,paraguayan_A>
-<peru_PN,countryAdjective,peruvian_A>
-<philippines_PN,countryAdjective,philippine_A>
-<poland_PN,countryAdjective,polish_A>
-<portugal_PN,countryAdjective,portuguese_A>
-<qatar_PN,countryAdjective,qatari_A>
-<romania_PN,countryAdjective,romanian_A>
-<russia_PN,countryAdjective,russian_A>
-<rwanda_PN,countryAdjective,rwandan_A>
-<samoa_PN,countryAdjective,samoan_A>
-<scotland_PN,countryAdjective,scottish_A>
-<senegal_PN,countryAdjective,senegalese_A>
-<seychelles_PN,countryAdjective,seychellois_A>
-<singapore_PN,countryAdjective,singaporean_A>
-<somalia_PN,countryAdjective,somali_A>
-<spain_PN,countryAdjective,spanish_A>
-<sudan_PN,countryAdjective,sudanese_A>
-<swaziland_PN,countryAdjective,swazi_A>
-<sweden_PN,countryAdjective,swedish_A>
-<switzerland_PN,countryAdjective,swiss_A>
-<syria_PN,countryAdjective,syrian_A>
-<taiwan_PN,countryAdjective,taiwanese_A>
-<tanzania_PN,countryAdjective,tanzanian_A>
-<thailand_PN,countryAdjective,thai_A>
-<togo_PN,countryAdjective,togolese_A>
-<tonga_PN,countryAdjective,tongan_A>
-<tunisia_PN,countryAdjective,tunisian_A>
-<turkey_PN,countryAdjective,turkish_A>
-<uganda_PN,countryAdjective,ugandan_A>
-<uruguay_PN,countryAdjective,uruguayan_A>
-<venezuela_PN,countryAdjective,venezuelan_A>
-<vietnam_PN,countryAdjective,vietnamese_A>
-<yemen_PN,countryAdjective,yemeni_A>
-<zambia_PN,countryAdjective,zambian_A>
-<zimbabwe_PN,countryAdjective,zimbabwean_A>
-<afghani_N,topic,currency_N>
-<dollar_N,topic,currency_N>
-<euro_N,topic,currency_N>
-<franc_N,topic,currency_N>
-<lev_N,topic,currency_N>
-<pound_2_N,topic,currency_N>
-<rouble_N,topic,currency_N>
-<rupee_N,topic,currency_N>
-<leu_N,topic,currency_N>
-<yuan_N,topic,currency_N>
-<zloty_N,topic,currency_N>
-<austral_N,topic,currency_N>
-<baht_N,topic,currency_N>
-<balboa_N,topic,currency_N>
-<birr_N,topic,currency_N>
-<bolivar_N,topic,currency_N>
-<cedi_N,topic,currency_N>
-<dalasi_N,topic,currency_N>
-<dinar_N,topic,currency_N>
-<dong_N,topic,currency_N>
-<drachma_N,topic,currency_N>
-<escudo_N,topic,currency_N>
-<forint_N,topic,currency_N>
-<krona_N,topic,currency_N>
-<krone_N,topic,currency_N>
-<gourde_N,topic,currency_N>
-<gulden_N,topic,currency_N>
-<inti_N,topic,currency_N>
-<kip_2_N,topic,currency_N>
-<kwacha_N,topic,currency_N>
-<kwanza_N,topic,currency_N>
-<kyat_N,topic,currency_N>
-<lek_N,topic,currency_N>
-<lempira_N,topic,currency_N>
-<lilangeni_N,topic,currency_N>
-<lira_N,topic,currency_N>
-<loti_N,topic,currency_N>
-<markka_N,topic,currency_N>
-<metical_N,topic,currency_N>
-<naira_N,topic,currency_N>
-<ngultrum_N,topic,currency_N>
-<ouguiya_N,topic,currency_N>
-<paanga_N,topic,currency_N>
-<pataca_N,topic,currency_N>
-<peseta_N,topic,currency_N>
-<boliviano_N,topic,currency_N>
-<cordoba_N,topic,currency_N>
-<peso_N,topic,currency_N>
-<pula_N,topic,currency_N>
-<quetzal_N,topic,currency_N>
-<riel_N,topic,currency_N>
-<ringgit_N,topic,currency_N>
-<dram_N,topic,currency_N>
-<manat_N,topic,currency_N>
-<rubel_N,topic,currency_N>
-<kroon_N,topic,currency_N>
-<lari_N,topic,currency_N>
-<tenge_N,topic,currency_N>
-<lats_N,topic,currency_N>
-<litas_N,topic,currency_N>
-<som_N,topic,currency_N>
-<ruble_N,topic,currency_N>
-<hryvnia_N,topic,currency_N>
-<rupiah_N,topic,currency_N>
-<schilling_N,topic,currency_N>
-<shekel_N,topic,currency_N>
-<shilling_N,topic,currency_N>
-<sucre_N,topic,currency_N>
-<taka_N,topic,currency_N>
-<tugrik_N,topic,currency_N>
-<yen_N,topic,currency_N>
-<zaire_N,topic,currency_N>
-<real_2_N,topic,currency_N>
-<austral_N,currencyUse,argentina_PN>
-<baht_N,currencyUse,thailand_PN>
-<satang_N,fractionCurrency,baht_N>
-<balboa_N,currencyUse,panama_PN>
-<birr_N,currencyUse,ethiopia_PN>
-<bolivar_N,currencyUse,venezuela_PN>
-<centimo_N,fractionCurrency,bolivar_N>
-<cedi_N,currencyUse,ghana_PN>
-<pesewa_N,fractionCurrency,cedi_N>
-<dalasi_N,currencyUse,gambia_PN>
-<butut_N,fractionCurrency,dalasi_N>
-<dinar_N,currencyUse,algeria_PN>
-<dinar_N,currencyUse,bahrain_PN>
-<dinar_N,currencyUse,jordan_PN>
-<dinar_N,currencyUse,kuwait_PN>
-<dinar_N,currencyUse,libya_PN>
-<dinar_N,currencyUse,tunisia_PN>
-<dinar_N,currencyUse,morocco_PN>
-<dong_N,currencyUse,vietnam_PN>
-<hao_N,fractionCurrency,dong_N>
-<drachma_N,currencyUse,greece_N>
-<lepton_1_N,fractionCurrency,drachma_N>
-<escudo_N,currencyUse,portugal_N>
-<forint_N,currencyUse,hungary_N>
-<filler_N,fractionCurrency,forint_N>
-<dollar_N,currencyUse,australia_PN>
-<dollar_N,currencyUse,bahamas_PN>
-<dollar_N,currencyUse,barbados_PN>
-<dollar_N,currencyUse,bermuda_PN>
-<dollar_N,currencyUse,brunei_PN>
-<dollar_N,currencyUse,canada_PN>
-<dollar_N,currencyUse,fiji_PN>
-<dollar_N,currencyUse,grenada_PN>
-<dollar_N,currencyUse,guyana_PN>
-<dollar_N,currencyUse,hong_kong_PN>
-<dollar_N,currencyUse,jamaica_PN>
-<dollar_N,currencyUse,liberia_PN>
-<dollar_N,currencyUse,singapore_PN>
-<dollar_N,currencyUse,taiwan_PN>
-<dollar_N,currencyUse,trinidad_PN>
-<dollar_N,currencyUse,us_PN>
-<dollar_N,currencyUse,zimbabwe_PN>
-<franc_N,currencyUse,belgium_PN>
-<franc_N,currencyUse,benin_PN>
-<franc_N,currencyUse,burundi_PN>
-<franc_N,currencyUse,cameroon_PN>
-<franc_N,currencyUse,chad_PN>
-<franc_N,currencyUse,congo_PN>
-<franc_N,currencyUse,djibouti_PN>
-<franc_N,currencyUse,france_PN>
-<franc_N,currencyUse,gabon_PN>
-<franc_N,currencyUse,luxembourg_PN>
-<franc_N,currencyUse,madagascar_PN>
-<franc_N,currencyUse,mali_PN>
-<franc_N,currencyUse,niger_PN>
-<franc_N,currencyUse,rwanda_PN>
-<franc_N,currencyUse,senegal_PN>
-<franc_N,currencyUse,switzerland_PN>
-<franc_N,currencyUse,togo_PN>
-<franc_N,currencyUse,guinea_PN>
-<lev_N,currencyUse,bulgaria_PN>
-<stotinka_N,fractionCurrency,lev_N>
-<krona_N,currencyUse,sweden_PN>
-<krone_N,currencyUse,norway_PN>
-<krone_N,currencyUse,danmark_PN>
-<pound_2_N,currencyUse,britain_PN>
-<rouble_N,currencyUse,russia_PN>
-<rupee_N,currencyUse,india_PN>
-<leu_N,currencyUse,romania_PN>
-<yuan_N,currencyUse,china_PN>
-<zloty_N,currencyUse,poland_PN>
-<gourde_N,currencyUse,haiti_PN>
-<guarani_N,currencyUse,paraguay_PN>
-<centimo_N,fractionCurrency,guarani_N>
-<gulden_N,currencyUse,netherland_PN>
-<gulden_N,currencyUse,suriname_PN>
-<inti_N,currencyUse,peru_PN>
-<kip_2_N,currencyUse,laos_PN>
-<at_N,fractionCurrency,kip_2_N>
-<haler_N,fractionCurrency,koruna_N>
-<krona_N,currencyUse,iceland_PN>
-<kwacha_N,currencyUse,malawi_PN>
-<tambala_N,fractionCurrency,kwacha_N>
-<kwacha_N,currencyUse,zambia_PN>
-<kwanza_N,currencyUse,angola_PN>
-<lwei_N,fractionCurrency,kwanza_N>
-<kyat_N,currencyUse,myanmar_PN>
-<pya_N,fractionCurrency,kyat_N>
-<lek_N,currencyUse,albania_PN>
-<qindarka_N,fractionCurrency,lek_N>
-<lempira_N,currencyUse,honduras_N>
-<ban_N,fractionCurrency,leu_N>
-<lilangeni_N,currencyUse,swaziland_PN>
-<lira_N,currencyUse,italy_PN>
-<lira_N,currencyUse,turkey_PN>
-<loti_N,currencyUse,lesotho_PN>
-<sente_N,fractionCurrency,lesotho_PN>
-<markka_N,currencyUse,finland_PN>
-<metical_N,currencyUse,mozambique_PN>
-<naira_N,currencyUse,nigeria_PN>
-<kobo_N,fractionCurrency,naira_N>
-<ngultrum_N,currencyUse,bhutan_PN>
-<chetrum_N,fractionCurrency,ngultrum_N>
-<ouguiya_N,currencyUse,mauritania_PN>
-<khoum_N,fractionCurrency,ouguiya_PN>
-<paanga_N,currencyUse,tonga_PN>
-<seniti_N,fractionCurrency,paanga_N>
-<pataca_N,currencyUse,macao_N>
-<avo_N,fractionCurrency,pataca_N>
-<peseta_N,currencyUse,spain_PN>
-<boliviano_N,currencyUse,bolivia_PN>
-<cordoba_N,currencyUse,nicaragua_PN>
-<peso_N,currencyUse,chile_PN>
-<peso_N,currencyUse,colombia_PN>
-<peso_N,currencyUse,cuba_PN>
-<peso_N,currencyUse,mexico_PN>
-<peso_N,currencyUse,philippines_PN>
-<peso_N,currencyUse,uruguay_PN>
-<pound_2_N,currencyUse,cyprus_PN>
-<pound_2_N,currencyUse,egypt_PN>
-<pound_2_N,currencyUse,ireland_PN>
-<pound_2_N,currencyUse,lebanon_PN>
-<lira_N,currencyUse,malta_PN>
-<pound_2_N,currencyUse,sudan_PN>
-<pound_2_N,currencyUse,syria_PN>
-<pula_N,currencyUse,botswana_PN>
-<thebe_N,fractionCurrency,pula_N>
-<quetzal_N,currencyUse,guatemala_PN>
-<dinar_N,currencyUse,iran_PN>
-<riel_N,currencyUse,cambodia_PN>
-<ringgit_N,currencyUse,malaysia_PN>
-<kopek_N,fractionCurrency,ruble_N>
-<dram_N,currencyUse,armenia_PN>
-<manat_N,currencyUse,azerbaijan_PN>
-<rubel_N,currencyUse,belarus_PN>
-<kroon_N,currencyUse,estonia_PN>
-<lari_N,currencyUse,georgia_PN>
-<tenge_N,currencyUse,kazakhstan_PN>
-<lats_N,currencyUse,latvia_PN>
-<litas_N,currencyUse,lithuania_PN>
-<som_N,currencyUse,kyrgyzstan_PN>
-<leu_N,currencyUse,moldova_PN>
-<ruble_N,currencyUse,tajikistan_PN>
-<tanga_N,fractionCurrency,ruble_N>
-<manat_N,currencyUse,turkmenistan_PN>
-<hryvnia_N,currencyUse,ukraine_PN>
-<som_N,currencyUse,uzbekistan_PN>
-<rupee_N,currencyUse,pakistan_PN>
-<rupee_N,currencyUse,mauritius_PN>
-<rupee_N,currencyUse,nepal_PN>
-<rupee_N,currencyUse,seychelles_PN>
-<rupee_N,currencyUse,sri_lanka_PN>
-<rupiah_N,currencyUse,indonesia_PN>
-<schilling_N,currencyUse,austria_PN>
-<shekel_N,currencyUse,israel_PN>
-<shilling_N,currencyUse,kenya_PN>
-<shilling_N,currencyUse,somalia_PN>
-<shilling_N,currencyUse,tanzania_PN>
-<shilling_N,currencyUse,uganda_PN>
-<sucre_N,currencyUse,ecuador_PN>
-<taka_N,currencyUse,bangladesh_PN>
-<tugrik_N,currencyUse,mongolia_PN>
-<yen_N,currencyUse,japan_PN>
-<zaire_N,currencyUse,zaire_PN>
-<real_2_N,currencyUse,brazil_PN>
-<january_Month,topic,month_N>
-<february_Month,topic,month_N>
-<march_Month,topic,month_N>
-<april_Month,topic,month_N>
-<may_Month,topic,month_N>
-<june_Month,topic,month_N>
-<july_Month,topic,month_N>
-<august_Month,topic,month_N>
-<september_Month,topic,month_N>
-<october_Month,topic,month_N>
-<november_Month,topic,month_N>
-<december_Month,topic,month_N>
-<monday_Weekday,topic,PartNP (UseN day_N) (DetCN (DetQuant DefArt NumSg) (UseN week_N))>
-<tuesday_Weekday,topic,PartNP (UseN day_N) (DetCN (DetQuant DefArt NumSg) (UseN week_N))>
-<wednesday_Weekday,topic,PartNP (UseN day_N) (DetCN (DetQuant DefArt NumSg) (UseN week_N))>
-<thursday_Weekday,topic,PartNP (UseN day_N) (DetCN (DetQuant DefArt NumSg) (UseN week_N))>
-<friday_Weekday,topic,PartNP (UseN day_N) (DetCN (DetQuant DefArt NumSg) (UseN week_N))>
-<saturday_Weekday,topic,PartNP (UseN day_N) (DetCN (DetQuant DefArt NumSg) (UseN week_N))>
-<sunday_Weekday,topic,PartNP (UseN day_N) (DetCN (DetQuant DefArt NumSg) (UseN week_N))>
-<summer_N,topic,season_N>
-<autumn_N,topic,season_N>
-<winter_N,topic,season_N>
-<spring_1_N,topic,season_N>
-<beer_N,topic,drink_N>
-<ale_N,topic,drink_N>
-<bread_N,topic,food_N>
-<cheese_N,topic,food_N>
-<chicken_N,topic,food_N>
-<chicken_N,topic,animal_N>
-<coffee_N,topic,drink_N>
-<fish_N,topic,food_N>
-<meat_N,topic,food_N>
-<milk_N,topic,drink_N>
-<pizza_N,topic,food_N>
-<salt_N,topic,food_N>
-<salt_N,topic,spice_N>
-<tea_N,topic,drink_N>
-<water_N,topic,drink_N>
-<wine_N,topic,drink_N>
-<i_Pron,topic,people_N>
-<iFem_Pron,topic,people_N>
-<youSg_Pron,topic,people_N>
-<youSgFem_Pron,topic,people_N>
-<youPol_Pron,topic,people_N>
-<youPolFem_Pron,topic,people_N>
-<he_Pron,topic,people_N>
-<she_Pron,topic,people_N>
-<we_Pron,topic,people_N>
-<weFem_Pron,topic,people_N>
-<youPl_Pron,topic,people_N>
-<youPlFem_Pron,topic,people_N>
-<they_Pron,topic,people_N>
-<theyFem_Pron,topic,people_N>
-<i_Pron,topic,pronoun_N>
-<iFem_Pron,topic,pronoun_N>
-<youSg_Pron,topic,pronoun_N>
-<youSgFem_Pron,topic,pronoun_N>
-<youPol_Pron,topic,pronoun_N>
-<youPolFem_Pron,topic,pronoun_N>
-<he_Pron,topic,pronoun_N>
-<she_Pron,topic,pronoun_N>
-<we_Pron,topic,pronoun_N>
-<weFem_Pron,topic,pronoun_N>
-<youPl_Pron,topic,pronoun_N>
-<youPlFem_Pron,topic,pronoun_N>
-<they_Pron,topic,pronoun_N>
-<theyFem_Pron,topic,pronoun_N>
-<wife_N,topic,people_N>
-<husband_N,topic,people_N>
-<daughter_N,topic,people_N>
-<son_N,topic,people_N>
-<child_N,topic,people_N>
-<wife_N,topic,family_N>
-<husband_N,topic,family_N>
-<daughter_N,topic,family_N>
-<son_N,topic,family_N>
-<child_N,topic,family_N>
-<afrikaans_Language,topic,language_N>
-<amharic_Language,topic,language_N>
-<arabic_Language,topic,language_N>
-<bulgarian_Language,topic,language_N>
-<catalan_Language,topic,language_N>
-<chinese_Language,topic,language_N>
-<danish_Language,topic,language_N>
-<dutch_Language,topic,language_N>
-<english_Language,topic,language_N>
-<estonian_Language,topic,language_N>
-<finnish_Language,topic,language_N>
-<french_Language,topic,language_N>
-<german_Language,topic,language_N>
-<greek_Language,topic,language_N>
-<hebrew_Language,topic,language_N>
-<hindi_Language,topic,language_N>
-<japanese_Language,topic,language_N>
-<italian_Language,topic,language_N>
-<latin_Language,topic,language_N>
-<latvian_Language,topic,language_N>
-<maltese_Language,topic,language_N>
-<nepali_Language,topic,language_N>
-<norwegian_Language,topic,language_N>
-<persian_Language,topic,language_N>
-<polish_Language,topic,language_N>
-<punjabi_Language,topic,language_N>
-<romanian_Language,topic,language_N>
-<russian_Language,topic,language_N>
-<sindhi_Language,topic,language_N>
-<spanish_Language,topic,language_N>
-<swahili_Language,topic,language_N>
-<swedish_Language,topic,language_N>
-<thai_Language,topic,language_N>
-<turkish_Language,topic,language_N>
-<urdu_Language,topic,language_N>
-<airport_N,topic,place_N>
-<bank_2_N,topic,place_N>
-<bar_1_N,topic,place_N>
-<cafeteria_N,topic,place_N>
-<centre_N,topic,place_N>
-<church_N,topic,place_N>
-<cinema_N,topic,place_N>
-<disco_2_N,topic,place_N>
-<hospital_N,topic,place_N>
-<hotel_N,topic,place_N>
-<museum_N,topic,place_N>
-<park_N,topic,place_N>
-<pharmacy_2_N,topic,place_N>
-<pub_N,topic,place_N>
-<restaurant_N,topic,place_N>
-<school_1_N,topic,place_N>
-<shop_N,topic,place_N>
-<station_2_N,topic,place_N>
-<supermarket_N,topic,place_N>
-<theatre_N,topic,place_N>
-<toilet_N,topic,place_N>
-<university_N,topic,place_N>
-<zoo_N,topic,place_N>
-<ackee_N,topic,fruit_N>
-<anjou_N,topic,fruit_N>
-<apple_N,topic,fruit_N>
-<avocado_N,topic,fruit_N>
-<bartlett_N,topic,fruit_N>
-<berry_N,topic,fruit_N>
-<blackberry_N,topic,fruit_N>
-<bosc_N,topic,fruit_N>
-<casaba_N,topic,fruit_N>
-<citron_N,topic,fruit_N>
-<citrus_N,topic,fruit_N>
-<currant_N,topic,fruit_N>
-<damson_N,topic,fruit_N>
-<date_7_N,topic,fruit_N>
-<genipap_N,topic,fruit_N>
-<grape_N,topic,fruit_N>
-<greengage_N,topic,fruit_N>
-<honeydew_N,topic,fruit_N>
-<lanseh_N,topic,fruit_N>
-<lemon_N,topic,fruit_N>
-<lychee_N,topic,fruit_N>
-<melon_N,topic,fruit_N>
-<orange_1_N,topic,fruit_N>
-<pear_N,topic,fruit_N>
-<pearmain_N,topic,fruit_N>
-<pippin_N,topic,fruit_N>
-<prune_N,topic,fruit_N>
-<raisin_N,topic,fruit_N>
-<ribier_N,topic,fruit_N>
-<saskatoon_N,topic,fruit_N>
-<scuppernong_N,topic,fruit_N>
-<seckel_N,topic,fruit_N>
-<sorb_N,topic,fruit_N>
-<strawberry_N,topic,fruit_N>
-<sultana_N,topic,fruit_N>
-<peach_N,topic,fruit_N>
-<raspberry_N,topic,fruit_N>
-<mandarin_N,topic,fruit_N>
-<banana_N,topic,fruit_N>
-<crab_apple_N,topic,fruit_N>
-<bilberry_N,topic,fruit_N>
-<huckleberry_N,topic,fruit_N>
-<blueberry_N,topic,fruit_N>
-<wintergreen_N,topic,fruit_N>
-<teaberry_N,topic,fruit_N>
-<cranberry_N,topic,fruit_N>
-<lingonberry_N,topic,fruit_N>
-<cowberry_N,topic,fruit_N>
-<gooseberry_N,topic,fruit_N>
-<boysenberry_N,topic,fruit_N>
-<dewberry_N,topic,fruit_N>
-<loganberry_N,topic,fruit_N>
-<sugarberry_N,topic,fruit_N>
-<hackberry_N,topic,fruit_N>
-<persimmon_N,topic,fruit_N>
-<acerola_N,topic,fruit_N>
-<mulberry_N,topic,fruit_N>
-<carambola_N,topic,fruit_N>
-<ceriman_N,topic,fruit_N>
-<monstera_N,topic,fruit_N>
-<clementine_N,topic,fruit_N>
-<satsuma_N,topic,fruit_N>
-<tangerine_N,topic,fruit_N>
-<kumquat_N,topic,fruit_N>
-<lime_2_N,topic,fruit_N>
-<grapefruit_N,topic,fruit_N>
-<pomelo_N,topic,fruit_N>
-<shaddock_N,topic,fruit_N>
-<citrange_N,topic,fruit_N>
-<tangelo_N,topic,fruit_N>
-<apricot_N,topic,fruit_N>
-<nectarine_N,topic,fruit_N>
-<pitahaya_N,topic,fruit_N>
-<plum_N,topic,fruit_N>
-<sloe_N,topic,fruit_N>
-<fig_N,topic,fruit_N>
-<pineapple_N,topic,fruit_N>
-<granadilla_N,topic,fruit_N>
-<breadfruit_N,topic,fruit_N>
-<jackfruit_N,topic,fruit_N>
-<canistel_N,topic,fruit_N>
-<muskmelon_N,topic,fruit_N>
-<cantaloupe_N,topic,fruit_N>
-<watermelon_N,topic,fruit_N>
-<cherry_N,topic,fruit_N>
-<blackheart_N,topic,fruit_N>
-<capulin_N,topic,fruit_N>
-<amarelle_N,topic,fruit_N>
-<morello_N,topic,fruit_N>
-<muscadine_N,topic,fruit_N>
-<emperor_N,topic,fruit_N>
-<muscat_N,topic,fruit_N>
-<muscatel_N,topic,fruit_N>
-<cherimoya_N,topic,fruit_N>
-<soursop_N,topic,fruit_N>
-<sweetsop_N,topic,fruit_N>
-<ilama_N,topic,fruit_N>
-<papaw_N,topic,fruit_N>
-<pawpaw_N,topic,fruit_N>
-<papaya_N,topic,fruit_N>
-<ketembilla_N,topic,fruit_N>
-<durian_N,topic,fruit_N>
-<feijoa_N,topic,fruit_N>
-<genip_N,topic,fruit_N>
-<kiwi_N,topic,fruit_N>
-<loquat_N,topic,fruit_N>
-<mangosteen_N,topic,fruit_N>
-<mango_N,topic,fruit_N>
-<sapodilla_N,topic,fruit_N>
-<sapote_N,topic,fruit_N>
-<tamarind_N,topic,fruit_N>
-<elderberry_N,topic,fruit_N>
-<guava_N,topic,fruit_N>
-<mombin_N,topic,fruit_N>
-<jaboticaba_N,topic,fruit_N>
-<jujube_N,topic,fruit_N>
-<longanberry_N,topic,fruit_N>
-<mamey_N,topic,fruit_N>
-<marang_N,topic,fruit_N>
-<medlar_N,topic,fruit_N>
-<plumcot_N,topic,fruit_N>
-<pomegranate_N,topic,fruit_N>
-<garambulla_N,topic,fruit_N>
-<quandong_N,topic,fruit_N>
-<quince_N,topic,fruit_N>
-<rambutan_N,topic,fruit_N>
-<pulasan_N,topic,fruit_N>
-<ackee_N,topic,food_N>
-<anjou_N,topic,food_N>
-<apple_N,topic,food_N>
-<avocado_N,topic,food_N>
-<bartlett_N,topic,food_N>
-<berry_N,topic,food_N>
-<blackberry_N,topic,food_N>
-<bosc_N,topic,food_N>
-<casaba_N,topic,food_N>
-<citron_N,topic,food_N>
-<citrus_N,topic,food_N>
-<currant_N,topic,food_N>
-<damson_N,topic,food_N>
-<date_7_N,topic,food_N>
-<genipap_N,topic,food_N>
-<grape_N,topic,food_N>
-<greengage_N,topic,food_N>
-<honeydew_N,topic,food_N>
-<lanseh_N,topic,food_N>
-<lemon_N,topic,food_N>
-<lychee_N,topic,food_N>
-<melon_N,topic,food_N>
-<orange_1_N,topic,food_N>
-<pear_N,topic,food_N>
-<pearmain_N,topic,food_N>
-<pippin_N,topic,food_N>
-<prune_N,topic,food_N>
-<raisin_N,topic,food_N>
-<ribier_N,topic,food_N>
-<saskatoon_N,topic,food_N>
-<scuppernong_N,topic,food_N>
-<seckel_N,topic,food_N>
-<sorb_N,topic,food_N>
-<strawberry_N,topic,food_N>
-<sultana_N,topic,food_N>
-<peach_N,topic,food_N>
-<raspberry_N,topic,food_N>
-<mandarin_N,topic,food_N>
-<banana_N,topic,food_N>
-<crab_apple_N,topic,food_N>
-<bilberry_N,topic,food_N>
-<huckleberry_N,topic,food_N>
-<blueberry_N,topic,food_N>
-<wintergreen_N,topic,food_N>
-<teaberry_N,topic,food_N>
-<cranberry_N,topic,food_N>
-<lingonberry_N,topic,food_N>
-<cowberry_N,topic,food_N>
-<gooseberry_N,topic,food_N>
-<boysenberry_N,topic,food_N>
-<dewberry_N,topic,food_N>
-<loganberry_N,topic,food_N>
-<sugarberry_N,topic,food_N>
-<hackberry_N,topic,food_N>
-<persimmon_N,topic,food_N>
-<acerola_N,topic,food_N>
-<mulberry_N,topic,food_N>
-<carambola_N,topic,food_N>
-<ceriman_N,topic,food_N>
-<monstera_N,topic,food_N>
-<clementine_N,topic,food_N>
-<satsuma_N,topic,food_N>
-<tangerine_N,topic,food_N>
-<kumquat_N,topic,food_N>
-<lime_2_N,topic,food_N>
-<grapefruit_N,topic,food_N>
-<pomelo_N,topic,food_N>
-<shaddock_N,topic,food_N>
-<citrange_N,topic,food_N>
-<tangelo_N,topic,food_N>
-<apricot_N,topic,food_N>
-<nectarine_N,topic,food_N>
-<pitahaya_N,topic,food_N>
-<plum_N,topic,food_N>
-<sloe_N,topic,food_N>
-<fig_N,topic,food_N>
-<pineapple_N,topic,food_N>
-<granadilla_N,topic,food_N>
-<breadfruit_N,topic,food_N>
-<jackfruit_N,topic,food_N>
-<canistel_N,topic,food_N>
-<muskmelon_N,topic,food_N>
-<cantaloupe_N,topic,food_N>
-<watermelon_N,topic,food_N>
-<cherry_N,topic,food_N>
-<blackheart_N,topic,food_N>
-<capulin_N,topic,food_N>
-<amarelle_N,topic,food_N>
-<morello_N,topic,food_N>
-<muscadine_N,topic,food_N>
-<emperor_N,topic,food_N>
-<muscat_N,topic,food_N>
-<muscatel_N,topic,food_N>
-<cherimoya_N,topic,food_N>
-<soursop_N,topic,food_N>
-<sweetsop_N,topic,food_N>
-<ilama_N,topic,food_N>
-<papaw_N,topic,food_N>
-<pawpaw_N,topic,food_N>
-<papaya_N,topic,food_N>
-<ketembilla_N,topic,food_N>
-<durian_N,topic,food_N>
-<feijoa_N,topic,food_N>
-<genip_N,topic,food_N>
-<kiwi_N,topic,food_N>
-<loquat_N,topic,food_N>
-<mangosteen_N,topic,food_N>
-<mango_N,topic,food_N>
-<sapodilla_N,topic,food_N>
-<sapote_N,topic,food_N>
-<tamarind_N,topic,food_N>
-<elderberry_N,topic,food_N>
-<guava_N,topic,food_N>
-<mombin_N,topic,food_N>
-<jaboticaba_N,topic,food_N>
-<jujube_N,topic,food_N>
-<longanberry_N,topic,food_N>
-<mamey_N,topic,food_N>
-<marang_N,topic,food_N>
-<medlar_N,topic,food_N>
-<plumcot_N,topic,food_N>
-<pomegranate_N,topic,food_N>
-<garambulla_N,topic,food_N>
-<quandong_N,topic,food_N>
-<quince_N,topic,food_N>
-<rambutan_N,topic,food_N>
-<pulasan_N,topic,food_N>
-<mandarin_N,topic,citrus_N>
-<orange_1_N,topic,citrus_N>
-<lemon_N,topic,citrus_N>
-<citron_N,topic,citrus_N>
-<pomelo_N,topic,citrus_N>
-<clementine_N,topic,citrus_N>
-<satsuma_N,topic,citrus_N>
-<tangerine_N,topic,citrus_N>
-<lime_2_N,topic,citrus_N>
-<mandarin_N,topic,tropical_A>
-<orange_1_N,topic,tropical_A>
-<lemon_N,topic,tropical_A>
-<citron_N,topic,tropical_A>
-<banana_N,topic,tropical_A>
-<avocado_N,topic,tropical_A>
-<lychee_N,topic,tropical_A>
-<ackee_N,topic,tropical_A>
-<acerola_N,topic,tropical_A>
-<guava_N,topic,tropical_A>
-<canistel_N,topic,tropical_A>
-<cherimoya_N,topic,tropical_A>
-<damson_N,topic,tropical_A>
-<granadilla_N,topic,tropical_A>
-<hackberry_N,topic,tropical_A>
-<huckleberry_N,topic,tropical_A>
-<papaya_N,topic,tropical_A>
-<pineapple_N,topic,tropical_A>
-<pomelo_N,topic,tropical_A>