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 @@ ...@@ -53,7 +53,7 @@
style="@style/SecondTitle" style="@style/SecondTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="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" /> android:layout_marginBottom="25dp" />
</TableLayout> </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 @@ ...@@ -22,7 +22,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:drawableLeft="@drawable/ic_undo_black_24dp" android:drawableLeft="@drawable/ic_undo_black_24dp"
android:onClick="onBackPressed" android:onClick="onButtonBackPressed"
android:text="@string/goBack" android:text="@string/goBack"
android:textColor="#D32F2F" android:textColor="#D32F2F"
android:layout_marginBottom="20dp" android:layout_marginBottom="20dp"
......
...@@ -53,15 +53,24 @@ ...@@ -53,15 +53,24 @@
style="@style/SecondTitle" style="@style/SecondTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="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" /> android:layout_marginBottom="25dp" />
</TableLayout> </TableLayout>
<LinearLayout
android:layout_width="match_parent" <ImageView
android:layout_height="wrap_content"
android:layout_below="@+id/tableLayoutTitleActivityElicitationIMG" android:layout_below="@+id/tableLayoutTitleActivityElicitationIMG"
android:id="@+id/linearLayoutTopActivityElicitationIMG"> android:id="@+id/img_orig"
android:layout_width="1280px"
android:layout_height="720px"
android:paddingBottom="10dp"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/linearLayoutTopActivityElicitationIMG"
android:layout_below="@+id/img_orig">
<TextView <TextView
android:id="@+id/image_x" android:id="@+id/image_x"
...@@ -86,27 +95,18 @@ ...@@ -86,27 +95,18 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
</LinearLayout> </LinearLayout>
<ImageView
android:layout_below="@+id/linearLayoutTopActivityElicitationIMG"
android:id="@+id/img_orig"
android:layout_width="800px"
android:layout_height="450px"
android:paddingBottom="10dp"
/>
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/relativeTowBottomsElicitIMG" 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 <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal" android:orientation="vertical"
android:id="@+id/linearTowBottomsElicitIMG"> android:id="@+id/linearTowBottomsElicitIMG">
<ImageButton <ImageButton
android:id="@+id/btn_record_elicit" android:id="@+id/btn_record_elicit"
...@@ -143,7 +143,8 @@ ...@@ -143,7 +143,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_below="@+id/img_orig"> android:layout_below="@+id/img_orig"
android:layout_toRightOf="@+id/linearLayoutTopActivityElicitationIMG">
<TextView <TextView
android:id="@+id/elicit_phrase_number" android:id="@+id/elicit_phrase_number"
...@@ -164,6 +165,7 @@ ...@@ -164,6 +165,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxHeight="3dp" android:maxHeight="3dp"
android:layout_gravity="center_vertical"
/> />
</LinearLayout> </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 { ...@@ -1264,7 +1264,7 @@ public class Recording extends FileModel {
this.respeakingId = respeakingId; this.respeakingId = respeakingId;
} }
private void setDurationMsec(int durationMsec) { public void setDurationMsec(int durationMsec) {
this.durationMsec = durationMsec; this.durationMsec = durationMsec;
} }
......
...@@ -86,8 +86,7 @@ public class ElicitationMode extends AikumaActivity{ ...@@ -86,8 +86,7 @@ public class ElicitationMode extends AikumaActivity{
mPath = Environment.getExternalStorageDirectory(); mPath = Environment.getExternalStorageDirectory();
fileType = ".avi"; fileType = ".avi";
title = "Import video file"; title = "Import video file";
Toast.makeText(this, "This feature is not yet available...", Toast.LENGTH_LONG).show(); importContent();
// importContent();
break; break;
} }
...@@ -153,7 +152,16 @@ public class ElicitationMode extends AikumaActivity{ ...@@ -153,7 +152,16 @@ public class ElicitationMode extends AikumaActivity{
listElement = (ListView) view.findViewById(R.id.listItemFile); listElement = (ListView) view.findViewById(R.id.listItemFile);
ListFolderAdapter adapter = new ListFolderAdapter(getActivity(), mFileList, mPath, selectedFileType); ListFolderAdapter adapter = new ListFolderAdapter(getActivity(), mFileList, mPath, selectedFileType);
listElement.setAdapter(adapter);; 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() { listElement.setOnItemClickListener(new OnItemClickListener() {
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
...@@ -165,7 +173,8 @@ public class ElicitationMode extends AikumaActivity{ ...@@ -165,7 +173,8 @@ public class ElicitationMode extends AikumaActivity{
if (!isSelectionnable(mPath)) { if (!isSelectionnable(mPath)) {
Log.d("mPath", mPath.getAbsolutePath() + " is not selectionnable"); Log.d("mPath", mPath.getAbsolutePath() + " is not selectionnable");
loadFileList(mPath, fileType); loadFileList(mPath, fileType);
showAudioFilebrowserDialog(); if(mFileList.length > 0)
showAudioFilebrowserDialog();
} else { } else {
Log.d("mPath", mPath.getAbsolutePath() + " is selectionnable"); Log.d("mPath", mPath.getAbsolutePath() + " is selectionnable");
actionSelectedFile(); actionSelectedFile();
...@@ -182,18 +191,8 @@ public class ElicitationMode extends AikumaActivity{ ...@@ -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.setContentView(view);
dialog.setTitle("Import file");
dialog.show(); dialog.show();
return dialog; return dialog;
} }
...@@ -208,17 +207,21 @@ public class ElicitationMode extends AikumaActivity{ ...@@ -208,17 +207,21 @@ public class ElicitationMode extends AikumaActivity{
int i = 0; int i = 0;
File[] files = f.listFiles(); File[] files = f.listFiles();
switch (selectedFileType) { switch (selectedFileType) {
case 1: case ElicitationMode.IMAGE_MODE:
while( i < files.length && files[i].isFile() && (files[i].getAbsolutePath().contains(".jpg") || files[i].getAbsolutePath().contains("jpeg"))) { while( i < files.length && files[i].isFile() && (files[i].getAbsolutePath().contains(".jpg") || files[i].getAbsolutePath().contains(".jpeg"))) {
i++; i++;
} }
return files.length == i && i>0; return files.length == i && i>0;
case 2: case ElicitationMode.TEXT_MODE:
while(files[i].isFile() && files[i].getAbsolutePath().contains(".mp4")) { while(files[i].isFile() && files[i].getAbsolutePath().contains(".mp4")) {
i++; i++;
} }
return files.length == i;