Merge branch 'master' into two_oh_one
Conflicts: AffdexMe/app/src/main/java/com/affectiva/affdexme/DrawingView.java AffdexMe/app/src/main/java/com/affectiva/affdexme/MainActivity.java AffdexMe/app/src/main/res/drawable/camera_button_selector.xml AffdexMe/app/src/main/res/drawable/settings_button_selector.xml
8
.gitignore
vendored
|
@ -25,11 +25,3 @@ proguard/
|
|||
|
||||
# Log Files
|
||||
*.log
|
||||
|
||||
#Affectiva SDK files
|
||||
AffdexMe/app/libs/*
|
||||
AffdexMe/app/src/main/jniLibs/*
|
||||
AffdexMe/app/src/main/assets/Affdex
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="LOCAL" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.4" />
|
||||
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.2.1" />
|
||||
<option name="gradleJvm" value="1.7" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
|
|
|
@ -12,12 +12,10 @@
|
|||
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
|
||||
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
|
||||
<afterSyncTasks>
|
||||
<task>generateDebugAndroidTestSources</task>
|
||||
<task>generateDebugSources</task>
|
||||
</afterSyncTasks>
|
||||
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
|
@ -86,11 +84,13 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 22 Platform (1)" jdkType="Android SDK" />
|
||||
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="dagger-1.2.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="Affdex-sdk" level="project" />
|
||||
<orderEntry type="library" exported="" name="javax.inject-1" level="project" />
|
||||
<orderEntry type="library" exported="" name="Affdex-sdk" level="project" />
|
||||
<orderEntry type="library" exported="" name="gson-2.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="Affdex-sdk-javadoc" level="project" />
|
||||
<orderEntry type="library" exported="" name="flurry-analytics-4.1.0" level="project" />
|
||||
</component>
|
||||
</module>
|
|
@ -8,8 +8,8 @@ android {
|
|||
applicationId "com.affectiva.affdexme"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 22
|
||||
versionCode 18
|
||||
versionName "2.0.18b"
|
||||
versionCode 14
|
||||
versionName "2.0.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
@ -20,9 +20,19 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
//gson is necessary for the license to be parsed
|
||||
compile 'com.google.code.gson:gson:2.3'
|
||||
|
||||
//include the Affdex SDK jars
|
||||
compile files('libs/Affdex-sdk.jar')
|
||||
compile files('libs/Affdex-sdk-javadoc.jar')
|
||||
compile files('libs/dagger-1.2.2.jar')
|
||||
compile files('libs/flurry-analytics-4.1.0.jar')
|
||||
compile files('libs/javax.inject-1.jar')
|
||||
|
||||
//although the use of the CameraDetector class in this project does not require it, you may have to include
|
||||
//the following dependencies if you use other features of the Affdex SDK
|
||||
//compile 'com.android.support:support-v4:22.2.0'
|
||||
//compile 'com.google.android.gms:play-services:7.5.0'
|
||||
|
||||
}
|
||||
|
|
33
AffdexMe/app/proguard-rules.pro
vendored
|
@ -12,8 +12,6 @@
|
|||
#prevent proguard from warning us about not including the GooglePlay dependency
|
||||
-dontwarn **
|
||||
|
||||
-keepattributes Exceptions,InnerClasses,Signature,Deprecated, SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
|
||||
|
||||
#keep all classes (otherwise Proguard may remove classes that use reflection, injection, Gson, etc...)
|
||||
-keep class sun.**
|
||||
-keepclassmembers class sun.** {*;}
|
||||
|
@ -27,20 +25,19 @@
|
|||
|
||||
#keep certain class members (otherwise Proguard would strip the members of these classes)
|
||||
-keep class com.**
|
||||
-keepclassmembers class !com.affectiva.affdexme.MainActivity,!com.affectiva.android.affdex.sdk.detector.Detector {*;}
|
||||
-keepclassmembers class com.affectiva.android.affdex.sdk.detector.Detector {
|
||||
public void setDetect**;
|
||||
}
|
||||
-keepclassmembers class com.affectiva.android.affdex.sdk.detector.A* { *; }
|
||||
-keepclassmembers class com.affectiva.android.affdex.sdk.detector.B* { *; }
|
||||
-keepclassmembers class com.affectiva.android.affdex.sdk.detector.I* { *; }
|
||||
-keepclassmembers class com.affectiva.android.affdex.sdk.detector.L* { *; }
|
||||
-keepclassmembers class com.affectiva.android.affdex.sdk.Frame { *; }
|
||||
|
||||
# Dagger
|
||||
-dontwarn dagger.internal.codegen.**
|
||||
-keepclassmembers,allowobfuscation class * {
|
||||
@javax.inject.* *;
|
||||
@dagger.* *;
|
||||
<init>();
|
||||
}
|
||||
-keep class dagger.* { *; }
|
||||
-keep class javax.inject.* { *; }
|
||||
-keep class * extends dagger.internal.Binding
|
||||
-keep class * extends dagger.internal.ModuleAdapter
|
||||
-keep class * extends dagger.internal.StaticInjection
|
||||
|
||||
-keepclassmembers class com.affectiva.affdexme.DrawingView {*;}
|
||||
-keepclassmembers class com.affectiva.affdexme.MetricView {*;}
|
||||
-keepclassmembers class com.affectiva.affdexme.GradientMetricView {*;}
|
||||
|
||||
-keepclassmembers class * {
|
||||
@javax.inject.* *;
|
||||
@dagger.* *;
|
||||
<init>();
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.affectiva.affdexme" >
|
||||
|
||||
<uses-sdk
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="16"
|
||||
android:targetSdkVersion="22" />
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
|||
</activity>
|
||||
<activity
|
||||
android:name=".SettingsActivity"
|
||||
android:parentActivityName="com.affectiva.affdexme.MainActivity"
|
||||
android:parentActivityName=".MainActivity"
|
||||
android:theme="@style/EditPreferencesTheme">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
|
|
|
@ -325,7 +325,7 @@ public class DrawingView extends SurfaceView implements SurfaceHolder.Callback {
|
|||
|
||||
drawingThread = new DrawingThread(surfaceHolder, drawingViewConfig);
|
||||
}
|
||||
|
||||
|
||||
public void setTypeface(Typeface face) {
|
||||
drawingViewConfig.textPaint.setTypeface(face);
|
||||
drawingViewConfig.textBorderPaint.setTypeface(face);
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.os.Bundle;
|
|||
import android.os.SystemClock;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceView;
|
||||
|
@ -242,8 +243,9 @@ public class MainActivity extends Activity
|
|||
* that view will be painted with what the camera sees.
|
||||
*/
|
||||
detector = new CameraDetector(this, cameraType, cameraView);
|
||||
//TODO: this method SHOULD NOT be included in sample code release (customer should enter their own license file);
|
||||
// NOTE: uncomment the line below and replace "YourLicenseFile" with your license file, which should be stored in /assets/Affdex/
|
||||
//detector.setLicensePath("YourLicenseFile");
|
||||
detector.setLicensePath("YourLicenseFile");
|
||||
detector.setImageListener(this);
|
||||
detector.setFaceListener(this);
|
||||
detector.setOnCameraEventListener(this);
|
||||
|
@ -258,7 +260,6 @@ public class MainActivity extends Activity
|
|||
restoreApplicationSettings();
|
||||
setMenuVisible(true);
|
||||
isMenuShowingForFirstTime = true;
|
||||
mainWindowResumedTasks();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -337,6 +338,23 @@ public class MainActivity extends Activity
|
|||
numberOfFrames = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* We want to start the camera as late as possible, so it does not freeze the application before it has been visually resumed.
|
||||
* We thus post a runnable that will take care of starting the camera.
|
||||
* We also reset variables used to calculate the Processed Frames Per Second.
|
||||
*/
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
if (hasFocus && isFrontFacingCameraDetected) {
|
||||
cameraView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mainWindowResumedTasks();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void mainWindowResumedTasks() {
|
||||
|
||||
startDetector();
|
||||
|
@ -345,7 +363,6 @@ public class MainActivity extends Activity
|
|||
progressBarLayout.setVisibility(View.GONE);
|
||||
}
|
||||
resetFPSCalculations();
|
||||
|
||||
cameraView.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -423,7 +440,7 @@ public class MainActivity extends Activity
|
|||
* If the user has selected to have facial tracking dots or measurements drawn, we use face.getFacePoints() to send those points
|
||||
* to our drawing thread and also inform the thread what the valence score was, as that will determine the color
|
||||
* of the bounding box.
|
||||
*/
|
||||
*/
|
||||
if (drawingView.getDrawPointsEnabled() || drawingView.getDrawMeasurementsEnabled()) {
|
||||
drawingView.setMetrics(face.measurements.orientation.getRoll(), face.measurements.orientation.getYaw(), face.measurements.orientation.getPitch(), face.measurements.getInterocularDistance(), face.emotions.getValence());
|
||||
drawingView.updatePoints(face.getFacePoints(),mirrorPoints);
|
||||
|
@ -577,7 +594,7 @@ public class MainActivity extends Activity
|
|||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
}
|
||||
|
||||
/* onCameraStarted event not available until SDK 2.02
|
||||
/* onCameraStarted is a feature of SDK 2.02, commenting out for 2.01
|
||||
@Override
|
||||
public void onCameraStarted(boolean b, Throwable throwable) {
|
||||
if (throwable != null) {
|
||||
|
@ -594,13 +611,16 @@ public class MainActivity extends Activity
|
|||
cameraPreviewWidth = cameraWidth;
|
||||
cameraPreviewHeight = cameraHeight;
|
||||
}
|
||||
drawingView.setThickness((int)(cameraWidth/100f));
|
||||
drawingView.setThickness((int)(cameraPreviewWidth/100f));
|
||||
|
||||
mainLayout.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int layoutWidth = mainLayout.getWidth();
|
||||
int layoutHeight = mainLayout.getHeight();
|
||||
//Get the screen width and height, and calculate the new app width/height based on the surfaceview aspect ratio.
|
||||
DisplayMetrics displaymetrics = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
|
||||
int layoutWidth = displaymetrics.widthPixels;
|
||||
int layoutHeight = displaymetrics.heightPixels;
|
||||
|
||||
if (cameraPreviewWidth == 0 || cameraPreviewHeight == 0 || layoutWidth == 0 || layoutHeight == 0)
|
||||
return;
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.graphics.Paint;
|
|||
import android.graphics.Typeface;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import java.lang.Math;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,10 +20,10 @@ import android.widget.Button;
|
|||
import android.widget.GridLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import static com.affectiva.affdexme.MainActivity.NUM_METRICS_DISPLAYED;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import static com.affectiva.affdexme.MainActivity.NUM_METRICS_DISPLAYED;
|
||||
/**
|
||||
* A fragment to display a graphical menu which allows the user to select which metrics to display.
|
||||
*
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package com.affectiva.affdexme;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.TextureView;
|
||||
import android.view.View;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.affectiva.affdexme;
|
||||
|
||||
import java.lang.StringBuilder;
|
||||
|
||||
/**
|
||||
* A class containing:
|
||||
* -enumerations representing the Emotion and Expressions featured in the Affectiva SDK.
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.graphics.drawable.ColorDrawable;
|
|||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.R.id.*;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
@ -3,9 +3,6 @@ package com.affectiva.errorreporting;
|
|||
import android.app.Application;
|
||||
import android.content.Intent;
|
||||
|
||||
/**
|
||||
* Created by Alan on 8/21/2015.
|
||||
*/
|
||||
public class CustomApplication extends Application {
|
||||
|
||||
static volatile boolean wasErrorActivityStarted = false;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.affectiva.errorreporting;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
@ -13,9 +12,6 @@ import com.affectiva.affdexme.R;
|
|||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by Alan on 8/21/2015.
|
||||
*/
|
||||
public class ErrorReporter extends Activity implements View.OnClickListener {
|
||||
|
||||
String errorMessage;
|
||||
|
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/settings_button_pressed_1"/>
|
||||
<item android:state_pressed="true" android:drawable="@drawable/settings_button_pressed"/>
|
||||
<item android:drawable="@drawable/settings_button" />
|
||||
</selector>
|