package com.irvel.emojitranslator;

import com.google.android.gms.vision.face.Face;

/**
 * Created by irvel on 29/09/2015.
 */
public class Emoji {
    private float mLeftEyeOpen;
    private float mRightEyeOpen;
    private float mSmiling;
    private String mEmojiChar;

    public Emoji(){
        mLeftEyeOpen = Face.UNCOMPUTED_PROBABILITY;
        mRightEyeOpen = Face.UNCOMPUTED_PROBABILITY;
        mSmiling = Face.UNCOMPUTED_PROBABILITY;
        mEmojiChar = "";
    }

    public String getEmojiChar() {
        return mEmojiChar;
    }

    public void setExpression(Face face){
        mLeftEyeOpen = face.getIsLeftEyeOpenProbability();
        mRightEyeOpen = face.getIsRightEyeOpenProbability();
        mSmiling = face.getIsSmilingProbability();
        calculateEmoji();
    }

    private void calculateEmoji() {
        //If there is no smile, display a sad emoji
        if(mSmiling == Face.UNCOMPUTED_PROBABILITY){
            mEmojiChar = "\uD83D\uDE1F";
        }
    }
}


@@ -795,185 +795,2292 @@
     
-private void calculateEmoji() %7B%0A        //If there is no smile, display a sad emoji%0A        if(mSmiling == Face.UNCOMPUTED_PROBABILITY)%7B%0A            mEmojiChar = %22%5CuD83D%5CuDE1F%22;
+//==============================================================================================%0A    // Calculate Emoji%0A    //==============================================================================================%0A%0A    /**%0A     * Calculates the corresponding emoji based on the probabilities of the open left eye,%0A     * open right eye and smile. The emoji values are currently hard-coded because linking%0A     * them a string resource triggers a force-close.%0A     * TODO: Implement a more robust emoji-face model%0A     */%0A%0A    private void calculateEmoji() %7B%0A        //If there is no smile, display a sad emoji%0A        if(mSmiling == Face.UNCOMPUTED_PROBABILITY)%7B%0A            if(mLeftEyeOpen %3E .8 && mRightEyeOpen %3E .8) %7B%0A                //Worried Face%0A                mEmojiChar = %22%5CuD83D%5CuDE1F%22;%0A            %7D%0A            else if((mLeftEyeOpen %3E .3 && mLeftEyeOpen %3C .8) && (mRightEyeOpen %3E .3 && mRightEyeOpen %3C .8) ) %7B%0A                //Astonished Face%0A                mEmojiChar = %22%5CuD83D%5CuDE32%22;%0A            %7D%0A            else%7B%0A                //Disappointed Face%0A                mEmojiChar = %22%5CuD83D%5CuDE1E%22;%0A            %7D%0A        %7D%0A        else%7B%0A            if(mLeftEyeOpen %3E .8 && mRightEyeOpen %3E .8) %7B%0A                if(mSmiling %3E .7) %7B%0A                    //Smiling Face With Open Mouth and Smiling Eyes%0A                    mEmojiChar = %22%5CuD83D%5CuDE04%22;%0A                %7D%0A                else%7B%0A                    //Grinning Face With Smiling Eyes%0A                    mEmojiChar = %22%5CuD83D%5CuDE01%22;%0A                %7D%0A            %7D%0A            else if((mLeftEyeOpen %3E .3 && mLeftEyeOpen %3C .8) && (mRightEyeOpen %3E .3 && mRightEyeOpen %3C .8) ) %7B%0A                //Grinning Face%0A                mEmojiChar = %22%5CuD83D%5CuDE00%22;%0A            %7D%0A            else if(mLeftEyeOpen %3C .5 && mRightEyeOpen %3E .5 %7C%7C mLeftEyeOpen %3E .5 && mRightEyeOpen %3C .5 ) %7B%0A                //Winking Face%0A                mEmojiChar = %22%5CuD83D%5CuDE09%22;%0A            %7D%0A            else%7B%0A                if(mSmiling %3E .45)%7B%0A                    //Smiling Face With Open Mouth and Tightly-Closed Eyes%0A                    mEmojiChar = %22%5CuD83D%5CuDE06%22;%0A                %7D%0A                else%7B%0A                    //Expressionless Face%0A                    mEmojiChar = %22%5CuD83D%5CuDE11%22;%0A                %7D%0A            %7D
 %0A   

Tweak smiling treshold to display more the Expressionless emoji