Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2d46898
making default db the username's db
cesine Jun 12, 2014
2722f05
adding support for speech recognition training app
cesine Jun 12, 2014
e5ec28d
created a production experiment datum fragment
cesine Jun 12, 2014
f3de322
displaying different background images based on tags (for category ba…
cesine Jun 12, 2014
c8c1aeb
added a list pager which makes it possible to swipe between datum
cesine Jun 12, 2014
997bfe8
scrollabel flash cards a bit more memory optimized and turning of acr…
cesine Jun 13, 2014
621854c
creating corpus directories in an app directory and playing instructi…
cesine Jun 13, 2014
9f991fe
auto advancing between stimuli/cards
cesine Jun 13, 2014
cd1f004
added a confirm dialog if users want to add their own words
cesine Jun 13, 2014
ac58490
adding a high res version of the speech bubbles for backgroun dimage
cesine Jun 13, 2014
c580815
aded a simple datum view for non-linguists fixes https://github.com/O…
cesine Jun 13, 2014
ef0fcf6
putting default datum list back to using the datum views not a view p…
cesine Jun 13, 2014
66edfbf
added audio upload for https://github.com/OpenSourceFieldlinguistics/…
cesine Jun 13, 2014
bb7e9bf
checking if the cursor is null
cesine Jun 13, 2014
2052c3f
adding bouncy castle but not upload not working yet
cesine Jun 13, 2014
6f47e87
uplaod is working
cesine Jun 14, 2014
31605e5
deployed v2.4.0
cesine Jun 14, 2014
a187c9d
downloading samples was on for the speechrec app
cesine Jun 14, 2014
fdd38df
corrections to acra found while doing https://github.com/OpenSourceFi…
cesine Jun 15, 2014
77c2b83
renaming production experiment activity
cesine Jun 15, 2014
638ea38
using a datum edit activity for the speech recognition hypothesis dis…
cesine Jun 16, 2014
b764885
matching parrnt to not underflow the action bar
cesine Jun 16, 2014
e7b3fbf
turning off the recording if you scroll to the next item
cesine Jun 16, 2014
51b6149
Speech recognition creates a new datum with validation status of Aut…
cesine Jun 16, 2014
a1cb854
new speech recognition interface is ready fixes https://github.com/ba…
cesine Jun 16, 2014
806db03
forcing locale to kartuli and adding color to the speech recognitoin …
cesine Jun 17, 2014
aa2ded4
new layout for horizontal tablets with buttons and text next to eacho…
cesine Jun 17, 2014
4ff0369
using speechrecognition as the app type and preparing for release
cesine Jun 17, 2014
7a5828b
Getting on focus change listeners to set the orthography isnt working
cesine Jun 17, 2014
ebe4eaf
dont need on buffered listener
cesine Jun 17, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
forcing locale to kartuli and adding color to the speech recognitoin …
…hypotheses and handling edge cases when recognizer is not installed etc
  • Loading branch information
cesine committed Jun 17, 2014
commit 806db0363c64cb9e76b4712bafb865280aac80bc
64 changes: 50 additions & 14 deletions res/layout/fragment_datum_speech_recognition_hypotheses.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffffff" >
android:background="#232323" >

<ImageView
android:id="@+id/image_view"
Expand Down Expand Up @@ -51,7 +51,9 @@
android:layout_weight="100"
android:inputType="textMultiLine"
android:scrollHorizontally="false"
android:text="" />
android:text=""
android:textColor="#ffffffff"
android:textSize="25sp" />
</TableRow>

<TableRow android:layout_width="match_parent" >
Expand All @@ -65,12 +67,14 @@
android:inputType="textMultiLine"
android:scrollHorizontally="false"
android:text=""
android:textColor="#ffcccccc"
android:textSize="15sp"
android:visibility="gone" />
</TableRow>

<TableRow android:layout_width="match_parent" >

<EditText
<AutoCompleteTextView
android:id="@+id/tags"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -79,6 +83,8 @@
android:inputType="textMultiLine"
android:scrollHorizontally="false"
android:text=""
android:textColor="#ffcccccc"
android:textSize="15sp"
android:visibility="gone" />
</TableRow>
</TableLayout>
Expand All @@ -90,92 +96,122 @@
android:layout_gravity="center"
android:orientation="vertical" >

<TableRow android:layout_width="match_parent" >
<TableRow
android:layout_width="match_parent"
android:background="#ff9a1a97" >

<EditText
android:id="@+id/hypothesis1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="80"
android:hint="@string/hypothesis"
android:inputType="textMultiLine"
android:scrollHorizontally="false"
android:text="" />
android:text=""
android:textColor="#ffffffff"
android:textSize="25sp" />

<ImageButton
android:id="@+id/removeHypothesis1"
android:background="#00ffffff"
android:contentDescription="@string/remove"
android:src="@drawable/ic_action_cancel" />
</TableRow>

<TableRow android:layout_width="match_parent" >
<TableRow
android:layout_width="match_parent"
android:background="#ff0086ce" >

<EditText
android:id="@+id/hypothesis2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="80"
android:hint="@string/hypothesis"
android:inputType="textMultiLine"
android:scrollHorizontally="false"
android:text="" />
android:text=""
android:textColor="#ffffffff"
android:textSize="25sp" />

<ImageButton
android:id="@+id/removeHypothesis2"
android:background="#00ffffff"
android:contentDescription="@string/remove"
android:src="@drawable/ic_action_cancel" />
</TableRow>

<TableRow android:layout_width="match_parent" >
<TableRow
android:layout_width="match_parent"
android:background="#ff15a8ad" >

<EditText
android:id="@+id/hypothesis3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="80"
android:hint="@string/hypothesis"
android:inputType="textMultiLine"
android:scrollHorizontally="false"
android:text="" />
android:text=""
android:textColor="#ffffffff"
android:textSize="25sp" />

<ImageButton
android:id="@+id/removeHypothesis3"
android:background="#00ffffff"
android:contentDescription="@string/remove"
android:src="@drawable/ic_action_cancel" />
</TableRow>

<TableRow android:layout_width="match_parent" >
<TableRow
android:layout_width="match_parent"
android:background="#ffffa300" >

<EditText
android:id="@+id/hypothesis4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="80"
android:hint="@string/hypothesis"
android:inputType="textMultiLine"
android:scrollHorizontally="false"
android:text="" />
android:text=""
android:textColor="#ffffffff"
android:textSize="25sp" />

<ImageButton
android:id="@+id/removeHypothesis4"
android:background="#00ffffff"
android:contentDescription="@string/remove"
android:src="@drawable/ic_action_cancel" />
</TableRow>

<TableRow android:layout_width="match_parent" >
<TableRow
android:layout_width="match_parent"
android:background="#fff9b032" >

<EditText
android:id="@+id/hypothesis5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="80"
android:hint="@string/hypothesis"
android:inputType="textMultiLine"
android:scrollHorizontally="false"
android:text="" />
android:text=""
android:textColor="#ffffffff"
android:textSize="25sp" />

<ImageButton
android:id="@+id/removeHypothesis5"
android:background="#00ffffff"
android:contentDescription="@string/remove"
android:src="@drawable/ic_action_cancel" />
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>

</RelativeLayout>
</RelativeLayout>
15 changes: 15 additions & 0 deletions res/menu/actions_datum_speech_recognition.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

<item
android:id="@+id/action_speak"
android:icon="@drawable/ic_action_mic"
android:showAsAction="ifRoom"
android:title="Speak"/>
<item
android:id="@+id/action_delete"
android:icon="@android:drawable/ic_delete"
android:showAsAction="ifRoom"
android:title="Delete"/>

</menu>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.Locale;

import org.acra.ACRA;
import org.acra.ACRAConfiguration;
Expand All @@ -30,6 +31,7 @@
import android.content.Context;
import android.content.CursorLoader;
import android.content.Intent;
import android.content.res.Configuration;
import android.database.Cursor;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
Expand All @@ -43,6 +45,8 @@ public class FieldDBApplication extends Application {
@Override
public final void onCreate() {
super.onCreate();
String language = forceLocale(Config.DATA_IS_ABOUT_LANGUAGE_ISO);
Log.d(Config.TAG, "Forced the locale to " + language);

// (new File(Config.DEFAULT_OUTPUT_DIRECTORY)).mkdirs();

Expand Down Expand Up @@ -207,4 +211,38 @@ public final void onCreate() {
}

}

/**
* Forces the locale for the duration of the app to the language needed for
* that version of the Experiment. It accepts a variable in the form en or
* en-US containing just the language code, or the language code followed by
* a - and the co
*
* @param lang
* @return
*/
public String forceLocale(String lang) {
if (lang.equals(Locale.getDefault().getLanguage())) {
return Locale.getDefault().getDisplayLanguage();
}
Configuration config = this.getBaseContext().getResources()
.getConfiguration();
Locale locale;
if (lang.contains("-")) {
String[] langCountrycode = lang.split("-");
locale = new Locale(langCountrycode[0], langCountrycode[1]);
} else {
locale = new Locale(lang);
}
Locale.setDefault(locale);
config.locale = locale;
this.getBaseContext()
.getResources()
.updateConfiguration(
config,
this.getBaseContext().getResources()
.getDisplayMetrics());

return Locale.getDefault().getDisplayLanguage();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ protected boolean turnOffRecorder(MenuItem item) {

@Override
public void run() {
if(getActivity() == null){
if (getActivity() == null) {
return;
}
Intent uploadAudioFile = new Intent(getActivity(),
Expand Down Expand Up @@ -547,11 +547,11 @@ protected boolean autoAdvanceAfterRecordingAudio() {
protected boolean delete() {
AlertDialog deleteConfirmationDialog = new AlertDialog.Builder(
getActivity())
.setTitle("Are you sure?")
.setTitle(R.string.are_you_sure)
.setMessage(
"Are you sure you want to put this "
+ Config.USER_FRIENDLY_DATA_NAME
+ " in the trash?")
getString(R.string.are_you_sure_put_in_trash).replace(
"datum", Config.USER_FRIENDLY_DATA_NAME))

.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
@Override
Expand Down Expand Up @@ -583,7 +583,6 @@ public void onClick(DialogInterface dialog,
deleteConfirmationDialog.show();
return true;
}

protected void loadVisuals(boolean playImmediately) {
loadMainVideo(playImmediately);
}
Expand Down Expand Up @@ -796,6 +795,9 @@ public void onPause() {
it.remove(); // avoids a ConcurrentModificationException
}
edits = "[" + edits + "]";
if (Config.D) {
Log.d(Config.TAG, "edits: " + edits);
}
recordUserEvent("totalDatumEditsOnPause", edits);
}

Expand All @@ -808,7 +810,6 @@ public void onPause() {

super.onPause();
}

protected void recordUserEvent(String eventType, String eventValue) {
if ("editDatum".equals(eventType)) {
if (this.mDatumEditCounts == null) {
Expand Down
Loading