-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from cmsc436/integration-library
First addition of a helper library to interact with third party apps
- Loading branch information
Showing
14 changed files
with
221 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
apply plugin: 'com.android.library' | ||
|
||
android { | ||
compileSdkVersion 25 | ||
buildToolsVersion "25.0.2" | ||
|
||
defaultConfig { | ||
minSdkVersion 22 | ||
targetSdkVersion 25 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
|
||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(include: ['*.jar'], dir: 'libs') | ||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | ||
exclude group: 'com.android.support', module: 'support-annotations' | ||
}) | ||
compile 'com.android.support:appcompat-v7:25.3.1' | ||
testCompile 'junit:junit:4.12' | ||
compile 'com.google.android.gms:play-services-auth:10.2.1' | ||
compile('com.google.api-client:google-api-client-android:1.22.0') { | ||
exclude group: 'org.apache.httpcomponents' | ||
exclude group: 'com.google.code.findbugs' | ||
} | ||
compile('com.google.apis:google-api-services-sheets:v4-rev466-1.22.0') { | ||
exclude group: 'org.apache.httpcomponents' | ||
exclude group: 'com.google.code.findbugs' | ||
} | ||
compile project(':sheets436') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /home/thomas/Android/Sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="edu.umd.cmsc436.frontendhelper"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true"> | ||
|
||
</application> | ||
|
||
</manifest> |
83 changes: 83 additions & 0 deletions
83
frontendhelper/src/main/java/edu/umd/cmsc436/frontendhelper/TrialMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package edu.umd.cmsc436.frontendhelper; | ||
|
||
import android.content.Intent; | ||
import android.support.annotation.Nullable; | ||
|
||
import edu.umd.cmsc436.sheets.Sheets; | ||
|
||
/** | ||
* Helper functions to get arguments from TRIAL actions | ||
*/ | ||
|
||
public class TrialMode { | ||
|
||
public static final String KEY_APPENDAGE = "appendage"; | ||
public static final String KEY_TRIAL_NUM = "trial num"; | ||
public static final String KEY_TRIAL_OUT_OF = "trial out of"; | ||
public static final String KEY_PATIENT_ID = "patient id"; | ||
public static final String KEY_SCORE = "score"; | ||
|
||
/** | ||
* Extract the Test Type from the intent | ||
* | ||
* Reuses the Sheets lib type for convenience | ||
* @param i the Intent from the front end, with the .TRIAL action | ||
* @return Null if the argument isn't found, TestType otherwise | ||
*/ | ||
@Nullable | ||
public static Sheets.TestType getAppendage (Intent i) { | ||
int temp = i.getIntExtra(KEY_APPENDAGE, -1); | ||
|
||
if (temp < 0 || temp >= Sheets.TestType.values().length) { | ||
return null; | ||
} | ||
|
||
return Sheets.TestType.values()[temp]; | ||
} | ||
|
||
/** | ||
* Get the current trial number from the frontend intent | ||
* | ||
* For display purposes | ||
* @param i intent from frontend, with .TRIAL action | ||
* @return the current trial, or -1 if no arg found | ||
*/ | ||
public static int getTrialNum (Intent i) { | ||
return i.getIntExtra(KEY_TRIAL_NUM, -1); | ||
} | ||
|
||
/** | ||
* Get the total number of trials from the frontend intent | ||
* | ||
* For display purposes | ||
* @param i intent from frontend, with .TRIAL action | ||
* @return the total number of trials, or -1 if no arg found | ||
*/ | ||
public static int getTrialOutOf (Intent i) { | ||
return i.getIntExtra(KEY_TRIAL_OUT_OF, -1); | ||
} | ||
|
||
/** | ||
* Get the patient id for the current trial from the frontend intent | ||
* | ||
* To be used to store raw data for the patient | ||
* @param i intent from the frontend, with .TRIAL action | ||
* @return the patient id, or null if not found | ||
*/ | ||
@Nullable | ||
public static String getPatientId (Intent i) { | ||
return i.getStringExtra(KEY_PATIENT_ID); | ||
} | ||
|
||
/** | ||
* Create a new intent to return a score result | ||
* @param score the score for the current single trial | ||
* @return an intent to be used with {@link android.app.Activity#setResult(int, Intent)} | ||
*/ | ||
public static Intent getResultIntent (float score) { | ||
Intent i = new Intent(); | ||
i.getExtras().putFloat(KEY_SCORE, score); | ||
|
||
return i; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="colorPrimary436">#FF9933</color> | ||
<color name="colorPrimaryDark436">#ff7700</color> | ||
<color name="colorAccent436">#003399</color> | ||
<color name="colorAccentLight436">#99CCCC</color> | ||
<color name="colorBackground436">#CCCCCC</color> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<resources> | ||
<string name="app_name">frontendhelper</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
include ':app' | ||
include ':app', ':frontendhelper', ':sheets436' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
configurations.maybeCreate("default") | ||
artifacts.add("default", file('sheets436-0.0.5-release.aar')) |
Binary file not shown.