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
34967c0f
Commit
34967c0f
authored
Oct 02, 2015
by
Josejulio Martínez Magaña
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the API calls to integrate with CommCare.
Added intent to "pass the features".
parent
58ba81e7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
240 additions
and
3 deletions
+240
-3
app.iml
app/app.iml
+2
-2
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+19
-1
IntentCalloutTest.java
...in/java/com/aluxoft/earrecognition/IntentCalloutTest.java
+138
-0
IntentTransferingFeatures.java
...com/aluxoft/earrecognition/IntentTransferingFeatures.java
+46
-0
actity_transfering_features.xml
app/src/main/res/layout/actity_transfering_features.xml
+6
-0
activity_callout.xml
app/src/main/res/layout/activity_callout.xml
+29
-0
No files found.
app/app.iml
View file @
34967c0f
...
...
@@ -90,10 +90,10 @@
</content>
<orderEntry
type=
"jdk"
jdkName=
"Android API 21 Platform"
jdkType=
"Android SDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"library"
exported=
""
name=
"appcompat-v7-22.0.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"support-v4-22.0.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"support-annotations-22.0.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"bolts-android-1.2.1"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"
appcompat-v7
-22.0.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"
support-annotations
-22.0.0"
level=
"project"
/>
<orderEntry
type=
"module"
module-name=
"openCVLibrary2411"
exported=
""
/>
</component>
</module>
\ No newline at end of file
app/src/main/AndroidManifest.xml
View file @
34967c0f
...
...
@@ -2,6 +2,7 @@
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.aluxoft.earrecognition"
>
<uses-permission
android:name=
"org.commcare.dalvik.provider.cases.read"
/>
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
...
...
@@ -20,16 +21,33 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity> -->
<activity
<!--
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity> -->
<activity
android:name=
".IntentCalloutTest"
android:label=
"@string/app_name"
android:screenOrientation=
"portrait"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
".IntentTransferingFeatures"
>
<intent-filter>
<action
android:name=
"com.auriclon.features"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
</intent-filter>
</activity>
</application>
</manifest>
app/src/main/java/com/aluxoft/earrecognition/IntentCalloutTest.java
0 → 100644
View file @
34967c0f
package
com
.
aluxoft
.
earrecognition
;
import
android.app.Activity
;
import
android.content.ActivityNotFoundException
;
import
android.content.Intent
;
import
android.database.Cursor
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.view.View.OnClickListener
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
java.io.File
;
import
java.io.IOException
;
public
class
IntentCalloutTest
extends
Activity
{
Button
getImage
;
Button
returnToCommCare
;
File
location
;
public
static
final
int
KEY_REQUEST_IMAGE
=
1
;
/*
* (non-Javadoc)
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_callout
);
returnToCommCare
=
(
Button
)
this
.
findViewById
(
R
.
id
.
button_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
();
}
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
);
IntentCalloutTest
.
this
.
startActivity
(
i
);
}
});
getImage
=
(
Button
)
this
.
findViewById
(
R
.
id
.
extra_image_value
);
getImage
.
setOnClickListener
(
new
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
Intent
i
=
new
Intent
(
android
.
provider
.
MediaStore
.
ACTION_IMAGE_CAPTURE
);
try
{
location
=
File
.
createTempFile
(
"image"
+
System
.
currentTimeMillis
(),
".jpg"
);
}
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
(
IntentCalloutTest
.
this
,
"No Camera"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
});
if
(
this
.
getLastNonConfigurationInstance
()
!=
null
)
{
location
=
((
IntentCalloutTest
)
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
;
}
}
}
/* (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
;
}
}
app/src/main/java/com/aluxoft/earrecognition/IntentTransferingFeatures.java
0 → 100644
View file @
34967c0f
package
com
.
aluxoft
.
earrecognition
;
import
android.app.Activity
;
import
android.app.ProgressDialog
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
java.util.concurrent.Callable
;
import
bolts.Continuation
;
import
bolts.Task
;
/**
* Created by josejuliomartinez on 02/10/15.
*/
public
class
IntentTransferingFeatures
extends
Activity
{
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
ProgressDialog
loading
=
ProgressDialog
.
show
(
IntentTransferingFeatures
.
this
,
"Transfering"
,
"Please wait while transfering the features..."
);
loading
.
setCancelable
(
false
);
loading
.
setProgressStyle
(
ProgressDialog
.
STYLE_SPINNER
);
Task
.
callInBackground
(
new
Callable
<
Object
>()
{
@Override
public
Object
call
()
throws
Exception
{
synchronized
(
this
)
{
wait
(
1000
);
}
return
null
;
}
}).
continueWith
(
new
Continuation
<
Object
,
Object
>()
{
@Override
public
Object
then
(
Task
<
Object
>
task
)
throws
Exception
{
Intent
returningIntent
=
new
Intent
(
getIntent
());
returningIntent
.
putExtra
(
"odk_intent_data"
,
"The feature data should be here."
);
IntentTransferingFeatures
.
this
.
setResult
(
Activity
.
RESULT_OK
,
returningIntent
);
finish
();
return
null
;
}
},
Task
.
UI_THREAD_EXECUTOR
);
}
}
app/src/main/res/layout/actity_transfering_features.xml
0 → 100644
View file @
34967c0f
<?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"
>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/activity_callout.xml
0 → 100644
View file @
34967c0f
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:orientation=
"vertical"
>
<Button
android:id=
"@+id/extra_image_value"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Grab an Image!"
/>
<TextView
android:id=
"@+id/image_location"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:text=
"No Current Image"
/>
<Button
android:id=
"@+id/button_commcare"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Open CommCare"
/>
<TextView
android:id=
"@+id/textView2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"-"
/>
</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