TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c

以下内容为反编译后的 GiftMessageUtils.java 源代码,内容仅作参考


package com.tencent.mobileqq.app.message;

import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import com.tencent.mobileqq.data.MessageForStructing;
import com.tencent.mobileqq.data.MessageRecord;
import com.tencent.mobileqq.structmsg.AbsShareMsg;
import com.tencent.mobileqq.structmsg.AbsStructMsgElement;
import com.tencent.mobileqq.structmsg.view.StructMsgItemLayout12;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.json.JSONException;
import org.json.JSONObject;
public class GiftMessageUtils {
    public static final int f87750a = 1;
    public static final String f18986a = "http://imgcache.qq.com/club/client/flower/release/html/received_list.html?_wv=2147347&visit=owner&sourceType=%d&ADTAG=%s&totalFlower=%d&_bid=2050&isfresh=%d";
    public static final int f87751b = 52;
    public static final String f18987b = "http://imgcache.qq.com/club/client/flower/release/html/received_list.html?_wv=2147347&visit=guest&strangerUin=%s&sourceType=%d&ADTAG=%s&sign=%s&totalFlower=%d&_bid=2050";
    public static final String f87752c = "http://imgcache.qq.com/club/client/flower/release/html/index.html?strangerUin=%s&sign=%s&sourceType=%d&ADTAG=%s&groupCode=%s&_wv=2147347&_bid=2050";
    public static final String d = "http://imgcache.qq.com/club/client/flower/release/html/gift_mall.html?ADTAG=%s&_bid=2050&sourceType=%d&_handle=1&_wv=2147347&platId=1&qqVersion=%s";
    public static final String e = "http://sqimg.qq.com/qq_product_operations/flower/images/f/%s";
    public static final String f = "http://sqimg.qq.com/qq_product_operations/flower/images/aio-msg/android/%s";
    public static final String g = "http://sqimg.qq.com/qq_product_operations/flower/images/aio-bg/%s";
    public static final String h = "http://sqimg.qq.com/qq_product_operations/flower/animation/android/";
    public static final String i = "aio.plus.s";
    public static final String j = "aio.m.s";
    public static final String k = "rank.s";
    public static final String l = "near.card.ro";
    public static final String m = "near.more.r";
    public static final String n = "aio.m.r";
    public static final String o = "near.card.rg";
    public static final String p = "near.card.s";
    public static final String q = "aio.m.xiaohuitiao";
    public static final String r = "aio.m.mall";
    public static final String s = "aio.hotchat.plus.s";
    public static final String t = "aio.hotchat.name.s";
    public static final String u = "aio.hotchat.m.s";
    public static final String v = "aio.hotchat.m_other.s";
    public static final String w = "ran.select.s";
    public static final String x = "ran.card.s";

    public class GiftInfo {
        public int f87753a;
        public String f18988a;
        public int f87754b;

        public GiftInfo(String str, int i, int i2) {
            this.f18988a = str;
            this.f87753a = i;
            this.f87754b = i2;
        }
    }

    public static int a(MessageRecord messageRecord, int i2) {
        int i3 = 0;
        List a2 = a(messageRecord);
        if (a2 == null) {
            return 0;
        }
        Iterator it = a2.iterator();
        while (true) {
            int i4 = i3;
            if (it.hasNext()) {
                GiftInfo giftInfo = (GiftInfo) it.next();
                i3 = giftInfo.f87753a == i2 ? giftInfo.f87754b + i4 : i4;
            } else {
                return i4;
            }
        }
    }

    public static List a(MessageRecord messageRecord) {
        String str;
        int i2;
        int i3;
        if ((messageRecord instanceof MessageForStructing) && (((MessageForStructing) messageRecord).structingMsg instanceof AbsShareMsg) && ((MessageForStructing) messageRecord).structingMsg.mMsgServiceID == 52) {
            ArrayList arrayList = new ArrayList();
            Iterator it = ((AbsShareMsg) ((MessageForStructing) messageRecord).structingMsg).iterator();
            while (it.hasNext()) {
                AbsStructMsgElement absStructMsgElement = (AbsStructMsgElement) it.next();
                if (absStructMsgElement != null) {
                    String str2 = "礼物";
                    int i4 = 1;
                    if (absStructMsgElement instanceof StructMsgItemLayout12) {
                        i3 = ((StructMsgItemLayout12) absStructMsgElement).f29592a.getInt("count");
                        i2 = 1;
                        str = "礼物";
                    } else {
                        String str3 = absStructMsgElement.f29468h;
                        if (str3 == null) {
                            i3 = 0;
                            i2 = 1;
                            str = "礼物";
                        } else {
                            try {
                                JSONObject jSONObject = new JSONObject(str3);
                                str2 = jSONObject.getString("giftName");
                                i4 = jSONObject.getInt("giftType");
                                i3 = jSONObject.getInt("giftCount");
                                i2 = i4;
                                str = str2;
                            } catch (JSONException e2) {
                                int i5 = i4;
                                str = str2;
                                e2.printStackTrace();
                                i2 = i5;
                                i3 = 0;
                            }
                        }
                    }
                    arrayList.add(new GiftInfo(str, i2, i3));
                }
            }
            return arrayList;
        }
        return null;
    }

    public static Drawable a(Drawable drawable, int i2, int i3, int i4) {
        if (drawable == null) {
            return null;
        }
        GradientDrawable gradientDrawable = new GradientDrawable();
        gradientDrawable.setShape(i4);
        gradientDrawable.setStroke(i2, i3);
        LayerDrawable layerDrawable = new LayerDrawable(new Drawable[]{gradientDrawable, drawable});
        layerDrawable.setLayerInset(1, i2, i2, i2, i2);
        return layerDrawable;
    }
}