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

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


package com.tencent.mobileqq.emoticonview;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.tencent.image.URLImageView;
import com.tencent.mobileqq.activity.ChatActivity;
import com.tencent.mobileqq.activity.QQBrowserActivity;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.data.EmoticonPackage;
import com.tencent.mobileqq.emoticonview.BaseEmotionAdapter;
import com.tencent.mobileqq.statistics.ReportController;
import com.tencent.mobileqq.vaswebviewplugin.EmojiHomeUiPlugin;
import com.tencent.qphone.base.util.QLog;
import com.tencent.tim.R;
import com.tencent.util.MqqWeakReferenceHandler;
import com.tencent.widget.XPanelContainer;
import mqq.os.MqqHandler;
public class EmotionCompleteInvalidAdapter extends EmotionNeedDownloadAdapter implements Handler.Callback, View.OnClickListener {
    public static final String f89141b = EmotionCompleteInvalidAdapter.class.getSimpleName();
    public static final int h = 1;
    public static final int i = 2;
    private static final int o = 100;
    protected Button f89142a;
    protected LinearLayout f22217a;
    protected EmoticonPackage f22218a;
    private MqqHandler f22219a;
    private boolean f22220a;
    protected int j;
    protected int k;

    public class EmotionCompletedInvalidViewHolder extends BaseEmotionAdapter.ViewHolder {
        public Button f89143a;
        public LinearLayout f22221a;
        public TextView f22222a;
        public EmotionInvalidPanelLinearLayout f22223a;
    }

    public EmotionCompleteInvalidAdapter(QQAppInterface qQAppInterface, Context context, int i2, int i3, int i4, EmoticonPackage emoticonPackage, EmoticonCallback emoticonCallback) {
        super(qQAppInterface, context, i2, i3, i4, emoticonCallback);
        this.f22219a = new MqqWeakReferenceHandler(Looper.getMainLooper(), this, true);
        this.f22218a = emoticonPackage;
        this.j = XPanelContainer.f97471c - ((int) context.getResources().getDimension(R.dimen.f39681name_res_0x7f0c010b));
        this.f22220a = emoticonPackage.jobType == 4;
        if (emoticonPackage.mobileFeetype == 4) {
            this.k = 1;
        } else {
            this.k = 2;
        }
    }

    @Override
    public int getCount() {
        return 1;
    }

    @Override
    public EmoticonPackage mo5984a() {
        return this.f22218a;
    }

