Commit 9c204d73 authored by Elodie Gauthier's avatar Elodie Gauthier

upgrade version and fix bug on RecordElicitation

parent 949a2289
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.lp20.aikuma2"
android:versionCode="010005"
android:versionName="0.8.4">
android:versionCode="011000"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="14"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
......
......@@ -171,12 +171,12 @@ public class ElicitationMode extends AikumaActivity{
mPath = new File(mPath, mChosenFile);
if (mPath.isDirectory()) {
if (!isSelectionnable(mPath)) {
Log.d("not selectionnable", "not selectionnable");
Log.d(TAG, "not selectionnable");
loadFileList(mPath, fileType);
if(mFileList.length > 0)
showAudioFilebrowserDialog();
} else {
Log.d("mPath", mPath.getAbsolutePath() + " is selectionnable");
Log.d(TAG, mPath.getAbsolutePath() + " is selectionnable");
actionSelectedFile();
}
} else if (mPath.isFile() && mPath.toString().contains(".txt")) {
......
......@@ -19,6 +19,7 @@ import android.widget.TextView;
public class ListFileAdapter extends ArrayAdapter {
private LayoutInflater layoutInflater;
private File parentFile;
public static final String TAG = "ListFileAdapter";
static class ViewHolder {
public TextView textFileName;
......@@ -56,7 +57,7 @@ public class ListFileAdapter extends ArrayAdapter {
RelativeLayout relativeListFile = (RelativeLayout) rowView.findViewById(R.id.layoutListView);
if (!file.isDirectory()) {
Log.d("fileName : ", "fileName : " + file.getAbsolutePath());
Log.d(TAG, "fileName : " + file.getAbsolutePath());
if (fileName.contains("rspk") && fileName.contains(".wav")) {
relativeListFile.setBackgroundColor(Color.parseColor("#80673AB7"));
}
......
......@@ -163,8 +163,9 @@ public class RecordElicitation extends AikumaActivity {
}
private void loadVideo() {
Log.d(TAG,"entityId = "+entityId+"; numberOfEntities = "+numberOfEntities);
if (entityId >= numberOfEntities) {
Toast.makeText(this, "No more images to display", Toast.LENGTH_LONG).show();
Toast.makeText(this, "No more videos to display", Toast.LENGTH_LONG).show();
if ((choiceMode == ElicitationMode.IMAGE_MODE || choiceMode == ElicitationMode.VIDEO_MODE) && bufferedWriter != null) {
try {
bufferedWriter.close();
......@@ -186,6 +187,8 @@ public class RecordElicitation extends AikumaActivity {
videoView.setBackgroundDrawable(bitmapDrawable);
videoView.setVisibility(View.GONE);
videoView.setVisibility(View.VISIBLE);
TextView tv_numVideo = (TextView) findViewById(R.id.image_x);
tv_numVideo.setText("Video" + entityId);
}
}
......@@ -217,6 +220,7 @@ public class RecordElicitation extends AikumaActivity {
}
private void loadImage() {
Log.d(TAG,"entityId = "+entityId+"; numberOfEntities = "+numberOfEntities);
if (entityId >= numberOfEntities){
Toast.makeText(this, "No more images to display", Toast.LENGTH_LONG).show();
if ((choiceMode == ElicitationMode.IMAGE_MODE || choiceMode == ElicitationMode.VIDEO_MODE) && bufferedWriter != null) {
......@@ -233,6 +237,8 @@ public class RecordElicitation extends AikumaActivity {
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
BitmapWorkerTask task = new BitmapWorkerTask(selected_photo);
task.execute(images[entityId]);
TextView tv_numImage = (TextView) findViewById(R.id.image_x);
tv_numImage.setText("Image" + entityId);
}
}
......@@ -375,7 +381,7 @@ public class RecordElicitation extends AikumaActivity {
/**
* called when we want to save one record. Used when we touch newt button
* called when we want to save one record. Used when we touch next button
*/
private void saveOneRecord() {
recordUUID = UUID.randomUUID();
......@@ -427,8 +433,8 @@ public class RecordElicitation extends AikumaActivity {
"Error setting up microphone.",
Toast.LENGTH_LONG).show();
} catch (IOException e) {
Toast.makeText(this, "No more sentences to display", Toast.LENGTH_LONG).show();
Log.e(TAG,"No more sentences to display or an error occurred: " + e);
Toast.makeText(this, "No more to display", Toast.LENGTH_LONG).show();
Log.e(TAG,"No more to display or an error occurred: " + e);
this.finish();
}
}
......@@ -476,8 +482,10 @@ public class RecordElicitation extends AikumaActivity {
* @param _view the next button
*/
public void onNextClick(View _view) {
if (!saveRecording())
Toast.makeText(this, "Going to next sentence...", Toast.LENGTH_LONG).show();
if (!saveRecording() && (entityId+1 < numberOfEntities)) {
Log.d(TAG,"onNextClick => entityId = "+entityId+"; numberOfEntities = "+numberOfEntities);
Toast.makeText(this, "Going next...", Toast.LENGTH_SHORT).show();
}
saveOneRecord();
}
......@@ -509,7 +517,7 @@ public class RecordElicitation extends AikumaActivity {
this.strFolderDate + "_" + recordLang.getCode() + "_" + Aikuma.getDeviceId() + "_" + i + RecordingLig.METADATA_SUFFIX);
i--;
} while (!metadataFile.exists());
Log.d("metadataFile : ", "metadataFile : " + metadataFile.getAbsolutePath());
Log.d(TAG, "metadataFile : " + metadataFile.getAbsolutePath());
try {
recordingLig = RecordingLig.read(metadataFile);
int duration = recorder.getCurrentMsec();
......@@ -574,13 +582,13 @@ public class RecordElicitation extends AikumaActivity {
*/
private boolean saveRecording() {
if ((recorder != null && recorder.getFile().getPayloadSize() == 0) || recorder == null) {
return false;
return false;
}
try {
recorder.stop();
} catch (MicException e) {
Log.e(TAG, "error when saving the recroding: " + e);
Log.e(TAG, "error when saving the recording: " + e);
Toast.makeText(this, "An error occurred when saving the recording. Please try again.", Toast.LENGTH_LONG).show();
return false;
}
......@@ -606,7 +614,7 @@ public class RecordElicitation extends AikumaActivity {
bufferedWriter.flush();
}
} catch (IOException e) {
Log.e(TAG, "error when saving the recroding: " + e);
Log.e(TAG, "error when saving the recording: " + e);
Toast.makeText(this, "An error occurred when saving the recording. Please try again.", Toast.LENGTH_LONG).show();
return false;
}
......@@ -745,13 +753,14 @@ public class RecordElicitation extends AikumaActivity {
}
private void interruptionCallback() {
String message = "a session is in progress. Do you want save the progression?";
String message = "A session is in progress. Do you want to save the progression?";
if (safeActivityTransitionMessage != null) {
message = safeActivityTransitionMessage;
}
if (entityId == 0)
if (entityId == 0) {
this.finish();
}
new AlertDialog.Builder(this)
.setMessage(message)
......
......@@ -161,7 +161,7 @@ public class RespeakingSelection extends AikumaActivity {
}
/**
* called by the the FileBrowserFragment when the selected item is not a dorectory.
* called by the the FileBrowserFragment when the selected item is not a directory.
*/
private void fileIsNotADirectory() {
SharedPreferences preferences = PreferenceManager
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment