Add copyright information to every java source file and every project xml file

Also:
Fixed a out of date string in strings.xml that talked about the location of the appearance metrics.
Removed a few unused strings.
Migrated a few string constants into strings.xml

No other changes in this commit other than reformatting via autoformatter
This commit is contained in:
Abraham Hedtke 2016-01-05 18:04:37 -05:00 committed by toby cabot
parent 9eaa0b626b
commit 9a667683bc
30 changed files with 233 additions and 97 deletions

View file

@ -1,3 +1,9 @@
![Affectiva Logo](http://developer.affectiva.com/images/logo.png)
###Copyright (c) 2016 Affectiva Inc. <br> See the file [license.txt](license.txt) for copying permission.
*****************************
**AffdexMe** is an app that demonstrates the use of the Affectiva Android SDK. It uses the camera on your Android device to view, process and analyze live video of your face. Start the app and you will see your face on the screen and metrics describing your expressions. Tapping the screen will bring up a menu with options to display the Processed Frames Per Second metric, display facial tracking points, and control the rate at which frames are processed by the SDK.
Most of the methods in this file control the application's UI. Therefore, if you are just interested in learning how the Affectiva SDK works, you will find the calls relevant to the use of the SDK in the initializeCameraDetector(), startCamera(), stopCamera(), and onImageResults() methods.

View file

@ -1,4 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.affectiva.affdexme">
@ -17,14 +23,14 @@
<application
android:name="com.affectiva.errorreporting.CustomApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
<activity
android:name=".MainActivity"
android:configChanges="screenSize|keyboardHidden|orientation"
android:theme="@style/MainActivityTheme"
android:label="@string/app_name">
android:label="@string/app_name"
android:theme="@style/MainActivityTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@ -40,8 +46,8 @@
</activity>
<activity
android:name="com.affectiva.errorreporting.ErrorReporter"
android:theme="@android:style/Theme.DeviceDefault"
android:textAppearance="@android:style/TextAppearance.Large">
android:textAppearance="@android:style/TextAppearance.Large"
android:theme="@android:style/Theme.DeviceDefault">
<intent-filter>
<action android:name="com.affectiva.REPORT_ERROR" />
<category android:name="android.intent.category.DEFAULT" />

View file

@ -1,3 +1,8 @@
/**
* Copyright (c) 2016 Affectiva Inc.
* See the file license.txt for copying permission.
*/
package com.affectiva.affdexme;
import android.content.Context;

View file

@ -1,3 +1,8 @@
/**
* Copyright (c) 2016 Affectiva Inc.
* See the file license.txt for copying permission.
*/
package com.affectiva.affdexme;
import android.content.Context;

View file

@ -1,3 +1,8 @@
/**
* Copyright (c) 2016 Affectiva Inc.
* See the file license.txt for copying permission.
*/
package com.affectiva.affdexme;
import android.Manifest;
@ -64,15 +69,13 @@ import java.util.Locale;
*
* In order to use this project, you will need to:
* - Obtain the SDK from Affectiva (visit http://www.affdex.com/mobile-sdk)
* - Copy the SDK assets folder contents into this project's assets folder
* - Copy the SDK assets folder contents into this project's assets folder under AffdexMe/app/src/main/assets
* - Copy the contents of the SDK's libs folder into this project's libs folder under AffdexMe/app/lib
* - Copy the armeabi-v7a folder (found in the SDK libs folder) into this project's jniLibs folder under AffdexMe/app/src/main/jniLibs
* - Add your license file to the /assets/Affdex folder and rename to license.txt.
* - Add your license file to the assets/Affdex folder and rename to license.txt.
* (Note: if you name the license file something else you will need to update the licensePath in the initializeCameraDetector() method in MainActivity)
* - Build the project
* - Run the app on an Android device with a front-facing camera
*
* Copyright (c) 2014 Affectiva. All rights reserved.
*/
public class MainActivity extends AppCompatActivity

View file

@ -1,3 +1,8 @@
/**
* Copyright (c) 2016 Affectiva Inc.
* See the file license.txt for copying permission.
*/
package com.affectiva.affdexme;
import android.content.Context;

View file

@ -1,3 +1,8 @@
/**
* Copyright (c) 2016 Affectiva Inc.
* See the file license.txt for copying permission.
*/
package com.affectiva.affdexme;
import android.app.Activity;

View file

@ -1,3 +1,8 @@
/**
* Copyright (c) 2016 Affectiva Inc.
* See the file license.txt for copying permission.
*/
package com.affectiva.affdexme;
import android.app.Activity;

View file

@ -1,3 +1,8 @@
/**
* Copyright (c) 2016 Affectiva Inc.
* See the file license.txt for copying permission.
*/
package com.affectiva.affdexme;
import com.affectiva.android.affdex.sdk.detector.Face;

View file

@ -1,3 +1,8 @@
/**
* Copyright (c) 2016 Affectiva Inc.
* See the file license.txt for copying permission.
*/
package com.affectiva.affdexme;
import android.content.SharedPreferences;

View file

@ -1,3 +1,8 @@
/**
* Copyright (c) 2016 Affectiva Inc.
* See the file license.txt for copying permission.
*/
package com.affectiva.affdexme;
import android.app.ActionBar;

View file

@ -1,3 +1,8 @@
/**
* Copyright (c) 2016 Affectiva Inc.
* See the file license.txt for copying permission.
*/
package com.affectiva.errorreporting;
import android.app.Application;
@ -5,28 +10,24 @@ import android.content.Intent;
public class CustomApplication extends Application {
static volatile boolean wasErrorActivityStarted = false;
static final boolean enableCustomErrorMessage = false;
static volatile boolean wasErrorActivityStarted = false;
Thread.UncaughtExceptionHandler exceptionHandler;
@Override
public void onCreate ()
{
public void onCreate() {
super.onCreate();
exceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
// Setup handler for uncaught exceptions.
Thread.setDefaultUncaughtExceptionHandler (new Thread.UncaughtExceptionHandler()
{
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException (Thread thread, Throwable e)
{
public void uncaughtException(Thread thread, Throwable e) {
handleUncaughtException(thread, e);
}
});
}
public void handleUncaughtException (Thread thread, Throwable e)
{
public void handleUncaughtException(Thread thread, Throwable e) {
if (!wasErrorActivityStarted && enableCustomErrorMessage) {
Intent intent = new Intent();
intent.setAction("com.affectiva.REPORT_ERROR"); // see step 5.

View file

@ -1,3 +1,8 @@
/**
* Copyright (c) 2016 Affectiva Inc.
* See the file license.txt for copying permission.
*/
package com.affectiva.errorreporting;
import android.app.Activity;
@ -19,8 +24,7 @@ public class ErrorReporter extends Activity implements View.OnClickListener {
@Override
public void onCreate(Bundle savedInstanceState)
{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE); // make a dialog without a titlebar
setContentView(R.layout.error_reporter);

View file

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/switch_camera_button"/>
<item android:drawable="@drawable/switch_camera_button" android:state_pressed="true" />
<item android:drawable="@drawable/switch_camera_button_pressed" />
</selector>

View file

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/settings_button_pressed"/>
<item android:drawable="@drawable/settings_button_pressed" android:state_pressed="true" />
<item android:drawable="@drawable/settings_button" />
</selector>

View file

@ -1,3 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<resources>
<dimen name="name_text_size">24sp</dimen>
<dimen name="pct_text_size">14sp</dimen>
@ -7,33 +14,19 @@
<dimen name="metric_viewgroup">190dp</dimen>
<dimen name="logo_width">180dp</dimen>
<dimen name="metric_panel_padding">15dp</dimen>
<dimen name="please_wait_textview_size">28sp</dimen>
<dimen name="settings_button_size">64dp</dimen>
<dimen name="settings_button_margin">12dp</dimen>
<dimen name="measurements_text_size">21sp</dimen>
<dimen name="measurements_upper_text_spacing">70dp</dimen>
<dimen name="measurements_lower_text_spacing">100dp</dimen>
<integer name="measurements_text_border_thickness">5</integer>
<dimen name="metric_chooser_text_size">24dp</dimen>
<dimen name="header_text_size">26dp</dimen>
<dimen name="grid_item_checkbox_size">40dp</dimen>
<dimen name="grid_item_chooser_text_size">19sp</dimen>
<dimen name="grid_item_left_padding">5dp</dimen>
<dimen name="grid_item_bottom_padding">10dp</dimen>
<dimen name="grid_item_metric_name">18sp</dimen>
<dimen name="metric_chooser_column_width">180dp</dimen>
</resources>

View file

@ -1,3 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<resources>
<dimen name="name_text_size">14sp</dimen>
<dimen name="pct_text_size">11sp</dimen>
@ -7,28 +14,19 @@
<dimen name="metric_viewgroup">130dp</dimen>
<dimen name="logo_width">120dp</dimen>
<dimen name="metric_panel_padding">10dp</dimen>
<dimen name="please_wait_textview_size">20sp</dimen>
<dimen name="settings_button_size">48dp</dimen>
<dimen name="settings_button_margin">10dp</dimen>
<dimen name="measurements_text_size">17sp</dimen>
<dimen name="measurements_upper_text_spacing">60dp</dimen>
<dimen name="measurements_lower_text_spacing">80dp</dimen>
<integer name="measurements_text_border_thickness">3</integer>
<dimen name="grid_item_chooser_text_size">15sp</dimen>
<dimen name="grid_item_checkbox_size">30dp</dimen>
<dimen name="header_text_size">21dp</dimen>
<dimen name="metric_chooser_text_size">18dp</dimen>
<dimen name="grid_item_left_padding">4dp</dimen>
<dimen name="grid_item_bottom_padding">8dp</dimen>
<dimen name="grid_item_metric_name">15sp</dimen>
<dimen name="metric_chooser_column_width">140dp</dimen>
</resources>

View file

@ -1,3 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<resources>
<dimen name="name_text_size">12sp</dimen>
<dimen name="pct_text_size">9sp</dimen>
@ -7,27 +14,19 @@
<dimen name="metric_viewgroup">130dp</dimen>
<dimen name="logo_width">100dp</dimen>
<dimen name="metric_panel_padding">8dp</dimen>
<dimen name="please_wait_textview_size">17sp</dimen>
<dimen name="settings_button_size">36dp</dimen>
<dimen name="settings_button_margin">7dp</dimen>
<dimen name="grid_item_chooser_text_size">12sp</dimen>
<dimen name="grid_item_checkbox_size">50dp</dimen>
<dimen name="measurements_text_size">13sp</dimen>
<dimen name="measurements_upper_text_spacing">50dp</dimen>
<dimen name="measurements_lower_text_spacing">70dp</dimen>
<integer name="measurements_text_border_thickness">3</integer>
<dimen name="header_text_size">17dp</dimen>
<dimen name="metric_chooser_text_size">13dp</dimen>
<dimen name="grid_item_left_padding">3dp</dimen>
<dimen name="grid_item_bottom_padding">6dp</dimen>
<dimen name="grid_item_metric_name">11sp</dimen>
<dimen name="metric_chooser_column_width">120dp</dimen>
</resources>

View file

@ -1,3 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="name_text_size">28sp</dimen>
@ -8,30 +15,19 @@
<dimen name="metric_viewgroup">220dp</dimen>
<dimen name="logo_width">250dp</dimen>
<dimen name="metric_panel_padding">25dp</dimen>
<dimen name="please_wait_textview_size">35sp</dimen>
<dimen name="settings_size">72dp</dimen>
<dimen name="settings_button_margin">15dp</dimen>
<dimen name="measurements_text_size">30sp</dimen>
<dimen name="measurements_upper_text_spacing">110dp</dimen>
<dimen name="measurements_lower_text_spacing">130dp</dimen>
<integer name="measurements_text_border_thickness">7</integer>
<dimen name="metric_chooser_text_size">26dp</dimen>
<dimen name="header_text_size">30dp</dimen>
<dimen name="grid_item_checkbox_size">60dp</dimen>
<dimen name="grid_item_chooser_text_size">24sp</dimen>
<dimen name="grid_item_left_padding">6dp</dimen>
<dimen name="grid_item_bottom_padding">12dp</dimen>
<dimen name="grid_item_metric_name">22sp</dimen>
<dimen name="metric_chooser_column_width">200dp</dimen>
</resources>

View file

@ -1,4 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<resources>
<declare-styleable name="custom_attributes">
<attr name="textSize" format="dimension" />

View file

@ -1,4 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<resources>
<color name="transparent_overlay">#55ffffff</color>
<color name="letter_gray">#514a40</color>

View file

@ -1,3 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<resources>
<dimen name="name_text_size">14sp</dimen>
<dimen name="pct_text_size">11sp</dimen>
@ -7,30 +14,19 @@
<dimen name="metric_viewgroup">140dp</dimen>
<dimen name="logo_width">120dp</dimen>
<dimen name="metric_panel_padding">10dp</dimen>
<dimen name="please_wait_textview_size">20sp</dimen>
<!--TODO: create dimensions for other screen sizes -->
<dimen name="settings_button_size">48dp</dimen>
<dimen name="settings_button_margin">10dp</dimen>
<dimen name="measurements_text_size">17sp</dimen>
<dimen name="measurements_upper_text_spacing">60dp</dimen>
<dimen name="measurements_lower_text_spacing">80dp</dimen>
<integer name="measurements_text_border_thickness">3</integer>
<dimen name="grid_item_chooser_text_size">15sp</dimen>
<dimen name="grid_item_checkbox_size">30dp</dimen>
<dimen name="header_text_size">21dp</dimen>
<dimen name="metric_chooser_text_size">18dp</dimen>
<dimen name="grid_item_left_padding">4dp</dimen>
<dimen name="grid_item_bottom_padding">8dp</dimen>
<dimen name="grid_item_metric_name">15sp</dimen>
<dimen name="metric_chooser_column_width">140dp</dimen>
</resources>

View file

@ -1,5 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<resources>
<style name="metricName">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>

View file

@ -1,5 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<resources>
<style name="metricPct">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>

View file

@ -1,5 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<resources>
<style name="optionsStyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>

View file

@ -1,3 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<resources>
<!--MainActivity strings-->
<string name="not_found">Sorry, AffdexMe requires the use of a front-facing camera, which was not found on your device.</string>
@ -30,9 +37,7 @@
<string name="show_tracking_title">Show Tracking Dots</string>
<string name="show_tracking_message">Display tracking dots and bounding box.</string>
<string name="show_appearance_title">Show Appearance Indicators</string>
<string name="show_appearance_message">Display appearance markers to the left of the bounding box.</string>
<string name="show_measurements_title">Show Measurements</string>
<string name="show_measurements_message">Display roll, yaw, pitch, and interocular distance.</string>
<string name="show_appearance_message">Display appearance markers adjacent to the bounding box.</string>
<string name="show_fps_title">Show FPS</string>
<string name="show_fps_message">Display the actual processed frames per second.</string>
<string name="show_emoji_title">Show Emoji Indicators</string>

View file

@ -1,4 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<resources>
<style name="MainActivityTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@color/black</item>
</style>
@ -7,6 +15,7 @@
<item name="android:homeAsUpIndicator">@drawable/ic_arrow_back_white_24dp</item>
<item name="android:actionBarStyle">@style/CustomActionBarStyle</item>
</style>
<style name="CustomActionBarStyle" parent="android:Widget.Holo.ActionBar">
<item name="android:displayOptions">useLogo|showHome</item>
</style>

View file

@ -1,9 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
<header android:fragment="com.affectiva.affdexme.SettingsActivity$SettingsFragment"
android:title="@string/settings_title"
android:summary="@string/settings_message" />
<header android:fragment="com.affectiva.affdexme.MetricSelectionFragment"
android:title="@string/select_metrics_title"
android:summary="@string/select_metrics_message" />
<header
android:fragment="com.affectiva.affdexme.SettingsActivity$SettingsFragment"
android:summary="@string/settings_message"
android:title="@string/settings_title" />
<header
android:fragment="com.affectiva.affdexme.MetricSelectionFragment"
android:summary="@string/select_metrics_message"
android:title="@string/select_metrics_title" />
</preference-headers>

View file

@ -1,4 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (c) 2016 Affectiva Inc.
- See the file license.txt for copying permission.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference
android:defaultValue="false"

21
license.txt Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Affectiva Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.