    @Override
    public View a(BaseEmotionAdapter.ViewHolder viewHolder, int i2, View view, ViewGroup viewGroup) {
        int i3;
        boolean z;
        View a2;
        EmotionCompletedInvalidViewHolder emotionCompletedInvalidViewHolder = (EmotionCompletedInvalidViewHolder) viewHolder;
        FrameLayout frameLayout = view;
        if (view == null) {
            FrameLayout frameLayout2 = new FrameLayout(this.f22084a);
            LinearLayout a3 = a(emotionCompletedInvalidViewHolder);
            if (this.f22220a) {
                a2 = EmotionPanelViewPool.a().a(11);
                if (a2 == null) {
                    if (QLog.isColorLevel()) {
                        QLog.d(f89141b, 2, "getEmotionView smallemotion view from inflater");
                    }
                    a2 = new EmotionInvalidPanelLinearLayout(this.f22084a, this.f22218a, 7, this.f89097c);
                } else if (QLog.isColorLevel()) {
                    QLog.d(f89141b, 2, "getEmotionView smallemotion view from cache");
                }
            } else {
                a2 = EmotionPanelViewPool.a().a(10);
                if (a2 == null) {
                    if (QLog.isColorLevel()) {
                        QLog.d(f89141b, 2, "getEmotionView positon = " + i2 + ";bigemotion view from inflater");
                    }
                    a2 = new EmotionInvalidPanelLinearLayout(this.f22084a, this.f22218a, 4, this.f89097c);
                } else if (QLog.isColorLevel()) {
                    QLog.d(f89141b, 2, "getEmotionView positon = " + i2 + ";bigemotion view from cache");
                }
            }
            if (this.f22220a) {
                a(11, a2);
            } else {
                a(10, a2);
            }
            frameLayout2.addView(a2, new FrameLayout.LayoutParams(-1, this.j));
            frameLayout2.addView(a3);
            emotionCompletedInvalidViewHolder.f22223a = (EmotionInvalidPanelLinearLayout) a2;
            frameLayout = frameLayout2;
        }
        this.f89142a = emotionCompletedInvalidViewHolder.f89143a;
        this.f22217a = emotionCompletedInvalidViewHolder.f22221a;
        String str = "立即开通";
        String str2 = "会员";
        if (this.k == 2) {
            str2 = "超级会员";
        }
        String str3 = "该表情为" + str2 + "专享,\n开通" + str2 + "即可使用";
        if (this.f22218a.mobileFeetype == 6) {
            str3 = "活动已到期";
            str = "查看详情";
        } else if (this.f22218a.mobileFeetype == 2) {
            str3 = "查看详情并购买后即可使用该表情";
            str = "查看详情";
        } else if (this.f22218a.mobileFeetype == 3) {
            str3 = "表情限免已到期开通后即可使用";
            str = "查看详情";
        }
        emotionCompletedInvalidViewHolder.f22222a.setText(str3);
        emotionCompletedInvalidViewHolder.f89143a.setText(str);
        emotionCompletedInvalidViewHolder.f89143a.setOnClickListener(this);
        int i4 = 0;
        boolean z2 = false;
        EmotionInvalidPanelLinearLayout emotionInvalidPanelLinearLayout = emotionCompletedInvalidViewHolder.f22223a;
        int childCount = emotionInvalidPanelLinearLayout.getChildCount();
        for (int i5 = 0; i5 < childCount; i5++) {
            LinearLayout linearLayout = (LinearLayout) emotionInvalidPanelLinearLayout.getChildAt(i5);
            if (z2) {
                linearLayout.setVisibility(8);
            } else {
                int childCount2 = linearLayout.getChildCount();
                int i6 = 0;
                while (i6 < childCount2) {
                    View childAt = linearLayout.getChildAt(i6);
                    if (i4 > this.f22089a.size() - 1) {
                        childAt.setVisibility(8);
                        z = true;
                        i3 = i4;
                    } else {
                        childAt.setVisibility(0);
                        b(childAt, (EmotionPanelData) this.f22089a.get(i4));
                        boolean z3 = z2;
                        i3 = i4 + 1;
                        z = z3;
                    }
                    i6++;
                    i4 = i3;
                    z2 = z;
                }
            }
        }
        return frameLayout;
    }

