Commit eefc1fa8 authored by hanriaca's avatar hanriaca

Video is playable on the video elicitation mode + fix bugs about the json file...

Video is playable on the video elicitation mode + fix bugs about the json file when a respeaking is done
parent e6f01dfa
......@@ -53,7 +53,7 @@
style="@style/SecondTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Please, read the bold line."
android:text="Please, look at this picture"
android:layout_marginBottom="25dp" />
</TableLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">
<!-- Back button -->
<GridLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left">
<Button
android:id="@+id/btn_goBack"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:drawableLeft="@drawable/ic_undo_black_24dp"
android:onClick="onButtonBackPressed"
android:text="@string/goBack"
android:textColor="#D32F2F"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp" />
</GridLayout>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/tableLayoutTitleActivityElicitationIMG">
<TextView
style="@style/MainTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Elicitation mode"
android:layout_marginBottom="20dp"/>
<View
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:id="@+id/separator"
android:visibility="visible"
android:background="@android:color/darker_gray"
android:layout_marginBottom="50dp"/>
<TextView
android:id="@+id/maintextView2"
style="@style/SecondTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Please, watch the video"
android:layout_marginBottom="25dp" />
</TableLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tableLayoutTitleActivityElicitationIMG"
android:id="@+id/linearLayoutTopActivityElicitationIMG">
<TextView
android:id="@+id/image_x"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="20sp"
android:typeface="serif" />
<View
android:id="@+id/view1"
android:layout_width="0.2dp"
android:layout_height="40dp"
android:visibility="visible"
android:background="@android:color/darker_gray"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
<fragment
android:id="@+id/phrase_player"
android:name="org.lp20.aikuma.ui.ListenFragment"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
</LinearLayout>
<FrameLayout
android:layout_below="@+id/linearLayoutTopActivityElicitationIMG"
android:id="@+id/frameLayoutVideoElicitation"
android:layout_width="800px"
android:layout_height="450px"
android:paddingBottom="10dp">
<VideoView
android:layout_width="800px"
android:id="@+id/vid_orig"
android:layout_height="450px"
android:paddingBottom="10dp"
/>
</FrameLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/relativeTowBottomsElicitIMG"
android:layout_below="@+id/linearLayoutTopActivityElicitationIMG"
android:layout_toRightOf="@+id/frameLayoutVideoElicitation">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:id="@+id/linearTowBottomsElicitIMG">
<ImageButton
android:id="@+id/btn_record_elicit"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:onClick="onRecordClick"
android:src="@drawable/record" />
<ImageButton
android:id="@+id/btn_next"
android:layout_toRightOf="@+id/btn_record_elicit"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:onClick="onNextClick"
android:src="@drawable/arrow_circle_o_right" />
</LinearLayout>
<ImageButton
android:id="@+id/btn_validate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:onClick="onValidate"
android:layout_below="@+id/linearTowBottomsElicitIMG"
android:src="@drawable/ok_32" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:layout_below="@+id/frameLayoutVideoElicitation">
<TextView
android:id="@+id/elicit_phrase_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
/>
<TextView
android:id="@+id/elicit_total_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" / " />
<view class="org.lp20.aikuma.ui.InterleavedSeekBar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:id="@+id/seek_elicit_progression"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxHeight="3dp"
/>
</LinearLayout>
</RelativeLayout>
</ScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/layoutListView">
<ImageView
android:layout_width="75dp"
android:layout_height="50dp"
android:src="@drawable/folder_close_icon"
android:id="@+id/image_file_type"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:textSize = "16dp"
android:layout_toRightOf="@+id/image_file_type"
android:gravity="center_vertical"
android:id="@+id/textFolderName"/>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/image_folder_type"
android:layout_alignParentRight="true"
android:src="@drawable/type_folder_image"
android:visibility="invisible"
/>
</RelativeLayout>
......@@ -22,7 +22,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:drawableLeft="@drawable/ic_undo_black_24dp"
android:onClick="onBackPressed"
android:onClick="onButtonBackPressed"
android:text="@string/goBack"
android:textColor="#D32F2F"
android:layout_marginBottom="20dp"
......
......@@ -53,15 +53,24 @@
style="@style/SecondTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Please, read the bold line."
android:text="Please, look at this picture"
android:layout_marginBottom="25dp" />
</TableLayout>
<ImageView
android:layout_below="@+id/tableLayoutTitleActivityElicitationIMG"
android:id="@+id/img_orig"
android:layout_width="1280px"
android:layout_height="720px"
android:paddingBottom="10dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tableLayoutTitleActivityElicitationIMG"
android:id="@+id/linearLayoutTopActivityElicitationIMG">
android:id="@+id/linearLayoutTopActivityElicitationIMG"
android:layout_below="@+id/img_orig">
<TextView
android:id="@+id/image_x"
......@@ -87,26 +96,17 @@
android:layout_height="match_parent" />
</LinearLayout>
<ImageView
android:layout_below="@+id/linearLayoutTopActivityElicitationIMG"
android:id="@+id/img_orig"
android:layout_width="800px"
android:layout_height="450px"
android:paddingBottom="10dp"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/relativeTowBottomsElicitIMG"
android:layout_below="@+id/linearLayoutTopActivityElicitationIMG"
android:layout_toRightOf="@+id/img_orig">
android:layout_toRightOf="@+id/img_orig"
android:layout_below="@+id/tableLayoutTitleActivityElicitationIMG">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:orientation="vertical"
android:id="@+id/linearTowBottomsElicitIMG">
<ImageButton
android:id="@+id/btn_record_elicit"
......@@ -143,7 +143,8 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:layout_below="@+id/img_orig">
android:layout_below="@+id/img_orig"
android:layout_toRightOf="@+id/linearLayoutTopActivityElicitationIMG">
<TextView
android:id="@+id/elicit_phrase_number"
......@@ -164,6 +165,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxHeight="3dp"
android:layout_gravity="center_vertical"
/>
</LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">
<!-- Back button -->
<GridLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left">
<Button
android:id="@+id/btn_goBack"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:drawableLeft="@drawable/ic_undo_black_24dp"
android:onClick="onButtonBackPressed"
android:text="@string/goBack"
android:textColor="#D32F2F"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp" />
</GridLayout>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/tableLayoutTitleActivityElicitationIMG">
<TextView
style="@style/MainTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Elicitation mode"
android:layout_marginBottom="20dp"/>
<View
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:id="@+id/separator"
android:visibility="visible"
android:background="@android:color/darker_gray"
android:layout_marginBottom="50dp"/>
<TextView
android:id="@+id/maintextView2"
style="@style/SecondTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Please, watch the video"
android:layout_marginBottom="25dp" />
</TableLayout>
<FrameLayout
android:layout_below="@+id/tableLayoutTitleActivityElicitationIMG"
android:id="@+id/frameLayoutVideoElicitation"
android:layout_width="1280px"
android:layout_height="720px"
android:paddingBottom="10dp">
<VideoView
android:layout_width="1280px"
android:id="@+id/vid_orig"
android:layout_height="720px"
android:paddingBottom="10dp"
/>
</FrameLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/linearLayoutTopActivityElicitationIMG"
android:layout_below="@+id/frameLayoutVideoElicitation">
<TextView
android:id="@+id/image_x"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="20sp"
android:typeface="serif" />
<View
android:id="@+id/view1"
android:layout_width="0.2dp"
android:layout_height="40dp"
android:visibility="visible"
android:background="@android:color/darker_gray"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
<fragment
android:id="@+id/phrase_player"
android:name="org.lp20.aikuma.ui.ListenFragment"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/relativeTowBottomsElicitIMG"
android:layout_toRightOf="@+id/frameLayoutVideoElicitation"
android:layout_below="@+id/tableLayoutTitleActivityElicitationIMG">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/linearTowBottomsElicitIMG">
<ImageButton
android:id="@+id/btn_record_elicit"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:onClick="onRecordClick"
android:src="@drawable/record" />
<ImageButton
android:id="@+id/btn_next"
android:layout_toRightOf="@+id/btn_record_elicit"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:onClick="onNextClick"
android:src="@drawable/arrow_circle_o_right" />
</LinearLayout>
<ImageButton
android:id="@+id/btn_validate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:onClick="onValidate"
android:layout_below="@+id/linearTowBottomsElicitIMG"
android:src="@drawable/ok_32" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:layout_below="@+id/frameLayoutVideoElicitation"
android:layout_toRightOf="@+id/linearLayoutTopActivityElicitationIMG">
<TextView
android:id="@+id/elicit_phrase_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
/>
<TextView
android:id="@+id/elicit_total_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" / " />
<view class="org.lp20.aikuma.ui.InterleavedSeekBar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:id="@+id/seek_elicit_progression"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxHeight="3dp"
android:layout_gravity="center_vertical"
/>
</LinearLayout>
</RelativeLayout>
</ScrollView>
\ No newline at end of file
......@@ -1264,7 +1264,7 @@ public class Recording extends FileModel {
this.respeakingId = respeakingId;
}
private void setDurationMsec(int durationMsec) {
public void setDurationMsec(int durationMsec) {
this.durationMsec = durationMsec;
}
......
......@@ -86,8 +86,7 @@ public class ElicitationMode extends AikumaActivity{
mPath = Environment.getExternalStorageDirectory();
fileType = ".avi";
title = "Import video file";
Toast.makeText(this, "This feature is not yet available...", Toast.LENGTH_LONG).show();
// importContent();
importContent();
break;
}
......@@ -153,7 +152,16 @@ public class ElicitationMode extends AikumaActivity{
listElement = (ListView) view.findViewById(R.id.listItemFile);
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());
if(mFileList == null) {
Toast.makeText(getActivity(), "No files to display", Toast.LENGTH_SHORT).show();
Log.e(TAG, "import file - Showing file picker before loading the file list");
dialog = builder.create();
return dialog;
}
listElement.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
......@@ -165,6 +173,7 @@ public class ElicitationMode extends AikumaActivity{
if (!isSelectionnable(mPath)) {
Log.d("mPath", mPath.getAbsolutePath() + " is not selectionnable");
loadFileList(mPath, fileType);
if(mFileList.length > 0)
showAudioFilebrowserDialog();
} else {
Log.d("mPath", mPath.getAbsolutePath() + " is selectionnable");
......@@ -182,18 +191,8 @@ public class ElicitationMode extends AikumaActivity{
}
});
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(title);
Dialog dialog = new Dialog(getActivity());
if(mFileList == null) {
Toast.makeText(getActivity(), "No files to display", Toast.LENGTH_SHORT).show();
Log.e(TAG, "import file - Showing file picker before loading the file list");
dialog = builder.create();
return dialog;
}
dialog.setContentView(view);
dialog.setTitle("Import file");
dialog.show();
return dialog;
}
......@@ -208,17 +207,21 @@ public class ElicitationMode extends AikumaActivity{
int i = 0;
File[] files = f.listFiles();
switch (selectedFileType) {
case 1:
while( i < files.length && files[i].isFile() && (files[i].getAbsolutePath().contains(".jpg") || files[i].getAbsolutePath().contains("jpeg"))) {
case ElicitationMode.IMAGE_MODE:
while( i < files.length && files[i].isFile() && (files[i].getAbsolutePath().contains(".jpg") || files[i].getAbsolutePath().contains(".jpeg"))) {
i++;
}
return files.length == i && i>0;
case 2:
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++;
}
return files.length == i && i>0;
default :
return false;
}
......
......@@ -92,7 +92,7 @@ public class ListFolderAdapter extends ArrayAdapter {
int i = 0;
switch (this.mode) {
case 1:
case ElicitationMode.IMAGE_MODE:
while(i < files.length && (files[i].isFile() && (files[i].getAbsolutePath().contains(".jpg") || files[i].getAbsolutePath().contains(".jpeg")))) {
i++;
}
......@@ -101,7 +101,17 @@ public class ListFolderAdapter extends ArrayAdapter {
else
holder.imageTypeOfFolder.setVisibility(ImageView.INVISIBLE);
break;
case ElicitationMode.VIDEO_MODE:
while(i < files.length && (files[i].isFile() && (files[i].getAbsolutePath().contains(".mp4") || files[i].getAbsolutePath().contains(".avi")))) {
i++;
}
if (i == files.length && i>0) {
holder.imageTypeOfFolder.setImageResource(R.drawable.type_folder_video);
holder.imageTypeOfFolder.setVisibility(ImageView.VISIBLE);
}
else
holder.imageTypeOfFolder.setVisibility(ImageView.INVISIBLE);
break;
default:
break;
}
......
This diff is collapsed.
......@@ -223,8 +223,6 @@ public class ThumbRespeakActivityLig extends AikumaActivity {
ed.putInt(getString(R.string.payLoadSize), fragment.getRespeaker().getRecorder().getFile().getPayloadSize());
ed.putLong(getString(R.string.currentPCMSample), fragment.getRespeaker().getRecorder().getFile().getCurrentSample());
// ed.putBoolean(getString(R.string.checkTranscript), true); //set submode
//save infos
ed.commit();
}
......@@ -252,6 +250,8 @@ public class ThumbRespeakActivityLig extends AikumaActivity {
this.respeakingUUID + RecordingLig.METADATA_SUFFIX);
try {
recording = RecordingLig.read(metadataFile);
int duration = respeaker.getCurrentMsec();
recording.setDurationMsec(duration);
recording.setRecordingUUID(respeakingUUID);
recording.setDeviceName(Aikuma.getDeviceName());
metadataFile.delete();
......@@ -364,8 +364,9 @@ public class ThumbRespeakActivityLig extends AikumaActivity {
@Override
public void onClick(DialogInterface dialog,
int which) {
setRecordingLig();
fragment.getRespeaker().saveRespeaking();
//fragment.getRespeaker().playOriginal(1);
setRecordingLig();
saveRecordingJsonInNoSync();
saveCurrentState();