// Path: androidsdk/src/main/java/com/wootric/androidsdk/objects/Score.java
// public final class Score {
//     private final int score;
//     private final String surveyType;
//     private final int surveyTypeScale;
// 
//     private static final HashMap<String, ArrayList<HashMap<String, Integer>>> scoreRules = new HashMap<String, ArrayList<HashMap<String, Integer>>>(){
//         {
//             put("NPS", new ArrayList<HashMap<String, Integer>>() {{
//                 add(new HashMap<String, Integer>() {{
//                     put("min", 0);
//                     put("max", 10);
//                     put("negative_type_max", 6);
//                     put("neutral_type_max", 8);
//                 }});
//             }});
//             put("CES", new ArrayList<HashMap<String, Integer>>() {{
//                 add(new HashMap<String, Integer>() {{
//                     put("min", 1);
//                     put("max", 7);
//                     put("negative_type_max", 3);
//                     put("neutral_type_max", 5);
//                 }});
//             }});
//             put("CSAT", new ArrayList<HashMap<String, Integer>>() {{
//                 add(new HashMap<String, Integer>() {{
//                     put("min", 1);
//                     put("max", 5);
//                     put("negative_type_max", 2);
//                     put("neutral_type_max", 3);
//                 }});
//                 add(new HashMap<String, Integer>() {{
//                     put("min", 1);
//                     put("max", 10);
//                     put("negative_type_max", 6);
//                     put("neutral_type_max", 8);
//                 }});
//             }});
//         }
//     };
// 
//     public Score(int score, String surveyType, int surveyTypeScale) {
//         this.score = score;
//         this.surveyType = surveyType;
//         if (scoreRules.containsKey(surveyType) && surveyTypeScale >= 0 && surveyTypeScale < scoreRules.get(surveyType).size()){
//             this.surveyTypeScale = surveyTypeScale;
//         } else {
//             this.surveyTypeScale = 0;
//         }
//     }
// 
//     public boolean isDetractor() {
//         if (surveyType != null & scoreRules.containsKey(surveyType)){
//             return score >= scoreRules.get(surveyType).get(surveyTypeScale).get("min") &&
//                     score <= scoreRules.get(surveyType).get(surveyTypeScale).get("negative_type_max");
//         } else {
//             return score >= scoreRules.get("NPS").get(surveyTypeScale).get("min") &&
//                     score <= scoreRules.get("NPS").get(surveyTypeScale).get("negative_type_max");
//         }
//     }
// 
//     public boolean isPassive() {
//         if (surveyType != null & scoreRules.containsKey(surveyType)){
//             return score > scoreRules.get(surveyType).get(surveyTypeScale).get("negative_type_max") &&
//                     score <= scoreRules.get(surveyType).get(surveyTypeScale).get("neutral_type_max");
//         } else {
//             return score > scoreRules.get("NPS").get(surveyTypeScale).get("negative_type_max") &&
//                     score <= scoreRules.get("NPS").get(surveyTypeScale).get("neutral_type_max");
//         }
//     }
// 
//     public boolean isPromoter() {
//         if (surveyType != null & scoreRules.containsKey(surveyType)){
//             return score > scoreRules.get(surveyType).get(surveyTypeScale).get("neutral_type_max") &&
//                     score <= scoreRules.get(surveyType).get(surveyTypeScale).get("max") ;
//         } else {
//             return score > scoreRules.get("NPS").get(surveyTypeScale).get("neutral_type_max") &&
//                     score <= scoreRules.get("NPS").get(surveyTypeScale).get("max") ;
//         }
//     }
// 
//     public int maximumScore() {
//         if (surveyType != null & scoreRules.containsKey(surveyType)){
//             return scoreRules.get(surveyType).get(surveyTypeScale).get("max");
//         } else {
//             return scoreRules.get("NPS").get(surveyTypeScale).get("max");
//         }
//     }
// 
//     public int minimumScore() {
//         if (surveyType != null & scoreRules.containsKey(surveyType)){
//             return scoreRules.get(surveyType).get(surveyTypeScale).get("min");
//         } else {
//             return scoreRules.get("NPS").get(surveyTypeScale).get("min");
//         }
//     }
// }