    private LinearLayout a(EmotionCompletedInvalidViewHolder emotionCompletedInvalidViewHolder) {
        LinearLayout linearLayout = new LinearLayout(this.f22084a);
        linearLayout.setOrientation(1);
        linearLayout.setBackgroundColor(-16777216);
        linearLayout.getBackground().setAlpha(QQAppInterface.bU);
        linearLayout.setGravity(16);
        linearLayout.setLayoutParams(new FrameLayout.LayoutParams(-1, this.j));
        TextView textView = new TextView(this.f22084a);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
        layoutParams.gravity = 1;
        textView.setGravity(1);
        linearLayout.addView(textView, layoutParams);
        Button button = new Button(this.f22084a);
        button.setId(R.id.f49213name_res_0x7f090859);
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-2, (int) (25.0f * this.f22083a));
        button.setGravity(17);
        layoutParams2.topMargin = (int) (10.0f * this.f22083a);
        layoutParams2.gravity = 1;
        button.setBackgroundDrawable(this.f22084a.getResources().getDrawable(R.drawable.f41605name_res_0x7f020210));
        ColorStateList colorStateList = this.f22084a.getResources().getColorStateList(R.color.f39235name_res_0x7f0b0342);
        if (colorStateList != null) {
            button.setTextColor(colorStateList);
        }
        button.setPadding((int) (this.f22083a * 30.0f), 0, (int) (this.f22083a * 30.0f), 0);
        linearLayout.addView(button, layoutParams2);
        emotionCompletedInvalidViewHolder.f22221a = linearLayout;
        emotionCompletedInvalidViewHolder.f22222a = textView;
        emotionCompletedInvalidViewHolder.f89143a = button;
        return linearLayout;
    }

    @Override
    public BaseEmotionAdapter.ViewHolder mo5985a() {
        return new EmotionCompletedInvalidViewHolder();
    }

    private void b(View view, EmotionPanelData emotionPanelData) {
        EmoticonInfo emoticonInfo;
        if (view == null || emotionPanelData == null) {
            QLog.e(f89141b, 1, "updateUI contentView or info = null");
            return;
        }
        if (QLog.isColorLevel()) {
            QLog.d(f89141b, 2, "updateUI");
        }
        if (this.f22220a) {
            view.setVisibility(0);
            if (!(emotionPanelData instanceof EmoticonInfo)) {
                emoticonInfo = null;
            } else {
                emoticonInfo = (EmoticonInfo) emotionPanelData;
            }
            if (emoticonInfo == null) {
                QLog.e(f89141b, 1, "updateUI emotionInfo = null");
                return;
            }
            URLImageView uRLImageView = (URLImageView) view.findViewById(R.id.f47229name_res_0x7f090097);
            uRLImageView.setImageDrawable(emoticonInfo.a(this.f22084a, this.f22083a));
            uRLImageView.setVisibility(0);
            return;
        }
        super.a(view, emotionPanelData);
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.f49213name_res_0x7f090859) {
            if (this.f22218a == null) {
                QLog.e(f89141b, 1, "onClick EP = NULL");
            } else if (this.f22218a.mobileFeetype == 4 || this.f22218a.mobileFeetype == 5) {
                String str = "mvip.gexinghua.android.sbp_" + this.f22218a.epId;
                String str2 = "!vip";
                if (this.f22218a.mobileFeetype == 5) {
                    str2 = "!svip";
                }
                String str3 = "http://mc.vip.qq.com/qqwallet/index?aid=" + str + "&type=" + str2 + "&send=0&return_url=jsbridge://qw_charge/emojiPayResultOk";
                Intent intent = new Intent(this.f22084a, QQBrowserActivity.class);
                intent.putExtra("url", str3);
                if (this.f22084a instanceof Activity) {
                    ((Activity) this.f22084a).startActivityForResult(intent, 4813);
                }
                if (!this.f22220a) {
                    ReportController.b(this.f22085a, "dc01331", "", "", "ep_mall", "0X80057B3", 0, 0, this.f22218a.epId, "", "", "");
                }
            } else if (!this.f22218a.valid) {
                EmojiHomeUiPlugin.openEmojiDetailPage((Activity) this.f22084a, this.f22085a.getAccount(), 8, String.valueOf(this.f22218a.epId), false, this.f22218a.jobType == 4);
            }
        }
    }

    @Override
    public void a(int i2) {
        if (QLog.isColorLevel()) {
            QLog.d(f89141b, 2, "payBack");
        }
        if (18 == i2) {
            this.f22219a.sendEmptyMessage(100);
        }
    }

    @Override
    public boolean handleMessage(Message message) {
        switch (message.what) {
            case 100:
                if (this.f22217a != null) {
                    this.f22217a.setVisibility(8);
                }
                MqqHandler handler = this.f22085a.getHandler(ChatActivity.class);
                if (handler != null) {
                    handler.obtainMessage(43).sendToTarget();
                    return true;
                }
                return true;
            default:
                return true;
        }
    }
}