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