package com.rubenvandeven.emotionhero; import android.graphics.Color; import com.affectiva.android.affdex.sdk.detector.Face; /** * Created by ruben on 16/08/16. */ public enum Emotion { ANGER, CONTEMPT, DISGUST, FEAR, JOY, SADNESS, SURPRISE; public float getValueFromFace(Face face) { if(face == null) return 0f; switch (this) { case ANGER: return face.emotions.getAnger(); case CONTEMPT: return face.emotions.getContempt(); case DISGUST: return face.emotions.getDisgust(); case FEAR: return face.emotions.getFear(); case JOY: return face.emotions.getJoy(); case SADNESS: return face.emotions.getSadness(); case SURPRISE: return face.emotions.getSurprise(); } return 0; } public int getColor() { switch (this) { case ANGER: return Color.RED; case CONTEMPT: return Color.WHITE; case DISGUST: return Color.GREEN; case FEAR: return Color.MAGENTA; case JOY: return Color.YELLOW; case SADNESS: return Color.CYAN; case SURPRISE: return Color.LTGRAY; } return Color.BLACK; } public String getDbName() { return this.name().toLowerCase(); } }