import android.view.View;
import com.wootric.androidsdk.R;
import com.wootric.androidsdk.objects.Score;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.MotionEvent;
    private OnScoreChangedListener mOnScoreChangedListener;

    public RatingBar(Context context) {
        super(context);
        init(context);
    }

    public RatingBar(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public RatingBar(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    private void init(Context context) {
        mContext = context;

        initResources();
        initPaints();

        setPadding(0, mRatingBarPaddingVertical, 0, mRatingBarPaddingVertical);

        setOnTouchListener(this);
    }

    private void initResources() {
        Resources res = mContext.getResources();
// Path: androidsdk/src/main/java/com/wootric/androidsdk/objects/Score.java
// public final class Score {
//     private final int score;
//     private final String surveyType;
//     private final int surveyTypeScale;
// 
//     private static final HashMap<String, ArrayList<HashMap<String, Integer>>> scoreRules = new HashMap<String, ArrayList<HashMap<String, Integer>>>(){
//         {
//             put("NPS", new ArrayList<HashMap<String, Integer>>() {{
//                 add(new HashMap<String, Integer>() {{
//                     put("min", 0);
//                     put("max", 10);
//                     put("negative_type_max", 6);
//                     put("neutral_type_max", 8);
//                 }});
//             }});
//             put("CES", new ArrayList<HashMap<String, Integer>>() {{
//                 add(new HashMap<String, Integer>() {{
//                     put("min", 1);
//                     put("max", 7);
//                     put("negative_type_max", 3);
//                     put("neutral_type_max", 5);
//                 }});
//             }});
//             put("CSAT", new ArrayList<HashMap<String, Integer>>() {{
//                 add(new HashMap<String, Integer>() {{
//                     put("min", 1);
//                     put("max", 5);
//                     put("negative_type_max", 2);
//                     put("neutral_type_max", 3);
//                 }});
//                 add(new HashMap<String, Integer>() {{
//                     put("min", 1);
//                     put("max", 10);
//                     put("negative_type_max", 6);
//                     put("neutral_type_max", 8);
//                 }});
//             }});
//         }
//     };
// 
//     public Score(int score, String surveyType, int surveyTypeScale) {
//         this.score = score;
//         this.surveyType = surveyType;
//         if (scoreRules.containsKey(surveyType) && surveyTypeScale >= 0 && surveyTypeScale < scoreRules.get(surveyType).size()){
//             this.surveyTypeScale = surveyTypeScale;
//         } else {
//             this.surveyTypeScale = 0;
//         }
//     }
// 
//     public boolean isDetractor() {
//         if (surveyType != null & scoreRules.containsKey(surveyType)){
//             return score >= scoreRules.get(surveyType).get(surveyTypeScale).get("min") &&
//                     score <= scoreRules.get(surveyType).get(surveyTypeScale).get("negative_type_max");
//         } else {
//             return score >= scoreRules.get("NPS").get(surveyTypeScale).get("min") &&
//                     score <= scoreRules.get("NPS").get(surveyTypeScale).get("negative_type_max");
//         }
//     }
// 
//     public boolean isPassive() {
//         if (surveyType != null & scoreRules.containsKey(surveyType)){
//             return score > scoreRules.get(surveyType).get(surveyTypeScale).get("negative_type_max") &&
//                     score <= scoreRules.get(surveyType).get(surveyTypeScale).get("neutral_type_max");
//         } else {
//             return score > scoreRules.get("NPS").get(surveyTypeScale).get("negative_type_max") &&
//                     score <= scoreRules.get("NPS").get(surveyTypeScale).get("neutral_type_max");
//         }
//     }
// 
//     public boolean isPromoter() {
//         if (surveyType != null & scoreRules.containsKey(surveyType)){
//             return score > scoreRules.get(surveyType).get(surveyTypeScale).get("neutral_type_max") &&
//                     score <= scoreRules.get(surveyType).get(surveyTypeScale).get("max") ;
//         } else {
//             return score > scoreRules.get("NPS").get(surveyTypeScale).get("neutral_type_max") &&
//                     score <= scoreRules.get("NPS").get(surveyTypeScale).get("max") ;
//         }
//     }
// 
//     public int maximumScore() {
//         if (surveyType != null & scoreRules.containsKey(surveyType)){
//             return scoreRules.get(surveyType).get(surveyTypeScale).get("max");
//         } else {
//             return scoreRules.get("NPS").get(surveyTypeScale).get("max");
//         }
//     }
// 
//     public int minimumScore() {
//         if (surveyType != null & scoreRules.containsKey(surveyType)){
//             return scoreRules.get(surveyType).get(surveyTypeScale).get("min");
//         } else {
//             return scoreRules.get("NPS").get(surveyTypeScale).get("min");
//         }
//     }
// }


// Path: androidsdk/src/main/java/com/wootric/androidsdk/views/phone/RatingBar.java
import android.view.View;
import com.wootric.androidsdk.R;
import com.wootric.androidsdk.objects.Score;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.MotionEvent;

    private OnScoreChangedListener mOnScoreChangedListener;

    public RatingBar(Context context) {
        super(context);
        init(context);
    }

    public RatingBar(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public RatingBar(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    private void init(Context context) {
        mContext = context;

        initResources();
        initPaints();

        setPadding(0, mRatingBarPaddingVertical, 0, mRatingBarPaddingVertical);

        setOnTouchListener(this);
    }

    private void initResources() {
        Resources res = mContext.getResources();
        Score score = new Score(-1, mSurveyType, mSurveyTypeScale);