Commit 949a2289 authored by CallisteHanriat's avatar CallisteHanriat

apply new correctives

parent fb51193a
......@@ -3,7 +3,7 @@
package="org.lp20.aikuma2"
android:versionCode="010005"
android:versionName="0.8.4">
<uses-sdk android:minSdkVersion="16"/>
<uses-sdk android:minSdkVersion="14"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
......
......@@ -16,6 +16,7 @@ import org.lp20.aikuma2.R;
import com.musicg.wave.Wave;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.FragmentTransaction;
......@@ -144,17 +145,12 @@ public class ElicitationMode extends AikumaActivity{
* Copied from RespeakingSelection.java
*/
public class FilebrowserDialogFragment extends DialogFragment {
ListView listElement;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_select_file_frag, null);
listElement = (ListView) view.findViewById(R.id.listItemFile);
Dialog dialog = null;
ListFolderAdapter adapter = new ListFolderAdapter(getActivity(), mFileList, mPath, selectedFileType);
listElement.setAdapter(adapter);;
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(title);
Dialog dialog = new Dialog(getActivity());
AlertDialog.Builder builder = new Builder(getActivity());
if(mFileList == null) {
Toast.makeText(getActivity(), "No files to display", Toast.LENGTH_SHORT).show();
......@@ -162,16 +158,20 @@ public class ElicitationMode extends AikumaActivity{
dialog = builder.create();
return dialog;
}
listElement.setOnItemClickListener(new OnItemClickListener() {
builder.setTitle("Import file");
builder.setAdapter(adapter, new DialogInterface.OnClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
dismiss();
mChosenFile = mFileList[position];
mChosenFile = mFileList[which];
Log.i(TAG, "mChosenFile: " + mChosenFile);
mPath = new File(mPath, mChosenFile);
if (mPath.isDirectory()) {
if (!isSelectionnable(mPath)) {
Log.d("mPath", mPath.getAbsolutePath() + " is not selectionnable");
Log.d("not selectionnable", "not selectionnable");
loadFileList(mPath, fileType);
if(mFileList.length > 0)
showAudioFilebrowserDialog();
......@@ -179,21 +179,15 @@ public class ElicitationMode extends AikumaActivity{
Log.d("mPath", mPath.getAbsolutePath() + " is selectionnable");
actionSelectedFile();
}
} else {
if (fileType==".jpg") {
Toast.makeText(ElicitationMode.this, "Selected folder: " + mPath, Toast.LENGTH_LONG).show();
}
if (fileType==".avi") {
Toast.makeText(ElicitationMode.this, "Selected video: " + mPath, Toast.LENGTH_LONG).show();
}
} else if (mPath.isFile() && mPath.toString().contains(".txt")) {
actionSelectedFile();
} else {
Toast.makeText(ElicitationMode.this, "ERROR : Is not txt file", Toast.LENGTH_SHORT).show();
}
}
});
dialog.setContentView(view);
dialog.setTitle("Import file");
dialog.show();
dialog = builder.show();
return dialog;
}
}
......@@ -212,11 +206,6 @@ public class ElicitationMode extends AikumaActivity{
i++;
}
return files.length == i && i>0;
case ElicitationMode.TEXT_MODE:
while(files[i].isFile() && files[i].getAbsolutePath().contains(".mp4")) {
i++;
}
return files.length == i;
case ElicitationMode.VIDEO_MODE:
while( i < files.length && files[i].isFile() && (files[i].getAbsolutePath().contains(".mp4") || files[i].getAbsolutePath().contains(".avi"))) {
i++;
......
......@@ -3,6 +3,7 @@ package org.lp20.aikuma.ui;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
......@@ -76,6 +77,10 @@ public class RecordElicitation extends AikumaActivity {
private SharedPreferences prefsUserSession;
private String strFolderDate;
private RecordingLig recordingLig;
/**
* the "linker" file
*/
private File textFile;
private BufferedWriter bufferedWriter;
private int choiceMode;
......@@ -136,7 +141,7 @@ public class RecordElicitation extends AikumaActivity {
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
Log.e(TAG,"text file could not be found: " + e1);
Toast.makeText(this, "An error occurred, the text file could not be found", Toast.LENGTH_LONG).show();
Toast.makeText(this, "An error occurred, the resource file could not be found", Toast.LENGTH_LONG).show();
try {
bufferedWriter.close();
} catch (IOException e) {
......@@ -144,7 +149,7 @@ public class RecordElicitation extends AikumaActivity {
}
this.finish();
} catch (IOException e) {
Toast.makeText(this, "Something weird happened. It might be that the text file was empty.", Toast.LENGTH_LONG).show();
Toast.makeText(this, "Something weird happened. It might be that the resource file was empty.", Toast.LENGTH_LONG).show();
Log.e(TAG,"No more sentences to display or an error occurred: " + e);
try {
bufferedWriter.close();
......@@ -178,7 +183,7 @@ public class RecordElicitation extends AikumaActivity {
videoView.setVideoPath(images[entityId].getAbsolutePath());
videoView.setDrawingCacheEnabled(true);
BitmapDrawable bitmapDrawable = new BitmapDrawable(this.getResources(), thumb);
videoView.setBackground(bitmapDrawable);
videoView.setBackgroundDrawable(bitmapDrawable);
videoView.setVisibility(View.GONE);
videoView.setVisibility(View.VISIBLE);
}
......@@ -281,8 +286,8 @@ public class RecordElicitation extends AikumaActivity {
e.printStackTrace();
}
if (choiceMode == ElicitationMode.TEXT_MODE)
goToGoodPlaceInTextFile();
/*if (choiceMode == ElicitationMode.TEXT_MODE)
goToGoodPlaceInTextFile();*/
isNewSession = false;
} else {
......@@ -598,6 +603,7 @@ public class RecordElicitation extends AikumaActivity {
bufferedWriter.write(".../" + images[entityId].getParentFile().getName() + "/" + images[entityId].getName() + " ; "+
".../" + new File(filename).getParentFile().getName() + "/"+new File(filename).getName().replace(".wav", "_"+entityId+".wav"));
bufferedWriter.newLine();
bufferedWriter.flush();
}
} catch (IOException e) {
Log.e(TAG, "error when saving the recroding: " + e);
......@@ -683,7 +689,14 @@ public class RecordElicitation extends AikumaActivity {
}
} else if (choiceMode == ElicitationMode.IMAGE_MODE || choiceMode == ElicitationMode.VIDEO_MODE) {
File f = new File(ptrSelectedReference);
return f.listFiles().length;
return f.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
// TODO Auto-generated method stub
return !pathname.isHidden();
}
}).length;
}
return nbLine;
}
......@@ -748,7 +761,7 @@ public class RecordElicitation extends AikumaActivity {
public void onClick(DialogInterface dialog,
int which) {
if (entityId<numberOfEntities && textFile.exists()) {
if (entityId<numberOfEntities) {
saveCurrentState();
}
if ((choiceMode == ElicitationMode.IMAGE_MODE || choiceMode == ElicitationMode.VIDEO_MODE) && bufferedWriter != null) {
......
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