// Path: Chatting/src/cn/jmessage/android/uikit/chatting/utils/IdHelper.java
// public class IdHelper {
// 
//     public static int getLayout(Context context, String layoutName) {
//         return context.getResources().getIdentifier(layoutName, "layout",
//                 context.getApplicationContext().getPackageName());
//     }
// 
//     public static int getViewID(Context context, String IDName) {
//         return context.getResources().getIdentifier(IDName, "id",
//                 context.getApplicationContext().getPackageName());
//     }
// 
//     public static int getDrawable(Context context, String drawableName) {
//         return context.getResources().getIdentifier(drawableName, "drawable",
//                 context.getApplicationContext().getPackageName());
//     }
// 
//     public static int getAttr(Context context, String attrName) {
//         return context.getResources().getIdentifier(attrName, "attr",
//                 context.getApplicationContext().getPackageName());
//     }
// 
//     public static int getString(Context context, String stringName) {
//         return context.getResources().getIdentifier(stringName, "string",
//                 context.getApplicationContext().getPackageName());
//     }
// 
//     public static int getStyle(Context context, String styleName) {
//         return context.getResources().getIdentifier(styleName, "style",
//                 context.getApplicationContext().getPackageName());
//     }
// 
//     public static int[] getResourceDeclareStyleableIntArray(Context context, String name) {
//         try {
//             Field[] fields2 = Class.forName(context.getPackageName() + ".R$styleable").getFields();
// 
//             //browse all fields
//             for (Field f : fields2) {
//                 //pick matching field
//                 if (f.getName().equals(name)) {
//                     //return as int array
//                     return (int[]) f.get(null);
//                 }
//             }
//         } catch (Throwable t) {
//             t.printStackTrace();
//         }
// 
//         return null;
//     }
// 
//     public static int getAnim(Context context, String animName) {
//         return context.getResources().getIdentifier(animName, "anim",
//                 context.getApplicationContext().getPackageName());
//     }
// }


import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
import cn.jmessage.android.uikit.chatting.utils.IdHelper;
package cn.jmessage.android.uikit.chatting.shader;
/**
 *The MIT License (MIT)

 Copyright (c) 2015 Siyamed Sinir

 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.
 */


public class BubbleShader extends ShaderHelper {
    private static final int DEFAULT_HEIGHT_DP = 10;

    private enum ArrowPosition {
        @SuppressLint("RtlHardcoded")
        LEFT,
        RIGHT
    }

    private final Path path = new Path();

    private int radius = 0;
    private int triangleHeightPx;
    private ArrowPosition arrowPosition = ArrowPosition.LEFT;

    public BubbleShader() {
    }

    @Override
    public void init(Context context, AttributeSet attrs, int defStyle) {
        super.init(context, attrs, defStyle);
        borderWidth = 0;
        if (attrs != null) {
// Path: Chatting/src/cn/jmessage/android/uikit/chatting/utils/IdHelper.java
// public class IdHelper {
// 
//     public static int getLayout(Context context, String layoutName) {
//         return context.getResources().getIdentifier(layoutName, "layout",
//                 context.getApplicationContext().getPackageName());
//     }
// 
//     public static int getViewID(Context context, String IDName) {
//         return context.getResources().getIdentifier(IDName, "id",
//                 context.getApplicationContext().getPackageName());
//     }
// 
//     public static int getDrawable(Context context, String drawableName) {
//         return context.getResources().getIdentifier(drawableName, "drawable",
//                 context.getApplicationContext().getPackageName());
//     }
// 
//     public static int getAttr(Context context, String attrName) {
//         return context.getResources().getIdentifier(attrName, "attr",
//                 context.getApplicationContext().getPackageName());
//     }
// 
//     public static int getString(Context context, String stringName) {
//         return context.getResources().getIdentifier(stringName, "string",
//                 context.getApplicationContext().getPackageName());
//     }
// 
//     public static int getStyle(Context context, String styleName) {
//         return context.getResources().getIdentifier(styleName, "style",
//                 context.getApplicationContext().getPackageName());
//     }
// 
//     public static int[] getResourceDeclareStyleableIntArray(Context context, String name) {
//         try {
//             Field[] fields2 = Class.forName(context.getPackageName() + ".R$styleable").getFields();
// 
//             //browse all fields
//             for (Field f : fields2) {
//                 //pick matching field
//                 if (f.getName().equals(name)) {
//                     //return as int array
//                     return (int[]) f.get(null);
//                 }
//             }
//         } catch (Throwable t) {
//             t.printStackTrace();
//         }
// 
//         return null;
//     }
// 
//     public static int getAnim(Context context, String animName) {
//         return context.getResources().getIdentifier(animName, "anim",
//                 context.getApplicationContext().getPackageName());
//     }
// }


// Path: Chatting/src/cn/jmessage/android/uikit/chatting/shader/BubbleShader.java
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
import cn.jmessage.android.uikit.chatting.utils.IdHelper;

package cn.jmessage.android.uikit.chatting.shader;
/**
 *The MIT License (MIT)

 Copyright (c) 2015 Siyamed Sinir

 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.
 */


public class BubbleShader extends ShaderHelper {
    private static final int DEFAULT_HEIGHT_DP = 10;

    private enum ArrowPosition {
        @SuppressLint("RtlHardcoded")
        LEFT,
        RIGHT
    }

    private final Path path = new Path();

    private int radius = 0;
    private int triangleHeightPx;
    private ArrowPosition arrowPosition = ArrowPosition.LEFT;

    public BubbleShader() {
    }

    @Override
    public void init(Context context, AttributeSet attrs, int defStyle) {
        super.init(context, attrs, defStyle);
        borderWidth = 0;
        if (attrs != null) {
            int[] declareStyleableArray = IdHelper.getResourceDeclareStyleableIntArray(context, "ShaderImageView");