Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
lig-aikuma
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Laurent Besacier
lig-aikuma
Commits
e6f01dfa
Commit
e6f01dfa
authored
May 31, 2016
by
hanriaca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding Image mode for elicitation, works with progression saving mode
parent
3a27e201
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
864 additions
and
127 deletions
+864
-127
Aikuma/AndroidManifest.xml
Aikuma/AndroidManifest.xml
+3
-1
Aikuma/res/drawable/type_folder_image.png
Aikuma/res/drawable/type_folder_image.png
+0
-0
Aikuma/res/layout-xlarge/content_dialog_selected_folder_frag.xml
...res/layout-xlarge/content_dialog_selected_folder_frag.xml
+29
-0
Aikuma/res/layout-xlarge/elicitation_image.xml
Aikuma/res/layout-xlarge/elicitation_image.xml
+173
-0
Aikuma/res/layout/elicitation_image.xml
Aikuma/res/layout/elicitation_image.xml
+173
-0
Aikuma/res/values/strings.xml
Aikuma/res/values/strings.xml
+1
-0
Aikuma/src/org/lp20/aikuma/ui/ElicitationMode.java
Aikuma/src/org/lp20/aikuma/ui/ElicitationMode.java
+98
-29
Aikuma/src/org/lp20/aikuma/ui/ListFolderAdapter.java
Aikuma/src/org/lp20/aikuma/ui/ListFolderAdapter.java
+112
-0
Aikuma/src/org/lp20/aikuma/ui/RecordElicitation.java
Aikuma/src/org/lp20/aikuma/ui/RecordElicitation.java
+272
-96
Aikuma/src/org/lp20/aikuma/ui/RecordingMetadataLig.java
Aikuma/src/org/lp20/aikuma/ui/RecordingMetadataLig.java
+3
-0
Aikuma/src/org/lp20/aikuma/ui/RespeakingSelection.java
Aikuma/src/org/lp20/aikuma/ui/RespeakingSelection.java
+0
-1
No files found.
Aikuma/AndroidManifest.xml
View file @
e6f01dfa
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
package=
"org.lp20.aikuma2"
package=
"org.lp20.aikuma2"
android:versionCode=
"010005"
android:versionCode=
"010005"
android:versionName=
"0.8.4"
>
android:versionName=
"0.8.4"
>
<uses-sdk
android:minSdkVersion=
"1
4
"
/>
<uses-sdk
android:minSdkVersion=
"1
6
"
/>
<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"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
...
@@ -197,6 +197,8 @@
...
@@ -197,6 +197,8 @@
<activity
android:name=
"org.lp20.aikuma.ui.TranslationSelection"
></activity>
<activity
android:name=
"org.lp20.aikuma.ui.TranslationSelection"
></activity>
<activity
android:name=
"org.lp20.aikuma.ui.RecordElicitation"
<activity
android:name=
"org.lp20.aikuma.ui.RecordElicitation"
android:configChanges=
"orientation|screenSize"
></activity>
android:configChanges=
"orientation|screenSize"
></activity>
<activity
android:name=
"org.lp20.aikuma.ui.RecordElicitationImage"
android:configChanges=
"orientation|screenSize"
></activity>
<activity
android:name=
"org.lp20.aikuma.ui.CheckMode"
<activity
android:name=
"org.lp20.aikuma.ui.CheckMode"
android:configChanges=
"orientation|screenSize"
></activity>
android:configChanges=
"orientation|screenSize"
></activity>
<activity
android:name=
"org.lp20.aikuma.ui.CheckWordVariant"
<activity
android:name=
"org.lp20.aikuma.ui.CheckWordVariant"
...
...
Aikuma/res/drawable/type_folder_image.png
0 → 100644
View file @
e6f01dfa
7.96 KB
Aikuma/res/layout-xlarge/content_dialog_selected_folder_frag.xml
0 → 100644
View file @
e6f01dfa
<?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>
Aikuma/res/layout-xlarge/elicitation_image.xml
0 → 100644
View file @
e6f01dfa
<?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, read the bold line."
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>
<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"
>
<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/img_orig"
>
<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
Aikuma/res/layout/elicitation_image.xml
0 → 100644
View file @
e6f01dfa
<?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, read the bold line."
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>
<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"
>
<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/img_orig"
>
<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
Aikuma/res/values/strings.xml
View file @
e6f01dfa
...
@@ -138,4 +138,5 @@
...
@@ -138,4 +138,5 @@
<string
name=
"currentLine"
>
currentLine
</string>
<string
name=
"currentLine"
>
currentLine
</string>
<string
name=
"recordDuration"
>
duration
</string>
<string
name=
"recordDuration"
>
duration
</string>
<string
name=
"translation"
>
translation
</string>
<string
name=
"translation"
>
translation
</string>
<string
name=
"selectedFileType"
>
selectedFileType
</string>
</resources>
</resources>
Aikuma/src/org/lp20/aikuma/ui/ElicitationMode.java
View file @
e6f01dfa
package
org.lp20.aikuma.ui
;
package
org.lp20.aikuma.ui
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileFilter
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileNotFoundException
;
import
java.io.FilenameFilter
;
import
java.io.FilenameFilter
;
...
@@ -27,8 +28,11 @@ import android.preference.PreferenceManager;
...
@@ -27,8 +28,11 @@ import android.preference.PreferenceManager;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
android.view.View.OnClickListener
;
import
android.view.View.OnClickListener
;
import
android.widget.AdapterView
;
import
android.widget.Button
;
import
android.widget.Button
;
import
android.widget.ListView
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
android.widget.AdapterView.OnItemClickListener
;
public
class
ElicitationMode
extends
AikumaActivity
{
public
class
ElicitationMode
extends
AikumaActivity
{
...
@@ -41,6 +45,16 @@ public class ElicitationMode extends AikumaActivity{
...
@@ -41,6 +45,16 @@ public class ElicitationMode extends AikumaActivity{
private
String
fileType
;
private
String
fileType
;
private
String
title
;
private
String
title
;
public
static
final
int
TEXT_MODE
=
0
;
public
static
final
int
IMAGE_MODE
=
1
;
public
static
final
int
VIDEO_MODE
=
2
;
/**
* used to know if the user press text, image or video button
* this field contains 0 (text), 1 (image) or 2(video)
*/
private
int
selectedFileType
;
/** Called when the activity is first created. */
/** Called when the activity is first created. */
@Override
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
public
void
onCreate
(
Bundle
savedInstanceState
)
{
...
@@ -51,6 +65,7 @@ public class ElicitationMode extends AikumaActivity{
...
@@ -51,6 +65,7 @@ public class ElicitationMode extends AikumaActivity{
public
void
onImportClick
(
View
_view
)
{
public
void
onImportClick
(
View
_view
)
{
switch
(
_view
.
getId
())
{
switch
(
_view
.
getId
())
{
case
R
.
id
.
button_byText
:
case
R
.
id
.
button_byText
:
selectedFileType
=
TEXT_MODE
;
Log
.
i
(
TAG
,
"Import text; view id: "
+
_view
.
getId
());
Log
.
i
(
TAG
,
"Import text; view id: "
+
_view
.
getId
());
mPath
=
Environment
.
getExternalStorageDirectory
();
mPath
=
Environment
.
getExternalStorageDirectory
();
fileType
=
".txt"
;
fileType
=
".txt"
;
...
@@ -58,14 +73,15 @@ public class ElicitationMode extends AikumaActivity{
...
@@ -58,14 +73,15 @@ public class ElicitationMode extends AikumaActivity{
importContent
();
importContent
();
break
;
break
;
case
R
.
id
.
button_byImage
:
case
R
.
id
.
button_byImage
:
selectedFileType
=
IMAGE_MODE
;
Log
.
i
(
TAG
,
"Import image; view id: "
+
_view
.
getId
());
Log
.
i
(
TAG
,
"Import image; view id: "
+
_view
.
getId
());
mPath
=
Environment
.
getExternalStorageDirectory
();
mPath
=
Environment
.
getExternalStorageDirectory
();
fileType
=
".jpg"
;
fileType
=
".jpg"
;
title
=
"Import image file"
;
title
=
"Import image file"
;
Toast
.
makeText
(
this
,
"This feature is not yet available..."
,
Toast
.
LENGTH_LONG
).
show
();
importContent
();
// importContent();
break
;
break
;
case
R
.
id
.
button_byVideo
:
case
R
.
id
.
button_byVideo
:
selectedFileType
=
VIDEO_MODE
;
Log
.
i
(
TAG
,
"Import video; view id: "
+
_view
.
getId
());
Log
.
i
(
TAG
,
"Import video; view id: "
+
_view
.
getId
());
mPath
=
Environment
.
getExternalStorageDirectory
();
mPath
=
Environment
.
getExternalStorageDirectory
();
fileType
=
".avi"
;
fileType
=
".avi"
;
...
@@ -98,7 +114,16 @@ public class ElicitationMode extends AikumaActivity{
...
@@ -98,7 +114,16 @@ public class ElicitationMode extends AikumaActivity{
return
filename
.
contains
(
fileType
)
||
sel
.
isDirectory
();
return
filename
.
contains
(
fileType
)
||
sel
.
isDirectory
();
}
}
};
};
mFileList
=
mPath
.
list
(
filter
);
if
(
selectedFileType
==
ElicitationMode
.
TEXT_MODE
)
mFileList
=
mPath
.
list
(
filter
);
else
{
mFileList
=
mPath
.
list
(
new
FilenameFilter
()
{
@Override
public
boolean
accept
(
File
dir
,
String
filename
)
{
return
new
File
(
dir
,
filename
).
isDirectory
();
}
});
}
}
}
else
{
else
{
mFileList
=
new
String
[
0
];
mFileList
=
new
String
[
0
];
...
@@ -120,50 +145,94 @@ public class ElicitationMode extends AikumaActivity{
...
@@ -120,50 +145,94 @@ public class ElicitationMode extends AikumaActivity{
* Copied from RespeakingSelection.java
* Copied from RespeakingSelection.java
*/
*/
public
class
FilebrowserDialogFragment
extends
DialogFragment
{
public
class
FilebrowserDialogFragment
extends
DialogFragment
{
ListView
listElement
;
@Override
@Override
public
Dialog
onCreateDialog
(
Bundle
savedInstanceState
)
{
public
Dialog
onCreateDialog
(
Bundle
savedInstanceState
)
{
Dialog
dialog
=
null
;
View
view
=
getActivity
().
getLayoutInflater
().
inflate
(
R
.
layout
.
dialog_select_file_frag
,
null
);
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
getActivity
());
listElement
=
(
ListView
)
view
.
findViewById
(
R
.
id
.
listItemFile
);
ListFolderAdapter
adapter
=
new
ListFolderAdapter
(
getActivity
(),
mFileList
,
mPath
,
selectedFileType
);
builder
.
setTitle
(
title
);
listElement
.
setAdapter
(
adapter
);;
if
(
mFileList
==
null
)
{
Log
.
e
(
TAG
,
"import file - Showing file picker before loading the file list"
);
listElement
.
setOnItemClickListener
(
new
OnItemClickListener
()
{
dialog
=
builder
.
create
();
@Override
return
dialog
;
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
}
dismiss
();
builder
.
setItems
(
mFileList
,
new
DialogInterface
.
OnClickListener
()
{
mChosenFile
=
mFileList
[
position
];
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
mChosenFile
=
mFileList
[
which
];
Log
.
i
(
TAG
,
"mChosenFile: "
+
mChosenFile
);
Log
.
i
(
TAG
,
"mChosenFile: "
+
mChosenFile
);
mPath
=
new
File
(
mPath
,
mChosenFile
);
mPath
=
new
File
(
mPath
,
mChosenFile
);
if
(
mPath
.
isDirectory
())
{
if
(
mPath
.
isDirectory
())
{
loadFileList
(
mPath
,
fileType
);
if
(!
isSelectionnable
(
mPath
))
{
showAudioFilebrowserDialog
();
Log
.
d
(
"mPath"
,
mPath
.
getAbsolutePath
()
+
" is not selectionnable"
);
}
else
{
loadFileList
(
mPath
,
fileType
);
if
(
fileType
==
".txt"
)
{
showAudioFilebrowserDialog
();
Toast
.
makeText
(
ElicitationMode
.
this
,
"Selected text: "
+
mPath
,
Toast
.
LENGTH_LONG
).
show
();
}
else
{
Log
.
d
(
"mPath"
,
mPath
.
getAbsolutePath
()
+
" is selectionnable"
);
actionSelectedFile
();
}
}
}
else
{
if
(
fileType
==
".jpg"
)
{
if
(
fileType
==
".jpg"
)
{
Toast
.
makeText
(
ElicitationMode
.
this
,
"Selected
image
: "
+
mPath
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
ElicitationMode
.
this
,
"Selected
folder
: "
+
mPath
,
Toast
.
LENGTH_LONG
).
show
();
}
}
if
(
fileType
==
".avi"
)
{
if
(
fileType
==
".avi"
)
{
Toast
.
makeText
(
ElicitationMode
.
this
,
"Selected video: "
+
mPath
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
ElicitationMode
.
this
,
"Selected video: "
+
mPath
,
Toast
.
LENGTH_LONG
).
show
();
}
}
actionSelectedFile
();
Intent
intent
=
new
Intent
(
getActivity
(),
RecordingMetadataLig
.
class
);
intent
.
putExtra
(
importFileName
,
mPath
.
getAbsolutePath
());
Log
.
i
(
TAG
,
"selected file: "
+
mPath
.
getAbsolutePath
());
intent
.
putExtra
(
ELICITATION
,
true
);
startActivity
(
intent
);
}
}
}
}
});
});
dialog
=
builder
.
show
();
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
.
show
();
return
dialog
;
return
dialog
;
}
}
}
}
/**
* Function called when we need to know if an entity is queryable
* @param f the selected file (the entity)
* @return true if the file is queryable, false if not.
*/
private
boolean
isSelectionnable
(
File
f
)
{
int
i
=
0
;
File
[]
files
=
f
.
listFiles
();
switch
(
selectedFileType
)
{