Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Ear recognition
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Boston University
Ear recognition
Commits
1993caeb
Commit
1993caeb
authored
Jan 15, 2016
by
Josejulio Martínez Magaña
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started building the third gen interaction.
parent
25a16c30
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
104 additions
and
606 deletions
+104
-606
EarCaptureActivity.java
...aluxoft/earrecognition/activities/EarCaptureActivity.java
+1
-134
SelectFollowupActivity.java
...oft/earrecognition/activities/SelectFollowupActivity.java
+6
-13
IntentSearchFeatures.java
.../aluxoft/earrecognition/intents/IntentSearchFeatures.java
+83
-0
EarDataLoaderCommcare.java
.../aluxoft/earrecognition/loader/EarDataLoaderCommcare.java
+2
-0
MainActivity.java
.../java/com/aluxoft/earrecognition/unused/MainActivity.java
+0
-386
activity_main.xml
app/src/main/res/layout/activity_main.xml
+0
-73
open_commcare_layout.xml
app/src/main/res/layout/open_commcare_layout.xml
+12
-0
No files found.
app/src/main/java/com/aluxoft/earrecognition/activities/EarCaptureActivity.java
View file @
1993caeb
...
...
@@ -26,14 +26,6 @@ import java.io.IOException;
*/
public
class
EarCaptureActivity
extends
Activity
{
Button
getImage
;
Button
returnToCommCare
;
File
location
;
public
static
final
int
KEY_REQUEST_IMAGE
=
1
;
public
static
final
int
KEY_SIFT_ACTIVITY_LOADER
=
2
;
/*
* (non-Javadoc)
* @see android.app.Activity#onCreate(android.os.Bundle)
...
...
@@ -42,132 +34,7 @@ public class EarCaptureActivity extends Activity {
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
Fabric
.
with
(
this
,
new
Crashlytics
());
setContentView
(
R
.
layout
.
activity_callout
);
/*
returnToCommCare = (Button)this.findViewById(R.id.button_commcare);
returnToCommCare.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent i = new Intent("org.commcare.dalvik.action.CommCareSession");
String sssd = "";
sssd +=
"COMMAND_ID" + " " + "root" + " "
+
"CASE_ID" + " " + "case_id" + " " + "99de08b8-7235-41ba-9dbe-d1e5d70575cf" + " " +
"COMMAND_ID" + " " + "m1-f1";
i.putExtra("ccodk_session_request", sssd);
EarCaptureActivity.this.startActivity(i);
}
});
// Load data from Commcare
Cursor c = this.managedQuery(Uri.parse("content://org.commcare.dalvik.case/casedb/case"), null, null, null, null);
for (int i=0;i<c.getColumnCount();++i) {
System.out.print(c.getColumnName(i) + "|");
}
System.out.println();
while (c.moveToNext()) {
for (int i=0;i<c.getColumnCount();++i) {
System.out.print(c.getString(i) + "|");
}
System.out.println();
}
*/
getImage
=
(
Button
)
this
.
findViewById
(
R
.
id
.
take_picture
);
getImage
.
setOnClickListener
(
new
OnClickListener
()
{
private
Toast
loginInCommCareToast
=
null
;
public
void
onClick
(
View
v
)
{
if
(!
EarDataLoaderCommcare
.
checkConnection
(
EarCaptureActivity
.
this
))
{
if
(
loginInCommCareToast
==
null
||
loginInCommCareToast
.
getView
().
getWindowVisibility
()
!=
View
.
VISIBLE
)
{
loginInCommCareToast
=
Toast
.
makeText
(
EarCaptureActivity
.
this
,
"Please login in CommCare application to proceed."
,
Toast
.
LENGTH_LONG
);
loginInCommCareToast
.
show
();
}
return
;
}
Intent
i
=
new
Intent
(
android
.
provider
.
MediaStore
.
ACTION_IMAGE_CAPTURE
);
try
{
location
=
ImageUtils
.
createTempImageFile
();
}
catch
(
IOException
e1
)
{
// TODO Auto-generated catch block
e1
.
printStackTrace
();
return
;
}
// if this gets modified, the onActivityResult in
// FormEntyActivity will also need to be updated.
i
.
putExtra
(
android
.
provider
.
MediaStore
.
EXTRA_OUTPUT
,
Uri
.
fromFile
(
location
));
try
{
startActivityForResult
(
i
,
KEY_REQUEST_IMAGE
);
}
catch
(
ActivityNotFoundException
e
)
{
Toast
.
makeText
(
EarCaptureActivity
.
this
,
"No Camera"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
});
if
(
this
.
getLastNonConfigurationInstance
()
!=
null
)
{
location
=
((
EarCaptureActivity
)
this
.
getLastNonConfigurationInstance
()).
location
;
}
if
(
savedInstanceState
!=
null
)
{
location
=
new
File
(
savedInstanceState
.
getString
(
"location"
));
}
}
/* (non-Javadoc)
* @see android.app.Activity#onActivityResult(int, int, android.content.Intent)
*/
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
if
(
requestCode
==
KEY_REQUEST_IMAGE
)
{
//Go grab the image and set it's location
if
(
location
==
null
||
!
location
.
exists
())
{
location
=
null
;
}
else
{
String
path
=
location
.
getAbsolutePath
();
EarIdentifier
identifier
=
new
EarIdentifier
(
null
);
Intent
intent
=
new
Intent
(
"com.auriclon.activity_sift"
);
intent
.
putExtra
(
"image_path"
,
path
);
startActivityForResult
(
intent
,
KEY_SIFT_ACTIVITY_LOADER
);
}
}
else
if
(
requestCode
==
KEY_SIFT_ACTIVITY_LOADER
)
{
startActivity
(
data
);
}
}
/* (non-Javadoc)
* @see android.app.Activity#onResume()
*/
@Override
protected
void
onResume
()
{
super
.
onResume
();
}
/* (non-Javadoc)
* @see android.app.Activity#onSaveInstanceState(android.os.Bundle)
*/
@Override
protected
void
onSaveInstanceState
(
Bundle
outState
)
{
super
.
onSaveInstanceState
(
outState
);
if
(
location
!=
null
)
{
outState
.
putString
(
"location"
,
location
.
toString
());
}
}
/* (non-Javadoc)
* @see android.app.Activity#onRetainNonConfigurationInstance()
*/
@Override
public
Object
onRetainNonConfigurationInstance
()
{
return
this
;
setContentView
(
R
.
layout
.
open_commcare_layout
);
}
}
app/src/main/java/com/aluxoft/earrecognition/activities/SelectFollowupActivity.java
View file @
1993caeb
...
...
@@ -49,25 +49,18 @@ public class SelectFollowupActivity extends Activity {
topNListView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
Intent
intent
=
new
Intent
(
"org.commcare.dalvik.action.CommCareSession"
);
String
sssd
=
""
;
sssd
+=
"COMMAND_ID"
+
" "
+
"m1"
+
" "
+
"CASE_ID"
+
" "
+
"case_id"
+
" "
+
earIdList
.
getTop
().
get
(
position
).
person
.
getCaseId
()
+
" "
/* + // "99de08b8-7235-41ba-9dbe-d1e5d70575cf" + " " +
"COMMAND_ID" + " " + "m1-f0" */
;
intent
.
putExtra
(
"ccodk_session_request"
,
sssd
);
SelectFollowupActivity
.
this
.
startActivityForResult
(
intent
,
COMMCARE_FOLLOW_UP
);
Intent
intent
=
new
Intent
();
intent
.
putExtra
(
"case_id"
,
earIdList
.
getTop
().
get
(
position
).
person
.
getCaseId
());
SelectFollowupActivity
.
this
.
setResult
(
Activity
.
RESULT_OK
,
intent
);
finish
();
}
});
registerButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
Intent
i
=
new
Intent
(
"org.commcare.dalvik.action.CommCareSession"
);
String
sssd
=
"COMMAND_ID"
+
" "
+
"root"
+
" "
+
"COMMAND_ID"
+
" "
+
"m0-f0"
;
i
.
putExtra
(
"ccodk_session_request"
,
sssd
);
SelectFollowupActivity
.
this
.
startActivityForResult
(
i
,
COMMCARE_REGISTER
);
SelectFollowupActivity
.
this
.
setResult
(
Activity
.
RESULT_OK
,
new
Intent
());
finish
();
}
});
}
...
...
app/src/main/java/com/aluxoft/earrecognition/intents/IntentSearchFeatures.java
View file @
1993caeb
package
com
.
aluxoft
.
earrecognition
.
intents
;
import
android.app.Activity
;
import
android.content.ActivityNotFoundException
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.widget.Toast
;
import
com.aluxoft.earrecognition.EarIdentifier
;
import
com.aluxoft.earrecognition.activities.SelectFollowupActivity
;
import
com.aluxoft.earrecognition.utils.ImageUtils
;
import
com.crashlytics.android.Crashlytics
;
import
java.io.File
;
import
java.io.IOException
;
import
io.fabric.sdk.android.Fabric
;
/**
* Created by dkor on 11/13/15.
*/
public
class
IntentSearchFeatures
extends
Activity
{
private
File
location
;
public
static
final
int
KEY_REQUEST_IMAGE
=
1
;
public
static
final
int
KEY_SIFT_ACTIVITY_LOADER
=
2
;
public
static
final
int
KEY_TOP_X
=
3
;
@Override
protected
void
onCreate
(
Bundle
saveInstanceState
)
{
super
.
onCreate
(
saveInstanceState
);
Fabric
.
with
(
this
,
new
Crashlytics
());
this
.
takePhoto
();
// Mostrar la camara
/*
Intent returningIntent = new Intent(getIntent());
returningIntent.putExtra(
"ear_search_result",
"Juan");
this.setResult(Activity.RESULT_OK, returningIntent);
finish();
*/
}
public
boolean
takePhoto
()
{
Intent
i
=
new
Intent
(
android
.
provider
.
MediaStore
.
ACTION_IMAGE_CAPTURE
);
try
{
location
=
ImageUtils
.
createTempImageFile
();
}
catch
(
IOException
e1
)
{
e1
.
printStackTrace
();
return
false
;
}
// if this gets modified, the onActivityResult in
// FormEntyActivity will also need to be updated.
i
.
putExtra
(
android
.
provider
.
MediaStore
.
EXTRA_OUTPUT
,
Uri
.
fromFile
(
location
));
try
{
startActivityForResult
(
i
,
KEY_REQUEST_IMAGE
);
}
catch
(
ActivityNotFoundException
e
)
{
return
false
;
}
return
true
;
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
if
(
requestCode
==
KEY_REQUEST_IMAGE
)
{
//Go grab the image and set it's location
if
(
location
==
null
||
!
location
.
exists
())
{
location
=
null
;
}
else
{
String
path
=
location
.
getAbsolutePath
();
EarIdentifier
identifier
=
new
EarIdentifier
(
null
);
Intent
intent
=
new
Intent
(
"com.auriclon.activity_sift"
);
intent
.
putExtra
(
"image_path"
,
path
);
startActivityForResult
(
intent
,
KEY_SIFT_ACTIVITY_LOADER
);
}
}
else
if
(
requestCode
==
KEY_SIFT_ACTIVITY_LOADER
)
{
startActivityForResult
(
data
,
KEY_TOP_X
);
}
else
if
(
requestCode
==
KEY_TOP_X
)
{
String
case_id
=
data
.
getStringExtra
(
"case_id"
);
if
(
case_id
==
null
)
{
case_id
=
""
;
}
Intent
returningIntent
=
new
Intent
(
getIntent
());
returningIntent
.
putExtra
(
"ear_search_result"
,
case_id
);
this
.
setResult
(
Activity
.
RESULT_OK
,
returningIntent
);
finish
();
}
}
@Override
protected
void
onSaveInstanceState
(
Bundle
outState
)
{
super
.
onSaveInstanceState
(
outState
);
if
(
location
!=
null
)
{
outState
.
putString
(
"location"
,
location
.
toString
());
}
}
}
app/src/main/java/com/aluxoft/earrecognition/loader/EarDataLoaderCommcare.java
View file @
1993caeb
...
...
@@ -52,6 +52,8 @@ public class EarDataLoaderCommcare extends EarDataLoader {
gender = caseCursor.getString(caseCursor.getColumnIndex("value"));
} else */
if
(
datumId
.
equals
(
"features"
))
{
features
=
caseCursor
.
getString
(
caseCursor
.
getColumnIndex
(
"value"
));
}
else
if
(
datumId
.
equals
(
"case_id_internal"
))
{
// ToDo: Remplazarlo con una mejor forma
caseId
=
caseCursor
.
getString
(
caseCursor
.
getColumnIndex
(
"value"
));
}
}
if
(
/*gender == null || */
features
==
null
)
{
...
...
app/src/main/java/com/aluxoft/earrecognition/unused/MainActivity.java
deleted
100644 → 0
View file @
25a16c30
This diff is collapsed.
Click to expand it.
app/src/main/res/layout/activity_main.xml
View file @
1993caeb
...
...
@@ -10,79 +10,6 @@
android:paddingBottom=
"@dimen/activity_vertical_margin"
tools:context=
".MainActivity"
android:id=
"@+id/MainActivity"
>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Capture First ear"
android:id=
"@+id/button"
android:layout_marginTop=
"47dp"
android:layout_alignParentTop=
"true"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_alignRight=
"@+id/button2"
android:layout_alignEnd=
"@+id/button2"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Capture Second ear"
android:id=
"@+id/button2"
android:layout_centerVertical=
"true"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_below=
"@+id/imageView"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Capture ear to identify"
android:id=
"@+id/toidentify"
android:layout_centerVertical=
"true"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_below=
"@+id/imageView2"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/imageView"
android:layout_below=
"@+id/button"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_alignRight=
"@+id/button"
android:layout_alignEnd=
"@+id/button"
android:maxHeight=
"150dp"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/imageView2"
android:layout_below=
"@+id/button2"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_alignRight=
"@+id/button2"
android:layout_alignEnd=
"@+id/button2"
android:maxHeight=
"150dp"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/imageView3"
android:layout_below=
"@+id/toidentify"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_alignRight=
"@+id/button2"
android:layout_alignEnd=
"@+id/button2"
android:maxHeight=
"150dp"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Identify"
android:id=
"@+id/button3"
android:layout_below=
"@+id/imageView3"
android:layout_alignParentLeft=
"true"
/>
</RelativeLayout>
</ScrollView>
\ No newline at end of file
app/src/main/res/layout/open_commcare_layout.xml
0 → 100644
View file @
1993caeb
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<TextView
android:layout_width=
"266dp"
android:layout_height=
"wrap_content"
android:textAppearance=
"?android:attr/textAppearanceLarge"
android:text=
"Open Commcare to start"
android:id=
"@+id/textView2"
/>
</LinearLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment