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
auto advancing between stimuli/cards
  • Loading branch information
cesine committed Jun 13, 2014
commit 9f991fed9b66b1da4ce404e5daa420ac2e85c0f9
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.NavUtils;
import android.support.v4.view.ViewPager;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
Expand Down Expand Up @@ -61,6 +62,8 @@ public class DatumDetailFragment extends Fragment {
*/
public static final String ARG_ITEM_ID = "item_id";

public static final String ARG_TOTAL_DATUM_IN_LIST = "total_datum_count_in_list";

/**
* The content this fragment is presenting.
*/
Expand All @@ -80,13 +83,17 @@ public DatumDetailFragment() {
protected VideoView mVideoView;
protected ImageView mImageView;
protected MediaController mMediaController;
MediaPlayer mAudioPlayer;
protected MediaPlayer mAudioPlayer;
protected DeviceDetails mDeviceDetails;
protected HashMap<String, Integer> mDatumEditCounts;
protected ImageButton mSpeechRecognizerFeedback;
protected TextView mSpeechRecognizerInstructions;
protected boolean isPlaying = false;

protected ViewPager mDatumPager;

private int mLastDatumIndex;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -98,15 +105,17 @@ public void onCreate(Bundle savedInstanceState) {

if (getArguments().containsKey(ARG_ITEM_ID)) {
String id = getArguments().getString(ARG_ITEM_ID);
this.mLastDatumIndex = getArguments().getInt(
ARG_TOTAL_DATUM_IN_LIST);
Log.d(Config.TAG, "Will get id " + id);
String selection = null;
String[] selectionArgs = null;
String sortOrder = null;

String[] datumProjection = {DatumTable.COLUMN_ORTHOGRAPHY,
DatumTable.COLUMN_MORPHEMES, DatumTable.COLUMN_GLOSS,
DatumTable.COLUMN_TRANSLATION, DatumTable.COLUMN_CONTEXT,
DatumTable.COLUMN_IMAGE_FILES,
DatumTable.COLUMN_UTTERANCE, DatumTable.COLUMN_MORPHEMES,
DatumTable.COLUMN_GLOSS, DatumTable.COLUMN_TRANSLATION,
DatumTable.COLUMN_CONTEXT, DatumTable.COLUMN_IMAGE_FILES,
DatumTable.COLUMN_AUDIO_VIDEO_FILES, DatumTable.COLUMN_TAGS};
mUri = Uri.withAppendedPath(DatumContentProvider.CONTENT_URI, id);
CursorLoader cursorLoader = new CursorLoader(getActivity(), mUri,
Expand All @@ -127,6 +136,8 @@ public void onCreate(Bundle savedInstanceState) {
cursor.getString(cursor
.getColumnIndexOrThrow(DatumTable.COLUMN_CONTEXT)));
datum.setId(id);
datum.setUtterance(cursor.getString(cursor
.getColumnIndexOrThrow(DatumTable.COLUMN_UTTERANCE)));
datum.addMediaFiles(cursor.getString(cursor
.getColumnIndexOrThrow(DatumTable.COLUMN_IMAGE_FILES)));
datum.addMediaFiles((cursor.getString(cursor
Expand Down Expand Up @@ -344,6 +355,8 @@ public void onClick(View v) {
mSpeechRecognizerInstructions.setText("");
}

this.mDatumPager = (ViewPager) getActivity().findViewById(
R.id.viewpager);
}

@Override
Expand Down Expand Up @@ -443,7 +456,26 @@ public boolean toggleAudioRecording(MenuItem item) {
}

if (mSpeechRecognizerInstructions != null) {
mSpeechRecognizerInstructions.setText("Tap to speak");
mSpeechRecognizerInstructions.setText("Tap to speak again");
}
if (Config.APP_TYPE.equals("speechrec")) {
autoAdvanceAfterRecordingAudio();
}

}
return true;
}

protected boolean autoAdvanceAfterRecordingAudio() {
if (this.mDatumPager != null) {
int currentStimulusIndex = this.mDatumPager.getCurrentItem();
if (currentStimulusIndex == this.mLastDatumIndex) {
Intent openTrainer = new Intent(getActivity(),
DatumListActivity.class);
startActivity(openTrainer);
} else {
this.mDatumPager.setCurrentItem(this.mDatumPager
.getCurrentItem() + 1);
}
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public Fragment getItem(int position) {
arguments.putParcelable(DatumContentProvider.CONTENT_ITEM_TYPE,
mVisibleDatumUri);
arguments.putString(DatumDetailFragment.ARG_ITEM_ID, id);
arguments.putInt(DatumDetailFragment.ARG_TOTAL_DATUM_IN_LIST,
mDatumsIds.size() - 1);

fragment.mTwoPane = false;
fragment.setArguments(arguments);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
public class DatumProductionExperimentFragment extends DatumDetailFragment {

private int mAudioPromptResource;
private boolean isInstructions = false;
private boolean mIsInstructions = false;
private long WAIT_TO_RECORD_AFTER_PROMPT_START = 300;

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
//no menu
// no menu
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Expand Down Expand Up @@ -57,7 +59,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
String id = mItem.getId();
Log.d(Config.TAG, "Prompt for this datum will be " + id);
if ("instructions".equals(id)) {
this.isInstructions = true;
this.mIsInstructions = true;
mAudioPromptResource = R.raw.instructions;
mImageView.setImageResource(R.drawable.instructions);
mSpeechRecognizerFeedback.setVisibility(View.GONE);
Expand Down Expand Up @@ -95,17 +97,6 @@ protected void playPromptContext() {

@Override
public void onCompletion(MediaPlayer mp) {
Handler mainHandler = new Handler(getActivity()
.getMainLooper());
Runnable myRunnable = new Runnable() {
@Override
public void run() {
if(!isInstructions){
toggleAudioRecording(null);
}
}
};
mainHandler.post(myRunnable);
mp.release();
}
});
Expand All @@ -125,10 +116,25 @@ public void onPrepared(MediaPlayer mp) {
}
});

if (mSpeechRecognizerInstructions != null && !isInstructions ) {
mSpeechRecognizerInstructions.setText("Speak now");
if (mSpeechRecognizerInstructions != null && !mIsInstructions) {
mSpeechRecognizerInstructions.setText("Speak after beep");
}
}
/*
* begin recording almost immediately so that the user wont speak too
* early
*/
Handler mainHandler = new Handler(getActivity().getMainLooper());
Runnable myRunnable = new Runnable() {

@Override
public void run() {
if (!mIsInstructions) {
toggleAudioRecording(null);
}
}
};
mainHandler.postDelayed(myRunnable, WAIT_TO_RECORD_AFTER_PROMPT_START);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
public class ProductionExperimentViewPagerFragmentActivity
extends
FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> {

private DatumFragmentPagerAdapter mPagerAdapter;

@Override
Expand Down