First weknowhowyoufeel version with new Affectiva SDK
This commit is contained in:
parent
6b95c438bd
commit
e297ff9922
8 changed files with 122 additions and 160 deletions
19
WeKnowHowYouFeel.iml
Normal file
19
WeKnowHowYouFeel.iml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module external.linked.project.id="WeKnowHowYouFeel" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="java-gradle" name="Java-Gradle">
|
||||||
|
<configuration>
|
||||||
|
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
|
||||||
|
<option name="BUILDABLE" value="false" />
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
|
@ -14,6 +14,10 @@
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
|
|
||||||
|
<!--Kiosk Mode-->
|
||||||
|
<uses-permission android:name="android.permission.REORDER_TASKS" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
|
||||||
<uses-feature
|
<uses-feature
|
||||||
android:name="android.hardware.camera"
|
android:name="android.hardware.camera"
|
||||||
android:required="false" />
|
android:required="false" />
|
||||||
|
@ -38,6 +42,9 @@
|
||||||
android:theme="@style/MainActivityTheme">
|
android:theme="@style/MainActivityTheme">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.HOME" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
|
@ -497,9 +497,9 @@ public class DrawingView extends SurfaceView implements SurfaceHolder.Callback {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Draw the bounding box.
|
//Draw the bounding box.
|
||||||
if (config.isDrawPointsEnabled) {
|
// if (config.isDrawPointsEnabled) {
|
||||||
drawBoundingBox(c, face, boundingRect);
|
// drawBoundingBox(c, face, boundingRect);
|
||||||
}
|
// }
|
||||||
|
|
||||||
float heightOffset = findNecessaryHeightOffset(boundingRect, face);
|
float heightOffset = findNecessaryHeightOffset(boundingRect, face);
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
package com.affectiva.affdexme;
|
package com.affectiva.affdexme;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
|
import android.app.ActivityManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -16,6 +17,7 @@ import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
import android.media.MediaPlayer;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
@ -92,7 +94,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
|
|
||||||
public static final int MAX_SUPPORTED_FACES = 3;
|
public static final int MAX_SUPPORTED_FACES = 3;
|
||||||
public static final boolean STORE_RAW_SCREENSHOTS = false; // setting to enable saving the raw images when taking screenshots
|
public static final boolean STORE_RAW_SCREENSHOTS = false; // setting to enable saving the raw images when taking screenshots
|
||||||
public static final int NUM_METRICS_DISPLAYED = 6;
|
public static final int NUM_METRICS_DISPLAYED = 7;
|
||||||
private static final String LOG_TAG = "AffdexMe";
|
private static final String LOG_TAG = "AffdexMe";
|
||||||
private static final int CAMERA_PERMISSIONS_REQUEST = 42; //value is arbitrary (between 0 and 255)
|
private static final int CAMERA_PERMISSIONS_REQUEST = 42; //value is arbitrary (between 0 and 255)
|
||||||
private static final int EXTERNAL_STORAGE_PERMISSIONS_REQUEST = 73;
|
private static final int EXTERNAL_STORAGE_PERMISSIONS_REQUEST = 73;
|
||||||
|
@ -117,9 +119,6 @@ public class MainActivity extends AppCompatActivity
|
||||||
private LinearLayout permissionsUnavailableLayout; //layout used to notify the user that not enough permissions have been granted to use the app
|
private LinearLayout permissionsUnavailableLayout; //layout used to notify the user that not enough permissions have been granted to use the app
|
||||||
private SurfaceView cameraView; //SurfaceView used to display camera images
|
private SurfaceView cameraView; //SurfaceView used to display camera images
|
||||||
private DrawingView drawingView; //SurfaceView containing its own thread, used to draw facial tracking dots
|
private DrawingView drawingView; //SurfaceView containing its own thread, used to draw facial tracking dots
|
||||||
private ImageButton settingsButton;
|
|
||||||
private ImageButton cameraButton;
|
|
||||||
private ImageButton screenshotButton;
|
|
||||||
private Frame mostRecentFrame;
|
private Frame mostRecentFrame;
|
||||||
private boolean isMenuVisible = false;
|
private boolean isMenuVisible = false;
|
||||||
private boolean isFPSVisible = false;
|
private boolean isFPSVisible = false;
|
||||||
|
@ -131,6 +130,8 @@ public class MainActivity extends AppCompatActivity
|
||||||
private boolean isBackFacingCameraDetected = true;
|
private boolean isBackFacingCameraDetected = true;
|
||||||
private boolean multiFaceModeEnabled = false;
|
private boolean multiFaceModeEnabled = false;
|
||||||
|
|
||||||
|
private MediaPlayer mp;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -141,6 +142,8 @@ public class MainActivity extends AppCompatActivity
|
||||||
checkForCameraPermissions();
|
checkForCameraPermissions();
|
||||||
determineCameraAvailability();
|
determineCameraAvailability();
|
||||||
initializeCameraDetector();
|
initializeCameraDetector();
|
||||||
|
|
||||||
|
mp = MediaPlayer.create(this, R.raw.beyond_sleep_vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -208,7 +211,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
requestStoragePermissions();
|
requestStoragePermissions();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
takeScreenshot(screenshotButton);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +272,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
|
|
||||||
if (storagePermissionsAvailable) {
|
if (storagePermissionsAvailable) {
|
||||||
// resume taking the screenshot
|
// resume taking the screenshot
|
||||||
takeScreenshot(screenshotButton);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,9 +360,6 @@ public class MainActivity extends AppCompatActivity
|
||||||
fpsName = (TextView) findViewById(R.id.fps_name);
|
fpsName = (TextView) findViewById(R.id.fps_name);
|
||||||
cameraView = (SurfaceView) findViewById(R.id.camera_preview);
|
cameraView = (SurfaceView) findViewById(R.id.camera_preview);
|
||||||
drawingView = (DrawingView) findViewById(R.id.drawing_view);
|
drawingView = (DrawingView) findViewById(R.id.drawing_view);
|
||||||
settingsButton = (ImageButton) findViewById(R.id.settings_button);
|
|
||||||
cameraButton = (ImageButton) findViewById(R.id.camera_button);
|
|
||||||
screenshotButton = (ImageButton) findViewById(R.id.screenshot_button);
|
|
||||||
progressBar = (ProgressBar) findViewById(R.id.progress_bar);
|
progressBar = (ProgressBar) findViewById(R.id.progress_bar);
|
||||||
pleaseWaitTextView = (TextView) findViewById(R.id.please_wait_textview);
|
pleaseWaitTextView = (TextView) findViewById(R.id.please_wait_textview);
|
||||||
Button retryPermissionsButton = (Button) findViewById(R.id.retryPermissionsButton);
|
Button retryPermissionsButton = (Button) findViewById(R.id.retryPermissionsButton);
|
||||||
|
@ -372,6 +372,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
metricNames[3] = (TextView) findViewById(R.id.metric_name_3);
|
metricNames[3] = (TextView) findViewById(R.id.metric_name_3);
|
||||||
metricNames[4] = (TextView) findViewById(R.id.metric_name_4);
|
metricNames[4] = (TextView) findViewById(R.id.metric_name_4);
|
||||||
metricNames[5] = (TextView) findViewById(R.id.metric_name_5);
|
metricNames[5] = (TextView) findViewById(R.id.metric_name_5);
|
||||||
|
metricNames[6] = (TextView) findViewById(R.id.metric_name_6);
|
||||||
metricDisplays = new MetricDisplay[NUM_METRICS_DISPLAYED];
|
metricDisplays = new MetricDisplay[NUM_METRICS_DISPLAYED];
|
||||||
metricDisplays[0] = (MetricDisplay) findViewById(R.id.metric_pct_0);
|
metricDisplays[0] = (MetricDisplay) findViewById(R.id.metric_pct_0);
|
||||||
metricDisplays[1] = (MetricDisplay) findViewById(R.id.metric_pct_1);
|
metricDisplays[1] = (MetricDisplay) findViewById(R.id.metric_pct_1);
|
||||||
|
@ -379,6 +380,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
metricDisplays[3] = (MetricDisplay) findViewById(R.id.metric_pct_3);
|
metricDisplays[3] = (MetricDisplay) findViewById(R.id.metric_pct_3);
|
||||||
metricDisplays[4] = (MetricDisplay) findViewById(R.id.metric_pct_4);
|
metricDisplays[4] = (MetricDisplay) findViewById(R.id.metric_pct_4);
|
||||||
metricDisplays[5] = (MetricDisplay) findViewById(R.id.metric_pct_5);
|
metricDisplays[5] = (MetricDisplay) findViewById(R.id.metric_pct_5);
|
||||||
|
metricDisplays[6] = (MetricDisplay) findViewById(R.id.metric_pct_6);
|
||||||
|
|
||||||
//Load Application Font and set UI Elements to use it
|
//Load Application Font and set UI Elements to use it
|
||||||
Typeface face = Typeface.createFromAsset(getAssets(), "fonts/Square.ttf");
|
Typeface face = Typeface.createFromAsset(getAssets(), "fonts/Square.ttf");
|
||||||
|
@ -456,7 +458,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
super.onResume();
|
super.onResume();
|
||||||
checkForCameraPermissions();
|
checkForCameraPermissions();
|
||||||
restoreApplicationSettings();
|
restoreApplicationSettings();
|
||||||
setMenuVisible(true);
|
setMenuVisible(false);
|
||||||
isMenuShowingForFirstTime = true;
|
isMenuShowingForFirstTime = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,37 +499,28 @@ public class MainActivity extends AppCompatActivity
|
||||||
detector.setMaxProcessRate(detectorProcessRate);
|
detector.setMaxProcessRate(detectorProcessRate);
|
||||||
drawingView.invalidateDimensions();
|
drawingView.invalidateDimensions();
|
||||||
|
|
||||||
if (sharedPreferences.getBoolean("fps", isFPSVisible)) { //restore isFPSMetricVisible
|
|
||||||
setFPSVisible(true);
|
|
||||||
} else {
|
|
||||||
setFPSVisible(false);
|
setFPSVisible(false);
|
||||||
}
|
|
||||||
|
|
||||||
if (sharedPreferences.getBoolean("track", drawingView.getDrawPointsEnabled())) { //restore isTrackingDotsVisible
|
|
||||||
setTrackPoints(true);
|
setTrackPoints(true);
|
||||||
} else {
|
|
||||||
setTrackPoints(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sharedPreferences.getBoolean("appearance", drawingView.getDrawAppearanceMarkersEnabled())) {
|
|
||||||
detector.setDetectAllAppearances(true);
|
|
||||||
setShowAppearance(true);
|
|
||||||
} else {
|
|
||||||
detector.setDetectAllAppearances(false);
|
detector.setDetectAllAppearances(false);
|
||||||
setShowAppearance(false);
|
setShowAppearance(false);
|
||||||
}
|
|
||||||
|
|
||||||
if (sharedPreferences.getBoolean("emoji", drawingView.getDrawEmojiMarkersEnabled())) {
|
|
||||||
detector.setDetectAllEmojis(true);
|
|
||||||
setShowEmoji(true);
|
|
||||||
} else {
|
|
||||||
detector.setDetectAllEmojis(false);
|
detector.setDetectAllEmojis(false);
|
||||||
setShowEmoji(false);
|
setShowEmoji(false);
|
||||||
}
|
|
||||||
|
|
||||||
//populate metric displays
|
//populate metric displays
|
||||||
for (int n = 0; n < NUM_METRICS_DISPLAYED; n++) {
|
// for (int n = 0; n < NUM_METRICS_DISPLAYED; n++) {
|
||||||
activateMetric(n, PreferencesUtils.getMetricFromPrefs(sharedPreferences, n));
|
// activateMetric(n, PreferencesUtils.getMetricFromPrefs(sharedPreferences, n));
|
||||||
|
// }
|
||||||
|
|
||||||
|
detector.setDetectAllEmotions(true);
|
||||||
|
int i=0;
|
||||||
|
for(MetricsManager.Emotions emotion: MetricsManager.Emotions.values()) {
|
||||||
|
if(emotion.equals(MetricsManager.Emotions.ENGAGEMENT) || emotion.equals(MetricsManager.Emotions.VALENCE)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
activateMetric(i, emotion);
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if we are in multiface mode, we need to enable the detection of all emotions
|
//if we are in multiface mode, we need to enable the detection of all emotions
|
||||||
|
@ -542,14 +535,11 @@ public class MainActivity extends AppCompatActivity
|
||||||
* -enable the corresponding metric in the Detector object by calling Detector.setDetect<MetricName>()
|
* -enable the corresponding metric in the Detector object by calling Detector.setDetect<MetricName>()
|
||||||
* -save the Method object that will be invoked on the Face object received in onImageResults() to get the metric score
|
* -save the Method object that will be invoked on the Face object received in onImageResults() to get the metric score
|
||||||
*/
|
*/
|
||||||
void activateMetric(int index, MetricsManager.Metrics metric) {
|
void activateMetric(int index, MetricsManager.Emotions metric) {
|
||||||
|
|
||||||
Method getFaceScoreMethod = null; //The method that will be used to get a metric score
|
Method getFaceScoreMethod = null; //The method that will be used to get a metric score
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch (metric.getType()) {
|
|
||||||
case Emotion:
|
|
||||||
Detector.class.getMethod("setDetect" + MetricsManager.getCamelCase(metric), boolean.class).invoke(detector, true);
|
|
||||||
metricNames[index].setText(MetricsManager.getUpperCaseName(metric));
|
metricNames[index].setText(MetricsManager.getUpperCaseName(metric));
|
||||||
getFaceScoreMethod = Face.Emotions.class.getMethod("get" + MetricsManager.getCamelCase(metric));
|
getFaceScoreMethod = Face.Emotions.class.getMethod("get" + MetricsManager.getCamelCase(metric));
|
||||||
|
|
||||||
|
@ -559,27 +549,9 @@ public class MainActivity extends AppCompatActivity
|
||||||
} else {
|
} else {
|
||||||
metricDisplays[index].setIsShadedMetricView(false);
|
metricDisplays[index].setIsShadedMetricView(false);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case Expression:
|
|
||||||
Detector.class.getMethod("setDetect" + MetricsManager.getCamelCase(metric), boolean.class).invoke(detector, true);
|
|
||||||
metricNames[index].setText(MetricsManager.getUpperCaseName(metric));
|
|
||||||
getFaceScoreMethod = Face.Expressions.class.getMethod("get" + MetricsManager.getCamelCase(metric));
|
|
||||||
break;
|
|
||||||
case Emoji:
|
|
||||||
detector.setDetectAllEmojis(true);
|
|
||||||
MetricsManager.Emojis emoji = ((MetricsManager.Emojis) metric);
|
|
||||||
String metricTitle = emoji.getDisplayName(); // + " " + emoji.getUnicodeForEmoji();
|
|
||||||
metricNames[index].setText(metricTitle);
|
|
||||||
Log.d(LOG_TAG, "Getter Method: " + "get" + MetricsManager.getCamelCase(metric));
|
|
||||||
getFaceScoreMethod = Face.Emojis.class.getMethod("get" + MetricsManager.getCamelCase(metric));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
Log.e(LOG_TAG, String.format("No such method while using reflection to generate methods for %s", metric.toString()), e);
|
Log.e(LOG_TAG, String.format("No such method while using reflection to generate methods for %s", metric.toString()), e);
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
Log.e(LOG_TAG, String.format("Invocation error while using reflection to generate methods for %s", metric.toString()), e);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
Log.e(LOG_TAG, String.format("Illegal access error while using reflection to generate methods for %s", metric.toString()), e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
metricDisplays[index].setMetricToDisplay(metric, getFaceScoreMethod);
|
metricDisplays[index].setMetricToDisplay(metric, getFaceScoreMethod);
|
||||||
|
@ -609,6 +581,12 @@ public class MainActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!hasFocus) {
|
||||||
|
// Close every kind of system dialog
|
||||||
|
// Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
||||||
|
// sendBroadcast(closeDialog);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mainWindowResumedTasks() {
|
void mainWindowResumedTasks() {
|
||||||
|
@ -655,6 +633,10 @@ public class MainActivity extends AppCompatActivity
|
||||||
rightMetricsLayout.animate().alpha(1);
|
rightMetricsLayout.animate().alpha(1);
|
||||||
|
|
||||||
resetFPSCalculations(); //Since the FPS may be different whether a face is being tracked or not, reset variables.
|
resetFPSCalculations(); //Since the FPS may be different whether a face is being tracked or not, reset variables.
|
||||||
|
|
||||||
|
if(mp != null && !mp.isPlaying()) {
|
||||||
|
mp.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -865,6 +847,12 @@ public class MainActivity extends AppCompatActivity
|
||||||
super.onPause();
|
super.onPause();
|
||||||
progressBarLayout.setVisibility(View.VISIBLE);
|
progressBarLayout.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
|
||||||
|
ActivityManager activityManager = (ActivityManager) getApplicationContext()
|
||||||
|
.getSystemService(Context.ACTIVITY_SERVICE);
|
||||||
|
|
||||||
|
activityManager.moveTaskToFront(getTaskId(), 0);
|
||||||
|
|
||||||
performFaceDetectionStoppedTasks();
|
performFaceDetectionStoppedTasks();
|
||||||
|
|
||||||
stopDetector();
|
stopDetector();
|
||||||
|
@ -890,20 +878,6 @@ public class MainActivity extends AppCompatActivity
|
||||||
* When the user taps the screen, hide the menu if it is visible and show it if it is hidden.
|
* When the user taps the screen, hide the menu if it is visible and show it if it is hidden.
|
||||||
**/
|
**/
|
||||||
void setMenuVisible(boolean b) {
|
void setMenuVisible(boolean b) {
|
||||||
isMenuShowingForFirstTime = false;
|
|
||||||
isMenuVisible = b;
|
|
||||||
if (b) {
|
|
||||||
settingsButton.setVisibility(View.VISIBLE);
|
|
||||||
cameraButton.setVisibility(View.VISIBLE);
|
|
||||||
screenshotButton.setVisibility(View.VISIBLE);
|
|
||||||
|
|
||||||
//We display the navigation bar again
|
|
||||||
getWindow().getDecorView().setSystemUiVisibility(
|
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
//We hide the navigation bar
|
//We hide the navigation bar
|
||||||
getWindow().getDecorView().setSystemUiVisibility(
|
getWindow().getDecorView().setSystemUiVisibility(
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||||
|
@ -911,10 +885,6 @@ public class MainActivity extends AppCompatActivity
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||||
| View.SYSTEM_UI_FLAG_FULLSCREEN);
|
| View.SYSTEM_UI_FLAG_FULLSCREEN);
|
||||||
settingsButton.setVisibility(View.INVISIBLE);
|
|
||||||
cameraButton.setVisibility(View.INVISIBLE);
|
|
||||||
screenshotButton.setVisibility(View.INVISIBLE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -963,9 +933,6 @@ public class MainActivity extends AppCompatActivity
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void settings_button_click(View view) {
|
|
||||||
startActivity(new Intent(this, SettingsActivity.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("SuspiciousNameCombination")
|
@SuppressWarnings("SuspiciousNameCombination")
|
||||||
@Override
|
@Override
|
||||||
|
@ -1019,10 +986,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void camera_button_click(View view) {
|
|
||||||
//Toggle the camera setting
|
|
||||||
setCameraType(cameraType == CameraDetector.CameraType.CAMERA_FRONT ? CameraDetector.CameraType.CAMERA_BACK : CameraDetector.CameraType.CAMERA_FRONT);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setCameraType(CameraDetector.CameraType type) {
|
private void setCameraType(CameraDetector.CameraType type) {
|
||||||
SharedPreferences.Editor preferencesEditor = PreferenceManager.getDefaultSharedPreferences(this).edit();
|
SharedPreferences.Editor preferencesEditor = PreferenceManager.getDefaultSharedPreferences(this).edit();
|
||||||
|
@ -1069,4 +1033,11 @@ public class MainActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
// nothing to do here
|
||||||
|
// … really
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -30,46 +30,10 @@
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/metric_view_group"
|
android:id="@+id/metric_view_group"
|
||||||
layout="@layout/metric_layout" />
|
layout="@layout/metric_layout"
|
||||||
|
android:layout_height="170dp"
|
||||||
<ImageButton
|
android:layout_width="match_parent"
|
||||||
android:id="@+id/settings_button"
|
android:layout_centerVertical="true" />
|
||||||
android:layout_width="@dimen/settings_button_size"
|
|
||||||
android:layout_height="@dimen/settings_button_size"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_below="@id/metric_view_group"
|
|
||||||
android:layout_margin="@dimen/settings_button_margin"
|
|
||||||
android:background="@null"
|
|
||||||
android:contentDescription="@string/settings_content_description"
|
|
||||||
android:onClick="settings_button_click"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:src="@drawable/settings_button_selector" />
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/camera_button"
|
|
||||||
android:layout_width="@dimen/settings_button_size"
|
|
||||||
android:layout_height="@dimen/settings_button_size"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_below="@id/settings_button"
|
|
||||||
android:layout_margin="@dimen/settings_button_margin"
|
|
||||||
android:background="@null"
|
|
||||||
android:contentDescription="Switch camera button"
|
|
||||||
android:onClick="camera_button_click"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:src="@drawable/camera_button_selector" />
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/screenshot_button"
|
|
||||||
android:layout_width="@dimen/settings_button_size"
|
|
||||||
android:layout_height="@dimen/settings_button_size"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_below="@id/camera_button"
|
|
||||||
android:layout_margin="@dimen/settings_button_margin"
|
|
||||||
android:background="@null"
|
|
||||||
android:contentDescription="Take screenshot"
|
|
||||||
android:onClick="takeScreenshot"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:src="@drawable/screenshot_button_selector" />
|
|
||||||
|
|
||||||
<include layout="@layout/insufficent_permissions_panel" />
|
<include layout="@layout/insufficent_permissions_panel" />
|
||||||
|
|
||||||
|
|
|
@ -2,21 +2,15 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_height="@dimen/metric_viewgroup"
|
android:layout_height="170dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:background="@color/transparent_overlay"
|
|
||||||
android:paddingBottom="@dimen/bottom_padding"
|
android:paddingBottom="@dimen/bottom_padding"
|
||||||
>
|
android:layout_centerInParent="false"
|
||||||
|
android:layout_centerVertical="false"
|
||||||
|
android:layout_gravity="center_vertical">
|
||||||
<!-- Logo-->
|
<!-- Logo-->
|
||||||
<ImageView
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="@dimen/logo_width"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:src="@drawable/affectiva_logo_clear_background"
|
|
||||||
android:contentDescription="@string/affectiva_logo_content_description"
|
|
||||||
android:id="@+id/affectiva_logo" />
|
|
||||||
<!-- Left MetricsManager-->
|
<!-- Left MetricsManager-->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
@ -44,6 +38,13 @@
|
||||||
<com.affectiva.affdexme.MetricDisplay
|
<com.affectiva.affdexme.MetricDisplay
|
||||||
style="@style/metricPct"
|
style="@style/metricPct"
|
||||||
android:id="@+id/metric_pct_2" />
|
android:id="@+id/metric_pct_2" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/metricName"
|
||||||
|
android:id="@+id/metric_name_3" />
|
||||||
|
<com.affectiva.affdexme.MetricDisplay
|
||||||
|
style="@style/metricPct"
|
||||||
|
android:id="@+id/metric_pct_3" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<!-- FPS Counter-->
|
<!-- FPS Counter-->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -77,14 +78,8 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:paddingRight="@dimen/metric_panel_padding"
|
android:paddingRight="@dimen/metric_panel_padding"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="130dp"
|
||||||
android:id="@+id/right_metrics">
|
android:id="@+id/right_metrics">
|
||||||
<TextView
|
|
||||||
style="@style/metricName"
|
|
||||||
android:id="@+id/metric_name_3" />
|
|
||||||
<com.affectiva.affdexme.MetricDisplay
|
|
||||||
style="@style/metricPct"
|
|
||||||
android:id="@+id/metric_pct_3" />
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/metricName"
|
style="@style/metricName"
|
||||||
android:id="@+id/metric_name_4" />
|
android:id="@+id/metric_name_4" />
|
||||||
|
@ -97,5 +92,11 @@
|
||||||
<com.affectiva.affdexme.MetricDisplay
|
<com.affectiva.affdexme.MetricDisplay
|
||||||
style="@style/metricPct"
|
style="@style/metricPct"
|
||||||
android:id="@+id/metric_pct_5" />
|
android:id="@+id/metric_pct_5" />
|
||||||
|
<TextView
|
||||||
|
style="@style/metricName"
|
||||||
|
android:id="@+id/metric_name_6" />
|
||||||
|
<com.affectiva.affdexme.MetricDisplay
|
||||||
|
style="@style/metricPct"
|
||||||
|
android:id="@+id/metric_pct_6" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
BIN
app/src/main/res/raw/beyond_sleep_vo.mp3
Normal file
BIN
app/src/main/res/raw/beyond_sleep_vo.mp3
Normal file
Binary file not shown.
|
@ -5,7 +5,7 @@ buildscript {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.1.3'
|
classpath 'com.android.tools.build:gradle:2.2.0'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|
Loading…
Reference in a new issue