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

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


package com.tencent.mobileqq.activity;

import ActionMsg.MsgBody;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.SQLException;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.format.Time;
import android.text.method.LinkMovementMethod;
import android.text.style.ForegroundColorSpan;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CursorAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.tencent.av.camera.config.CameraConfigParser;
import com.tencent.biz.anonymous.AnonymousChatHelper;
import com.tencent.biz.pubaccount.util.PublicAccountConfigUtil;
import com.tencent.biz.troop.EditUniqueTitleActivity;
import com.tencent.common.app.BaseApplicationImpl;
import com.tencent.common.config.AppSetting;
import com.tencent.image.URLDrawable;
import com.tencent.mobileqq.activity.aio.AIOUtils;
import com.tencent.mobileqq.activity.aio.AudioPlayer;
import com.tencent.mobileqq.activity.aio.MediaPlayerManager;
import com.tencent.mobileqq.activity.aio.MixedImageOnclickListener;
import com.tencent.mobileqq.activity.aio.SessionInfo;
import com.tencent.mobileqq.activity.aio.item.ChatThumbView;
import com.tencent.mobileqq.activity.aio.item.MarketFaceItemBuilder;
import com.tencent.mobileqq.activity.aio.item.PicItemBuilder;
import com.tencent.mobileqq.activity.messagesearch.MessageSearchDialog;
import com.tencent.mobileqq.apollo.utils.ApolloUtil;
import com.tencent.mobileqq.app.AppConstants;
import com.tencent.mobileqq.app.FlashPicHelper;
import com.tencent.mobileqq.app.FriendsManager;
import com.tencent.mobileqq.app.IphoneTitleBarActivity;
import com.tencent.mobileqq.app.LogTag;
import com.tencent.mobileqq.app.MessageObserver;
import com.tencent.mobileqq.app.MessageRoamManager;
import com.tencent.mobileqq.app.PublicAccountDataManager;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.app.SQLiteDatabase;
import com.tencent.mobileqq.app.ThreadManager;
import com.tencent.mobileqq.app.TroopManager;
import com.tencent.mobileqq.app.automator.StepFactory;
import com.tencent.mobileqq.app.message.MsgProxyUtils;
import com.tencent.mobileqq.app.proxy.ProxyObserver;
import com.tencent.mobileqq.app.utils.MessagePkgUtils;
import com.tencent.mobileqq.data.ArkAppMessage;
import com.tencent.mobileqq.data.MarkFaceMessage;
import com.tencent.mobileqq.data.MessageForApollo;
import com.tencent.mobileqq.data.MessageForDeliverGiftTips;
import com.tencent.mobileqq.data.MessageForDingdongSchedule;
import com.tencent.mobileqq.data.MessageForFoldMsg;
import com.tencent.mobileqq.data.MessageForIncompatibleGrayTips;
import com.tencent.mobileqq.data.MessageForMixedMsg;
import com.tencent.mobileqq.data.MessageForPic;
import com.tencent.mobileqq.data.MessageForPtt;
import com.tencent.mobileqq.data.MessageForPubAccount;
import com.tencent.mobileqq.data.MessageForQQWalletMsg;
import com.tencent.mobileqq.data.MessageForText;
import com.tencent.mobileqq.data.MessageForToDo;
import com.tencent.mobileqq.data.MessageForTroopFee;
import com.tencent.mobileqq.data.MessageForTroopGift;
import com.tencent.mobileqq.data.MessageForTroopReward;
import com.tencent.mobileqq.data.MessageForTroopTopic;
import com.tencent.mobileqq.data.MessageForUnknownMsg;
import com.tencent.mobileqq.data.MessageRecord;
import com.tencent.mobileqq.data.PublicAccountInfo;
import com.tencent.mobileqq.data.SystemMsg;
import com.tencent.mobileqq.data.TroopInfo;
import com.tencent.mobileqq.data.TroopMemberInfo;
import com.tencent.mobileqq.emoticonview.EmoticonUtils;
import com.tencent.mobileqq.emoticonview.PicEmoticonInfo;
import com.tencent.mobileqq.graytip.MessageForUniteGrayTip;
import com.tencent.mobileqq.magicface.drawable.PngFrameManager;
import com.tencent.mobileqq.magicface.drawable.PngFrameUtil;
import com.tencent.mobileqq.model.EmoticonManager;
import com.tencent.mobileqq.msf.core.NetConnInfoCenter;
import com.tencent.mobileqq.openapi.sdk.MessageItem;
import com.tencent.mobileqq.pb.InvalidProtocolBufferMicroException;
import com.tencent.mobileqq.persistence.EntityManager;
import com.tencent.mobileqq.persistence.qslowtable.QSlowTableManager;
import com.tencent.mobileqq.service.message.MessageUtils;
import com.tencent.mobileqq.shortvideo.ShortVideoConstants;
import com.tencent.mobileqq.statistics.ReportController;
import com.tencent.mobileqq.structmsg.AbsShareMsg;
import com.tencent.mobileqq.structmsg.AbsStructMsg;
import com.tencent.mobileqq.structmsg.StructMsgFactory;
import com.tencent.mobileqq.text.QQText;
import com.tencent.mobileqq.theme.ThemeUtil;
import com.tencent.mobileqq.transfile.TransfileUtile;
import com.tencent.mobileqq.troop.data.TroopRankColorConfig;
import com.tencent.mobileqq.troop.text.AtTroopMemberSpan;
import com.tencent.mobileqq.troop.utils.TroopBarUtils;
import com.tencent.mobileqq.troop.utils.TroopBindPublicAccountMgr;
import com.tencent.mobileqq.troop.utils.TroopBusinessUtil;
import com.tencent.mobileqq.troop.utils.TroopUtils;
import com.tencent.mobileqq.util.ImageWorker;
import com.tencent.mobileqq.util.Utils;
import com.tencent.mobileqq.utils.ActionMsgUtil;
import com.tencent.mobileqq.utils.AudioUtil;
import com.tencent.mobileqq.utils.ContactUtils;
import com.tencent.mobileqq.utils.DialogUtil;
import com.tencent.mobileqq.utils.FileUtils;
import com.tencent.mobileqq.utils.MessageDBUtils;
import com.tencent.mobileqq.utils.MsgUtils;
import com.tencent.mobileqq.utils.NetworkUtil;
import com.tencent.mobileqq.utils.QQRecorder;
import com.tencent.mobileqq.widget.AnimationTextView;
import com.tencent.mobileqq.widget.MixedMsgLinearLayout;
import com.tencent.mobileqq.widget.PatchedTextView;
import com.tencent.mobileqq.widget.QQProgressDialog;
import com.tencent.mobileqq.widget.QQToast;
import com.tencent.mqp.app.sec.MQPSensitiveMsgUtil;
import com.tencent.qphone.base.util.QLog;
import com.tencent.tim.R;
import com.tencent.util.IOUtils;
import com.tencent.util.InputMethodUtil;
import com.tencent.util.MqqWeakReferenceHandler;
import com.tencent.widget.AbsListView;
import com.tencent.widget.ActionSheet;
import com.tencent.widget.ActionSheetHelper;
import com.tencent.widget.XListView;
import com.tencent.widget.immersive.ImmersiveUtils;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.regex.Pattern;
import localpb.richMsg.MixedMsg;
import localpb.richMsg.RichMsg;
import mqq.app.AppRuntime;
import mqq.os.MqqHandler;
import wns_proxy.HttpRsp;
public class ChatHistory extends IphoneTitleBarActivity implements SensorEventListener {
    static final int A = 1;
    private static final int C = 604800;
    private static Toast f84966a = null;
    public static final String f84967b = "from_RecentSaidActivity";
    public static final String f84968c = "target_shmsgseq";
    static final int d = 8;
    static final String g = "http://m.qzone.com";
    static final String h = "http://mobile.qzone.qq.com";
    static final int k = 0;
    static final int l = 1;
    static final int m = 2;
    static final int n = 3;
    static final int o = 4;
    static final int p = 5;
    public static final int q = 6;
    static final int r = 7;
    static final int s = 8;
    static final int t = 9;
    static final int u = 10;
    static final int v = 11;
    static final int w = 12;
    static final int x = 13;
    public static final int y = 200;
    public int B;
    private int D;
    float f8629a;
    public int f8630a;
    public Dialog f8632a;
    private Sensor f8634a;
    private SensorManager f8635a;
    public View f8638a;
    private Button f8639a;
    public EditText f8640a;
    public ImageView f8641a;
    public TextView f8642a;
    public ChatHistoryAdapter f8643a;
    public PlayingPttHistoryInfo f8644a;
    private AudioPlayer f8646a;
    private SessionInfo f8647a;
    public MessageSearchDialog f8648a;
    private EntityManager f8651a;
    ImageWorker f8653a;
    public QQProgressDialog f8654a;
    private XListView f8656a;
    private float f8663b;
    public int f8664b;
    private long f8665b;
    public Dialog f8666b;
    public View f8668b;
    private Button f8669b;
    public ImageView f8670b;
    TextView f8671b;
    private QQProgressDialog f8672b;
    private boolean f8673b;
    public Dialog f8675c;
    private AnimationDrawable f8676c;
    View f8677c;
    public TextView f8678c;
    private boolean f8679c;
    public String f8680d;
    private boolean f8681d;
    public String f8682e;
    private boolean f8683e;
    int f;
    public String f8684f;
    int f8685g;
    int f8686h;
    int i;
    final String f8658a = "ChatHistory";
    private StringBuffer f8659a = new StringBuffer();
    public int f8674c = 1;
    public int e = 0;
    final int j = 60;
    AnimationDrawable f8633a = null;
    AnimationDrawable f8667b = null;
    public long f8631a = 0;
    private int E = 999;
    private Object f8657a = new Object();
    public QSlowTableManager f8652a = null;
    public boolean f8662a = false;
    public int z = 0;
    Handler.Callback f8636a = new jnq(this);
    public MqqHandler f8661a = new MqqWeakReferenceHandler(this.f8636a);
    private Handler f8637a = new joe(this);
    jpg f8660a = new jpg(this, null);
    private MessageObserver f8649a = new jok(this);
    private ProxyObserver f8650a = new jol(this);
    private AudioPlayer.AudioPlayerListener f8645a = new jom(this);
    AbsListView.OnScrollListener f8655a = new jon(this);

    @Override
    public boolean doOnCreate(Bundle bundle) {
        super.doOnCreate(bundle);
        addObserver(this.f8649a);
        this.f8629a = getResources().getDisplayMetrics().density;
        this.f8633a = (AnimationDrawable) getResources().getDrawable(R.anim.f37757name_res_0x7f0400e3);
        this.f8667b = (AnimationDrawable) getResources().getDrawable(R.anim.f37758name_res_0x7f0400e4);
        this.f8676c = (AnimationDrawable) getResources().getDrawable(R.anim.f37706name_res_0x7f0400b0);
        Bundle extras = getIntent().getExtras();
        this.f8680d = extras.getString("uin");
        this.f8630a = extras.getInt("uintype");
        this.f8647a = new SessionInfo();
        this.f8647a.f12447a = this.f8680d;
        this.f8647a.f85624a = this.f8630a;
        this.f8647a.f12450d = this.f8682e;
        this.f8647a.f12448b = extras.getString("troop_uin");
        setContentViewNoTitle(R.layout.f56507name_res_0x7f0300a2);
        LinearLayout linearLayout = (LinearLayout) findViewById(R.id.f47788root);
        if (ImmersiveUtils.isSupporImmersive() == 1) {
            linearLayout.setFitsSystemWindows(true);
            linearLayout.setPadding(0, ImmersiveUtils.a((Context) this), 0, 0);
        }
        boolean z = extras.getBoolean(f84967b, false);
        this.f8673b = z;
        if (z) {
            this.f8665b = extras.getLong(f84968c);
        }
        init(getIntent());
        this.app.setHandler(getClass(), this.f8661a);
        this.f8652a = (QSlowTableManager) this.app.getManager(QQAppInterface.ce);
        a(9, false);
        p();
        a(this.f8680d, this.f8630a);
        s();
        if (this.app.m4638a() != null) {
            this.app.m4638a().a(this.f8650a);
        }
        this.app.m4638a().e();
        this.f8653a = new ImageWorker(this);
        this.f8653a.a((int) (150.0f * this.f8629a), (int) (100.0f * this.f8629a));
        t();
        return true;
    }

    public EntityManager a() {
        if (this.f8651a == null || !this.f8651a.m7243a()) {
            synchronized (this.f8657a) {
                if (this.f8651a == null || !this.f8651a.m7243a()) {
                    this.f8651a = this.app.getEntityManagerFactory().createMessageRecordEntityManager();
                }
            }
        }
        return this.f8651a;
    }

    @Override
    public View onCreateRightView() {
        super.onCreateRightView();
        TextView textView = this.rightViewText;
        if (3000 == this.f8630a || 1 == this.f8630a) {
            this.rightViewText.setVisibility(8);
        } else {
            this.rightViewText.setVisibility(0);
        }
        textView.setText(R.string.f63773name_res_0x7f0a14fc);
        this.f8642a = textView;
        return textView;
    }

    private void l() {
        this.f8668b = View.inflate(getActivity(), R.layout.f56476name_res_0x7f030083, null);
        this.f8656a.a(this.f8668b);
        this.f8668b.setOnClickListener(new joq(this));
        this.f8678c = (TextView) this.f8668b.findViewById(R.id.f48361name_res_0x7f090505);
        this.f8638a = this.f8668b.findViewById(R.id.f48360name_res_0x7f090504);
        this.f8638a.setVisibility(8);
        this.f8668b.setVisibility(8);
    }

    public void m2412a() {
        View findViewById = findViewById(R.id.f48520name_res_0x7f0905a4);
        View findViewById2 = findViewById(R.id.f47788root);
        int height = findViewById.getHeight();
        this.f8648a = new MessageSearchDialog(this, this.app, this.f8647a);
        TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 0.0f, 0.0f, -height);
        translateAnimation.setDuration(200L);
        translateAnimation.setFillAfter(true);
        TranslateAnimation translateAnimation2 = new TranslateAnimation(0.0f, 0.0f, -height, 0.0f);
        translateAnimation2.setDuration(200L);
        translateAnimation.setAnimationListener(new jor(this, findViewById2, findViewById));
        translateAnimation2.setAnimationListener(new jos(this, findViewById2, height));
        this.f8648a.setOnDismissListener(new jot(this, findViewById2, height, findViewById, translateAnimation2));
        findViewById2.startAnimation(translateAnimation);
    }

    public boolean m2414a(int i) {
        if (i <= 0 || i > this.f8664b * 8) {
            return false;
        }
        this.f8679c = true;
        this.f8643a.f84971a = (i - 1) % 8;
        this.f8640a.setText(String.valueOf(((i - 1) / 8) + 1));
        this.f8640a.setSelection(this.f8640a.getText().length());
        return true;
    }

    void m2415b() {
        if (!this.f8673b) {
            this.f8677c = (RelativeLayout) View.inflate(this, R.layout.f58156search_box, null);
            RelativeLayout relativeLayout = new RelativeLayout(this);
            relativeLayout.addView(this.f8677c, new RelativeLayout.LayoutParams(-1, getResources().getDimensionPixelSize(R.dimen.f39557name_res_0x7f0c008f)));
            this.f8656a.a((View) relativeLayout);
            this.f8677c.findViewById(R.id.f48669btn_cancel_search).setVisibility(8);
            EditText editText = (EditText) this.f8677c.findViewById(R.id.f48670et_search_keyword);
            editText.setFocusableInTouchMode(false);
            editText.setCursorVisible(false);
            editText.setOnClickListener(new jou(this));
            setLayerType(this.f8677c);
        }
    }

    @Override
    public void finish() {
        super.finish();
    }

    private String m2409a() {
        return this.app.getCurrentAccountUin();
    }

    private String b() {
        String i = ContactUtils.i(this.app, this.app.getCurrentAccountUin());
        return (i == null || i.trim().equals("")) ? this.app.getCurrentAccountUin() : i;
    }

    private void a(String str, int i) {
        this.f8656a = (XListView) findViewById(R.id.f48521listViewHistory);
        m2415b();
        l();
        this.f8643a = new ChatHistoryAdapter(this, null);
        this.f8656a.setAdapter((ListAdapter) this.f8643a);
        this.f8656a.setOnScrollListener(this.f8655a);
        this.f8656a.setEdgeEffectEnabled(false);
        if (Build.VERSION.SDK_INT >= 9) {
            this.f8656a.setOverscrollFooter(null);
        }
        this.f8643a.a(str, i, this.e);
    }

    public int a(String str, int i, StringBuilder sb) {
        SQLiteDatabase m4685b;
        StringBuilder a2;
        Cursor m4769a;
        long j;
        if (this.app != null && (m4685b = this.app.m4685b()) != null) {
            if (this.f8630a == 0) {
                a2 = MessageDBUtils.a(MessageRecord.getOldTableName(str, i), MessageRecord.getTableName(str, i), m4685b, "", " msgtype " + MsgProxyUtils.b() + " and isValid=1 ", "");
            } else {
                a2 = MessageDBUtils.a(MessageRecord.getOldTableName(str, i), MessageRecord.getTableName(str, i), m4685b, " where msgtype " + MsgProxyUtils.b() + " and isValid=1 ");
            }
            if (a2 != null && (m4769a = m4685b.m4769a(a2.toString(), (String[]) null)) != null) {
                if (m4769a.getCount() > 0 && sb != null) {
                    m4769a.moveToLast();
                    if (this.f8630a == 3000) {
                        j = m4769a.getLong(m4769a.getColumnIndex("shmsgseq"));
                    } else if (this.f8630a == 0) {
                        j = m4769a.getLong(m4769a.getColumnIndex("time"));
                    } else {
                        j = this.f8630a == 1 ? m4769a.getLong(m4769a.getColumnIndex("shmsgseq")) : 0L;
                    }
                    if (j > 0) {
                        sb.append(String.valueOf(j));
                    }
                }
                int count = m4769a.getCount();
                m4769a.close();
                return count;
            }
            return 0;
        }
        return 0;
    }

    public void a(int i, boolean z) {
        ThreadManager.m4814b().post(new jov(this, z, i));
    }

    public void m() {
        FriendsManager friendsManager;
        this.f8641a = (ImageView) findViewById(R.id.f48525name_res_0x7f0905a9);
        this.f8670b = (ImageView) findViewById(R.id.f48529name_res_0x7f0905ad);
        this.f8641a.setContentDescription(getString(R.string.f65763name_res_0x7f0a1cc7));
        this.f8670b.setContentDescription(getString(R.string.f65764name_res_0x7f0a1cc8));
        this.f8641a.setOnClickListener(new jow(this));
        this.f8670b.setOnClickListener(new jns(this));
        this.f8670b.setEnabled(false);
        this.f8670b.setImageResource(R.drawable.f46253name_res_0x7f02143d);
        if (this.f8664b == 1) {
            this.f8641a.setEnabled(false);
            this.f8641a.setImageResource(R.drawable.f42422name_res_0x7f020544);
        }
        this.f8671b = (TextView) findViewById(R.id.f48528name_res_0x7f0905ac);
        this.f8671b.setText(String.valueOf(this.f8664b));
        this.f8640a = (EditText) findViewById(R.id.f48526name_res_0x7f0905aa);
        this.f8640a.setText(String.valueOf(this.f8674c));
        this.f8640a.setSelection(this.f8640a.getText().toString().length());
        this.f8640a.addTextChangedListener(new jnt(this));
        this.f8639a = (Button) findViewById(R.id.f48530name_res_0x7f0905ae);
        this.f8639a.setOnClickListener(new jnu(this));
        this.f8669b = (Button) findViewById(R.id.f48531buttonDelete);
        this.f8669b.setOnClickListener(new jnv(this));
        if (this.f8673b) {
            this.f8639a.setVisibility(8);
            this.f8669b.setVisibility(8);
        }
        if (this.f8630a == 1001 || this.f8630a == 1000 || this.f8630a == 1020 || this.f8630a == 1005 || this.f8630a == 1004 || this.f8630a == 1009 || this.f8630a == 1010 || this.f8630a == 1023 || this.f8630a == 1024) {
            this.f8642a.setVisibility(4);
        } else if (this.f8630a != 1 && this.f8630a != 3000 && ((friendsManager = (FriendsManager) this.app.getManager(50)) == null || !friendsManager.m4354b(String.valueOf(this.f8680d)))) {
            if (QLog.isColorLevel()) {
                QLog.e("ChatHistory", 2, "--mSyncHistory button: fm is null or the uin is not my friend: fm:" + friendsManager);
            }
            this.f8642a.setVisibility(4);
        }
        this.f8642a.setOnClickListener(new jnw(this));
    }

    public void a(int i) {
        Cursor cursor;
        if (i > 0 && (cursor = this.f8643a.getCursor()) != null) {
            cursor.requery();
        }
        if (this.f8630a == 0 && ((CheckBox) this.f8666b.findViewById(R.id.f49139delRoamMsg)).isChecked()) {
            o();
            this.app.m4644a().a(this.f8680d, this.f8630a);
        }
    }

    public void c() {
        n();
        this.f8640a.setText(String.valueOf(this.f8674c));
        this.f8640a.setSelection(this.f8640a.getText().length());
        this.f8671b.setText(String.valueOf(this.f8664b));
        this.f8643a.a(this.f8680d, this.f8630a, this.e);
    }

    public void n() {
        this.f8674c = this.f8664b;
        this.e = (this.f8674c - 1) * 8;
    }

    public void d() {
        if (this.f8674c > this.f8664b) {
            this.f8674c = this.f8664b;
            this.e = (this.f8674c - 1) * 8;
        }
        this.f8640a.setText(String.valueOf(this.f8674c));
        this.f8640a.setSelection(this.f8640a.getText().length());
        this.f8671b.setText(String.valueOf(this.f8664b));
        this.f8643a.a(this.f8680d, this.f8630a, this.e);
    }

    public void e() {
        this.f8661a.obtainMessage(4, getResources().getString(R.string.f63769name_res_0x7f0a14f8)).sendToTarget();
        this.app.m4626a().a((short) 1, (byte) 1);
    }

    public void f() {
        MessageRoamManager messageRoamManager = (MessageRoamManager) this.app.getManager(91);
        if (messageRoamManager != null) {
            long serverTime = NetConnInfoCenter.getServerTime();
            this.app.m4626a().a(this.f8680d, serverTime - 604800, 0L, serverTime, (short) 0, 0L, 1, null, messageRoamManager.b(), false, 0, false);
        }
    }

    private void o() {
        if (!NetworkUtil.e(this.app.getApplication().getApplicationContext())) {
            QQToast.a(getApplicationContext(), (int) R.string.f64063name_res_0x7f0a161e, 1).m9833a();
            return;
        }
        c(getApplication().getResources().getString(R.string.f64064name_res_0x7f0a161f));
        this.app.m4626a().c(this.f8680d);
    }

    public String a(AbsStructMsg absStructMsg) {
        if (absStructMsg == null || !AbsShareMsg.class.isInstance(absStructMsg)) {
            return null;
        }
        AbsShareMsg absShareMsg = (AbsShareMsg) absStructMsg;
        StringBuffer stringBuffer = new StringBuffer();
        if (!TextUtils.isEmpty(absShareMsg.mMsgBrief)) {
            stringBuffer.append(absShareMsg.mMsgBrief);
        } else if (!TextUtils.isEmpty(absShareMsg.mSourceName)) {
            stringBuffer.append(absShareMsg.mSourceName);
            stringBuffer.append(TroopBarUtils.y + getString(R.string.f65183name_res_0x7f0a1a83) + TroopBarUtils.y);
            if (!TextUtils.isEmpty(absShareMsg.mContentTitle)) {
                stringBuffer.append(absShareMsg.mContentTitle);
            }
        }
        return stringBuffer.toString();
    }

    public void m2413a(String str) {
        View inflate = getLayoutInflater().inflate(R.layout.f56663name_res_0x7f03013e, (ViewGroup) null);
        if (1 == this.f8630a) {
            ((TextView) inflate.findViewById(R.id.f48470textView1)).setText(R.string.f63670name_res_0x7f0a1495);
            inflate.findViewById(R.id.f49139delRoamMsg).setVisibility(8);
        } else if (3000 == this.f8630a) {
            ((TextView) inflate.findViewById(R.id.f48470textView1)).setText(R.string.f63671name_res_0x7f0a1496);
            inflate.findViewById(R.id.f49139delRoamMsg).setVisibility(8);
        } else if (1001 == this.f8630a || 1000 == this.f8630a || 1020 == this.f8630a || 1004 == this.f8630a) {
            inflate.findViewById(R.id.f49139delRoamMsg).setVisibility(8);
        }
        this.f8666b = DialogUtil.m9154a((Context) this, 230).setTitle(getString(R.string.f63633name_res_0x7f0a1470)).setPositiveButton(getString(R.string.f63878name_res_0x7f0a1565), new jny(this, str)).setNegativeButton(getString(R.string.f63668name_res_0x7f0a1493), new jnx(this)).addView(inflate);
        if (!isFinishing()) {
            this.f8666b.show();
        }
    }

    @Override
    public boolean onBackEvent() {
        try {
            if (this.f8640a != null) {
                InputMethodUtil.b(this.f8640a);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        setResult(-1);
        if (this.f8648a != null && this.f8648a.a()) {
            this.f8648a.show();
            this.f8648a.a(false);
            return true;
        }
        return super.onBackEvent();
    }

    public void g() {
        String format;
        this.f8659a.setLength(0);
        if (this.f8682e.compareTo(this.f8680d) == 0) {
            format = this.f8682e;
        } else {
            format = String.format("%s(%s)", this.f8682e, this.f8680d);
        }
        if (a(format)) {
            this.f8659a.append(format.replaceAll("[\\\\/:*?\"<>|]", "") + ".txt");
        } else {
            this.f8659a.append(this.f8680d + ".txt");
        }
        boolean a2 = FileUtils.a(AppConstants.bD, this.f8659a, ".txt");
        this.f8675c = DialogUtil.a(this, 230, getString(R.string.f63673name_res_0x7f0a1498), getString(R.string.f63673name_res_0x7f0a1498) + AppConstants.bD + this.f8659a.toString(), new joa(this), new joc(this));
        if (a2) {
            this.f8675c.show();
        } else {
            b(getString(R.string.f63675name_res_0x7f0a149a));
        }
    }

    public void h() {
        this.f8675c = DialogUtil.a(this, 230, getString(R.string.f63771name_res_0x7f0a14fa), getString(R.string.f63772name_res_0x7f0a14fb), new jod(this), new jof(this));
        this.f8675c.show();
    }

    public static boolean a(String str) {
        if (str == null || str.trim().equals("") || str.contains("\n")) {
            return false;
        }
        return !Pattern.compile("^[*+,./\\\"=_-]+").matcher(str.substring(0, 1)).matches();
    }

    boolean m2416b(String str) {
        if (str.charAt(0) == 22) {
            String[] split = str.split("\u0016")[1].split("\\|");
            if (split.length < 2) {
                return true;
            }
            if (split.length > 3) {
                try {
                    Long.valueOf(split[1]);
                    Integer.valueOf(split[2]);
                    Boolean.valueOf(split[3]);
                    return true;
                } catch (NumberFormatException e) {
                    return false;
                }
            }
            return false;
        }
        return false;
    }

    public void b(String str, int i) {
        StringBuilder a2;
        String str2;
        MixedMsg.Msg msg2;
        String str3 = "";
        StringBuffer stringBuffer = new StringBuffer();
        Cursor cursor = null;
        if (i == 1 || i == 3000) {
            a2 = MessageDBUtils.a(MessageRecord.getOldTableName(str, i), MessageRecord.getTableName(str, i), this.app.m4685b());
        } else {
            a2 = MessageDBUtils.a(MessageRecord.getOldTableName(str, i), MessageRecord.getTableName(str, i), this.app.m4685b(), "( isValid=1 and msgtype " + MsgProxyUtils.b() + " ) ORDER BY time asc , longMsgIndex asc", null);
        }
        if (a2 != null) {
            try {
                cursor = this.app.m4685b().m4769a(a2.toString(), (String[]) null);
            } finally {
            }
        }
        if (i == 1) {
            String a3 = ContactUtils.a(this.app, str, 1);
            stringBuffer.append(getString(R.string.f64066name_res_0x7f0a1621) + ":");
            stringBuffer.append(a3);
            stringBuffer.append("\r\n===========================================\r\n");
        }
        if (cursor != null && cursor.moveToFirst()) {
            while (true) {
                String str4 = str3;
                int i2 = cursor.getInt(cursor.getColumnIndex("time"));
                String string = cursor.getString(cursor.getColumnIndex("senderuin"));
                if (1 == i) {
                    str2 = String.format("%s(%s)", ContactUtils.f(this.app, this.f8680d, string), string);
                } else if (3000 == i) {
                    str2 = String.format("%s(%s)", ContactUtils.a(this.app, string, 0), string);
                } else {
                    str2 = this.f8682e;
                }
                int i3 = cursor.getInt(cursor.getColumnIndex("issend"));
                String b2 = MsgUtils.a(i3) ? b() : str2;
                if (cursor.getColumnIndex("versionCode") < 0 || cursor.getInt(cursor.getColumnIndex("versionCode")) <= 0) {
                    str3 = cursor.getString(cursor.getColumnIndex("msg"));
                } else {
                    int i4 = cursor.getInt(cursor.getColumnIndex("msgtype"));
                    if (i4 == -2007) {
                        str3 = getString(R.string.f65081name_res_0x7f0a1a1d);
                    } else if (i4 == -2039) {
                        byte[] blob = cursor.getBlob(cursor.getColumnIndex("msgData"));
                        MessageForApollo messageForApollo = new MessageForApollo();
                        messageForApollo.msgData = blob;
                        messageForApollo.parse();
                        str3 = ApolloUtil.a(messageForApollo);
                    } else if (i4 == -2011) {
                        str3 = a(StructMsgFactory.a(cursor.getBlob(cursor.getColumnIndex("msgData"))));
                    } else if (i4 == -2020) {
                        if (MsgUtils.a(i3)) {
                            str3 = this.app.getApp().getString(R.string.f63443name_res_0x7f0a13b2, new Object[]{this.f8647a.f12450d});
                        } else {
                            str3 = this.app.getApp().getString(R.string.f63442name_res_0x7f0a13b1);
                        }
                    } else if (i4 != -2006) {
                        if (i4 == -2000) {
                            str3 = MessageItem.f25913b;
                        } else if (i4 == -2002) {
                            str3 = MessageItem.f25911a;
                        } else if (i4 == -2022) {
                            str3 = ShortVideoConstants.f28453au;
                        } else {
                            if (i4 == -1035) {
                                StringBuilder sb = new StringBuilder();
                                try {
                                    byte[] blob2 = cursor.getBlob(cursor.getColumnIndex("msgData"));
                                    msg2 = new MixedMsg.Msg();
                                    try {
                                        msg2.mergeFrom(blob2);
                                    } catch (InvalidProtocolBufferMicroException e) {
                                        e.printStackTrace();
                                    }
                                } catch (Exception e2) {
                                    if (QLog.isColorLevel()) {
                                        QLog.i("ChatHistory", 2, "Parse mix message error");
                                    }
                                }
                                if (msg2.elems.get().size() > 0) {
                                    int size = msg2.elems.get().size();
                                    for (int i5 = 0; i5 < size; i5++) {
                                        MixedMsg.Elem elem = (MixedMsg.Elem) msg2.elems.get().get(i5);
                                        if (elem.textMsg.has()) {
                                            sb.append(elem.textMsg.get());
                                        } else if (elem.picMsg.has()) {
                                            sb.append(MessageItem.f25913b);
                                        }
                                    }
                                    str3 = sb.toString();
                                } else if (cursor != null) {
                                    cursor.close();
                                    return;
                                } else {
                                    return;
                                }
                            } else {
                                try {
                                    str3 = new String(cursor.getBlob(cursor.getColumnIndex("msgData")), "UTF-8");
                                } catch (Exception e3) {
                                    e3.printStackTrace();
                                    str3 = str4;
                                }
                            }
                            if (cursor != null) {
                                cursor.close();
                            }
                        }
                    } else {
                        str3 = str4;
                        if (cursor.moveToNext()) {
                            break;
                        }
                    }
                }
                String str5 = null;
                if (str3 != null) {
                    str5 = new QQText(str3, 3).m8403a();
                }
                if (str5 != null && str5.length() > 0 && m2416b(str5)) {
                    String[] split = str5.split("\u0016")[1].split("\\|");
                    int intValue = split.length < 2 ? 1 : Integer.valueOf(split[2]).intValue();
                    if (intValue == 1 || intValue == 65538) {
                        str5 = getString(R.string.f63914name_res_0x7f0a1589);
                    } else if (intValue == 2) {
                        str5 = StepFactory.f18876a + getString(R.string.f63757name_res_0x7f0a14ec) + StepFactory.f18879b;
                    }
                }
                stringBuffer.append((a(i2 * 1000) + TroopBarUtils.z + b2 + IOUtils.LINE_SEPARATOR_WINDOWS + str5) + HttpRsp.HTTP_HEADER_END);
                if (cursor.moveToNext()) {
                }
            }
        }
        runOnUiThread(new jog(this, FileUtils.a(AppConstants.bD, this.f8659a.toString(), stringBuffer.toString())));
    }

    private String a(long j) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("", Locale.SIMPLIFIED_CHINESE);
        simpleDateFormat.applyPattern("yyyy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(Long.valueOf(j));
    }

    private void p() {
        String str;
        PublicAccountInfo m4572b;
        String string = getResources().getString(R.string.f63610name_res_0x7f0a1459);
        if (this.f8630a == 0) {
            if (this.f8680d.equals(String.valueOf(AppConstants.aK))) {
                this.f8682e = getResources().getString(R.string.f64228name_res_0x7f0a16c3);
            } else {
                this.f8682e = ContactUtils.a(this.app, this.f8647a.f12447a, this.f8647a.f12448b, ContactUtils.a(this.f8647a.f85624a), 3);
            }
            if (this.f8680d.equals(String.valueOf(AppConstants.aK))) {
                str = getResources().getString(R.string.f64228name_res_0x7f0a16c3);
            }
            str = string;
        } else if (this.f8630a == 1) {
            this.f8682e = ((TroopManager) this.app.getManager(51)).m4842a(this.f8680d);
            str = string;
        } else if (this.f8630a == 1000 || this.f8630a == 1020 || this.f8630a == 1001 || this.f8630a == 1004) {
            this.f8682e = ContactUtils.j(this.app, this.f8680d);
            str = string;
        } else if (this.f8630a == 3000) {
            this.f8682e = ContactUtils.d(this.app, this.f8680d);
            str = string;
        } else {
            if (this.f8630a == 1024 && (m4572b = ((PublicAccountDataManager) this.app.getManager(55)).m4572b(this.f8680d)) != null) {
                this.f8682e = m4572b.name;
            }
            str = string;
        }
        if (this.f8682e == null || this.f8682e.trim().equals("")) {
            this.f8682e = this.f8680d;
        }
        setTitle(str);
        this.f8684f = b();
        this.f8647a.f12450d = this.f8682e;
        this.leftView = (TextView) findViewById(R.id.f47677ivTitleBtnLeft);
    }

    @Override
    public void doOnResume() {
        super.doOnResume();
        if (this.f8673b && !this.f8679c && this.f8661a != null) {
            this.f8679c = true;
            this.f8661a.postDelayed(new joh(this), 300L);
        }
    }

    @Override
    public void doOnPause() {
        if (QLog.isColorLevel()) {
            QLog.i("ChatHistory", 2, "onPause() mCurPlayingPttInfo = " + this.f8644a);
        }
        if (this.f8644a != null && !this.f8644a.f8694a) {
            this.f8644a.b();
        }
        super.doOnPause();
    }

    @Override
    public void doOnDestroy() {
        super.doOnDestroy();
        if (this.f8643a != null) {
            this.f8643a.a();
        }
        if (this.f8635a != null) {
            this.f8635a.unregisterListener(this);
        }
        if (this.f8651a != null && this.f8651a.m7243a()) {
            if (QLog.isColorLevel()) {
                QLog.d("ChatHistory", 2, "ChatHistory : close entityManager.");
            }
            this.f8651a.m7241a();
            this.f8651a = null;
        }
        q();
        j();
        if (QLog.isColorLevel()) {
            QLog.i("ChatHistory", 2, "onDestroy() mCurPlayingPttInfo = " + this.f8644a);
        }
        if (this.f8644a != null && !this.f8644a.f8694a) {
            this.f8644a.b();
            this.f8633a.stop();
            this.f8633a = null;
            this.f8667b.stop();
            this.f8667b = null;
            this.f8676c.stop();
            this.f8676c = null;
        }
        this.app.removeHandler(getClass());
        removeObserver(this.f8649a);
        if (this.app.m4638a() != null) {
            this.app.m4638a().b(this.f8650a);
        }
        this.app.m4638a().e();
        try {
            this.f8653a.a().a();
        } catch (Exception e) {
        }
    }

    public class ChatHistoryAdapter extends CursorAdapter {
        public static final int f84969b = 3;
        public static final int f84970c = 2;
        public static final int d = 1;
        public static final int e = 0;
        public static final int f = 2;
        public static final int g = 1;
        public static final int h = 0;
        public int f84971a;
        public Context f8687a;
        private LayoutInflater f8688a;
        private int i;
        private int j;

        public ChatHistoryAdapter(Context context, Cursor cursor) {
            super(context, cursor);
            this.i = 1000;
            this.f84971a = -1;
            this.f8688a = (LayoutInflater) context.getSystemService("layout_inflater");
            this.f8687a = context;
            if (ChatHistory.this.f8629a < 1.0f) {
                ChatHistory.this.f8685g = (int) (100.0f * ChatHistory.this.f8629a);
                ChatHistory.this.f = (int) (ChatHistory.this.f8629a * 34.0f);
                ChatHistory.this.f8686h = (int) (ChatHistory.this.f8629a * 14.0f);
                ChatHistory.this.i = (int) (ChatHistory.this.f8629a * 15.0f);
            } else {
                ChatHistory.this.f8685g = (int) (120.0f * ChatHistory.this.f8629a);
                ChatHistory.this.f = (int) (ChatHistory.this.f8629a * 34.0f);
                ChatHistory.this.f8686h = (int) (ChatHistory.this.f8629a * 14.0f);
                ChatHistory.this.i = (int) (ChatHistory.this.f8629a * 15.0f);
            }
            DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
            this.j = Math.min(displayMetrics.widthPixels, displayMetrics.heightPixels);
        }

        @Override
        public void bindView(View view, Context context, Cursor cursor) {
            jph jphVar;
            String string;
            TroopBusinessUtil.TroopBusinessMessage a2;
            TroopManager troopManager;
            TroopInfo m4837a;
            int i;
            int i2;
            boolean z;
            int i3;
            String localFilePath;
            Drawable drawable;
            String extInfoFromExtStr;
            TroopMemberInfo b2;
            Exception exc;
            String str;
            StringBuilder sb;
            jph jphVar2 = (jph) view.getTag();
            if (jphVar2 == null) {
                jph jphVar3 = new jph(ChatHistory.this, null);
                view.setTag(jphVar3);
                jphVar = jphVar3;
            } else {
                jphVar = jphVar2;
            }
            jphVar.f73102a = (MessageRecord) ChatHistory.this.a().a(MessageRecord.class, MessageRecord.getTableName(ChatHistory.this.f8680d, ChatHistory.this.f8630a), cursor);
            if (jphVar.f73102a == null) {
                if (QLog.isColorLevel()) {
                    QLog.w("ChatHistory", 2, "bindView message is null !!");
                    return;
                }
                return;
            }
            if (!ChatHistory.this.f8662a) {
                ChatHistory.this.app.m4635a().m5062a(jphVar.f73102a.frienduin, jphVar.f73102a.istroop, jphVar.f73102a);
            }
            long j = cursor.getLong(0);
            jphVar.f73102a.setId(j);
            LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.f48540name_res_0x7f0905b8);
            TextView textView = (TextView) view.findViewById(R.id.f48541name_res_0x7f0905b9);
            TextView textView2 = (TextView) view.findViewById(R.id.f48542name_res_0x7f0905ba);
            TextView textView3 = (TextView) view.findViewById(R.id.f48543name_res_0x7f0905bb);
            PatchedTextView patchedTextView = (PatchedTextView) view.findViewById(R.id.f48545name_res_0x7f0905bd);
            ImageView imageView = (ImageView) view.findViewById(R.id.f48546name_res_0x7f0905be);
            MixedMsgLinearLayout mixedMsgLinearLayout = (MixedMsgLinearLayout) view.findViewById(R.id.f48551name_res_0x7f0905c3);
            TextView textView4 = (TextView) view.findViewById(R.id.f48544name_res_0x7f0905bc);
            linearLayout.setVisibility(0);
            patchedTextView.setVisibility(0);
            textView4.setVisibility(8);
            ChatThumbView chatThumbView = (ChatThumbView) view.findViewById(R.id.f48547name_res_0x7f0905bf);
            chatThumbView.f12850a = false;
            ImageView imageView2 = (ImageView) view.findViewById(R.id.f48549name_res_0x7f0905c1);
            Button button = (Button) view.findViewById(R.id.f48550name_res_0x7f0905c2);
            ImageView imageView3 = (ImageView) view.findViewById(R.id.f48548name_res_0x7f0905c0);
            imageView3.setVisibility(8);
            textView.setVisibility(8);
            patchedTextView.setMovementMethod(LinkMovementMethod.getInstance());
            String string2 = cursor.getString(cursor.getColumnIndex("frienduin"));
            String string3 = cursor.getString(cursor.getColumnIndex("senderuin"));
            int i4 = cursor.getInt(cursor.getColumnIndex("istroop"));
            int i5 = cursor.getInt(cursor.getColumnIndex("issend"));
            int i6 = cursor.getInt(cursor.getColumnIndex("time"));
            if (cursor.getColumnIndex("versionCode") < 0 || cursor.getInt(cursor.getColumnIndex("versionCode")) <= 0) {
                string = cursor.getString(cursor.getColumnIndex("msg"));
            } else if ((jphVar.f73102a instanceof MessageForFoldMsg) || (jphVar.f73102a instanceof MessageForUniteGrayTip)) {
                string = jphVar.f73102a.f88923msg;
            } else {
                try {
                    str = new String(cursor.getBlob(cursor.getColumnIndex("msgData")), "UTF-8");
                } catch (Exception e2) {
                    string = "";
                    exc = e2;
                }
                try {
                    StringBuilder sb2 = new StringBuilder(str);
                    if ((jphVar.f73102a instanceof MessageForText) && (jphVar.f73102a.istroop == 3000 || jphVar.f73102a.istroop == 1)) {
                        String extInfoFromExtStr2 = jphVar.f73102a.getExtInfoFromExtStr("disc_at_info_list");
                        if (!TextUtils.isEmpty(extInfoFromExtStr2)) {
                            try {
                                AppRuntime m1871a = BaseApplicationImpl.f6970a.m1871a();
                                if (QQAppInterface.class.isInstance(m1871a)) {
                                    sb = AtTroopMemberSpan.a((QQAppInterface) m1871a, sb2, extInfoFromExtStr2, string2, jphVar.f73102a.istroop);
                                } else {
                                    if (QLog.isColorLevel()) {
                                        QLog.d("ChatHistory", 2, "We get error AppRuntime");
                                    }
                                    sb = sb2;
                                }
                                sb2 = sb;
                            } catch (Exception e3) {
                                QLog.e("ChatHistory", 1, "replaceAtMsgByMarkName", e3);
                            }
                        }
                    }
                    string = sb2.toString();
                } catch (Exception e4) {
                    exc = e4;
                    string = str;
                    QLog.e("ChatHistory", 1, "cursor Error", exc);
                    String str2 = ChatHistory.this.a(i4, cursor.getInt(cursor.getColumnIndex("msgtype")), string, i5).f80051msg;
                    a2 = TroopBusinessUtil.a(jphVar.f73102a);
                    troopManager = (TroopManager) ChatHistory.this.app.getManager(51);
                    m4837a = troopManager.m4837a(ChatHistory.this.f8680d);
                    if (m4837a != null) {
                        extInfoFromExtStr = jphVar.f73102a.getExtInfoFromExtStr(EditUniqueTitleActivity.f);
                        b2 = troopManager.b(string2, string3);
                        String a3 = troopManager.a(m4837a, b2, context);
                        int i7 = 0;
                        if (b2 != null) {
                        }
                        if (m4837a.troopowneruin == null) {
                        }
                        if (m4837a.Administrator == null) {
                        }
                        if (TextUtils.isEmpty(extInfoFromExtStr)) {
                        }
                    }
                    if (a2 == null) {
                    }
                    if (a2 == null) {
                    }
                    textView2.setTextColor(ChatHistory.this.getResources().getColor(R.color.f39340skin_blue));
                    textView3.setText(a(i6 * 1000));
                    i = cursor.getInt(cursor.getColumnIndex("extraflag"));
                    if (i != 32768) {
                    }
                    chatThumbView.setVisibility(8);
                    patchedTextView.setVisibility(8);
                    imageView.setVisibility(8);
                    imageView2.setVisibility(8);
                    button.setVisibility(8);
                    mixedMsgLinearLayout.setVisibility(8);
                    patchedTextView.setOnTouchListener(null);
                    patchedTextView.setOnLongClickListener(null);
                    patchedTextView.setOnClickListener(null);
                    button.setOnClickListener(null);
                    i2 = cursor.getInt(getCursor().getColumnIndex("msgtype"));
                    if (i2 != -2007) {
                    }
                }
            }
            String str22 = ChatHistory.this.a(i4, cursor.getInt(cursor.getColumnIndex("msgtype")), string, i5).f80051msg;
            a2 = TroopBusinessUtil.a(jphVar.f73102a);
            troopManager = (TroopManager) ChatHistory.this.app.getManager(51);
            m4837a = troopManager.m4837a(ChatHistory.this.f8680d);
            if (m4837a != null && m4837a.cGroupRankSysFlag == 1 && m4837a.cGroupRankUserFlag == 1 && a2 == null) {
                extInfoFromExtStr = jphVar.f73102a.getExtInfoFromExtStr(EditUniqueTitleActivity.f);
                b2 = troopManager.b(string2, string3);
                String a32 = troopManager.a(m4837a, b2, context);
                int i72 = 0;
                if (b2 != null) {
                    i72 = b2.level;
                }
                if (m4837a.troopowneruin == null && m4837a.troopowneruin.equals(string3)) {
                    textView.setVisibility(0);
                    textView.setText(R.string.f63284name_res_0x7f0a1313);
                    TroopRankColorConfig.a(textView, 0, 0);
                } else if (m4837a.Administrator == null && m4837a.Administrator.contains(string3)) {
                    textView.setVisibility(0);
                    textView.setText(R.string.f63283name_res_0x7f0a1312);
                    TroopRankColorConfig.a(textView, 1, 0);
                } else if (TextUtils.isEmpty(extInfoFromExtStr)) {
                    textView.setVisibility(0);
                    textView.setText(extInfoFromExtStr);
                    TroopRankColorConfig.a(textView, 2, 0);
                } else if (a32 != null && a32.length() > 0) {
                    textView.setVisibility(0);
                    textView.setText(a32);
                    TroopRankColorConfig.a(textView, 3, i72);
                }
            }
            if (a2 == null) {
                textView2.setText(a2.f32515c);
                textView.setVisibility(0);
                textView.setText(a2.f32516d);
                textView.setBackgroundDrawable(TroopUtils.a(ChatHistory.this.getResources(), a2.d));
            } else if (AnonymousChatHelper.m894a(jphVar.f73102a)) {
                textView2.setText(ChatHistory.this.getResources().getString(R.string.f60929name_res_0x7f0a09de) + AnonymousChatHelper.a(jphVar.f73102a).f3453b);
                textView.setVisibility(8);
            } else if (TroopBindPublicAccountMgr.a(jphVar.f73102a)) {
                textView2.setText(PublicAccountConfigUtil.a(ChatHistory.this.app, (Context) BaseApplicationImpl.getContext()));
            } else {
                textView2.setText(ContactUtils.a(ChatHistory.this.app, ChatHistory.this.f8647a, MsgUtils.a(i5), string3));
            }
            if (a2 == null && ThemeUtil.isNowThemeIsDefault(ChatHistory.this.app, false, null)) {
                textView2.setTextColor(a2.f94058b);
            } else {
                textView2.setTextColor(ChatHistory.this.getResources().getColor(R.color.f39340skin_blue));
            }
            textView3.setText(a(i6 * 1000));
            i = cursor.getInt(cursor.getColumnIndex("extraflag"));
            if (i != 32768) {
                patchedTextView.setMaxWidth((int) (context.getResources().getDisplayMetrics().widthPixels - (70.0f * ChatHistory.this.f8629a)));
            }
            chatThumbView.setVisibility(8);
            patchedTextView.setVisibility(8);
            imageView.setVisibility(8);
            imageView2.setVisibility(8);
            button.setVisibility(8);
            mixedMsgLinearLayout.setVisibility(8);
            patchedTextView.setOnTouchListener(null);
            patchedTextView.setOnLongClickListener(null);
            patchedTextView.setOnClickListener(null);
            button.setOnClickListener(null);
            i2 = cursor.getInt(getCursor().getColumnIndex("msgtype"));
            if (i2 != -2007) {
                chatThumbView.setVisibility(0);
                patchedTextView.setVisibility(8);
                imageView.setVisibility(8);
                imageView2.setVisibility(8);
                button.setVisibility(8);
                chatThumbView.setOnTouchListener(ChatHistory.this.f8660a);
                chatThumbView.setOnLongClickListener(ChatHistory.this.f8660a);
                byte[] blob = cursor.getBlob(cursor.getColumnIndex("msgData"));
                chatThumbView.setTag(string2 + j);
                imageView3.setTag(null);
                try {
                    a(chatThumbView, (MarkFaceMessage) MessagePkgUtils.a(blob), imageView3);
                } catch (Exception e5) {
                    e5.printStackTrace();
                    a(chatThumbView, (MarkFaceMessage) null, imageView3);
                }
            } else if (i2 == -2039) {
                byte[] blob2 = cursor.getBlob(cursor.getColumnIndex("msgData"));
                MessageForApollo messageForApollo = new MessageForApollo();
                messageForApollo.msgData = blob2;
                messageForApollo.parse();
                patchedTextView.setVisibility(0);
                if (!TextUtils.isEmpty(messageForApollo.f88923msg)) {
                    patchedTextView.setText(messageForApollo.f88923msg);
                } else {
                    patchedTextView.setText("[动作消息]");
                }
            } else {
                if (i2 == -2010) {
                    chatThumbView.setVisibility(8);
                    patchedTextView.setVisibility(0);
                    imageView.setVisibility(8);
                    imageView2.setVisibility(8);
                    button.setVisibility(8);
                    patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                    patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                } else if (i2 == -2011) {
                    String a4 = ChatHistory.this.a(StructMsgFactory.a(cursor.getBlob(cursor.getColumnIndex("msgData"))));
                    if (!TextUtils.isEmpty(a4)) {
                        if (TroopBindPublicAccountMgr.a(jphVar.f73102a)) {
                            a4 = String.format(ChatHistory.this.app.getApp().getString(R.string.f61515name_res_0x7f0a0c28), PublicAccountConfigUtil.a(ChatHistory.this.app, (Context) BaseApplicationImpl.getContext())) + a4;
                        }
                        patchedTextView.setText(a4);
                        patchedTextView.setVisibility(0);
                        patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                        patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                        return;
                    }
                    return;
                } else if (i2 == -3006) {
                    String msgSummary = MessageForPubAccount.getMsgSummary(ChatHistory.this.app, jphVar.f73102a, true);
                    if (!TextUtils.isEmpty(msgSummary)) {
                        patchedTextView.setText(msgSummary);
                        patchedTextView.setVisibility(0);
                        patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                        patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                        return;
                    }
                    return;
                } else if (i2 == -5008) {
                    byte[] blob3 = cursor.getBlob(cursor.getColumnIndex("msgData"));
                    ArkAppMessage arkAppMessage = new ArkAppMessage();
                    arkAppMessage.fromBytes(blob3);
                    String str3 = arkAppMessage.promptText;
                    if (!TextUtils.isEmpty(str3)) {
                        patchedTextView.setText(str3);
                        patchedTextView.setVisibility(0);
                        patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                        patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                        return;
                    }
                    return;
                } else if (i2 == -2000 || i2 == -20000 || i2 == -3000 || i2 == -3001) {
                    if (jphVar.f73102a != null && (jphVar.f73102a instanceof MessageForPic)) {
                        if (FlashPicHelper.m4279a(jphVar.f73102a)) {
                            patchedTextView.setVisibility(0);
                            patchedTextView.setText(ChatHistory.this.getString(R.string.f64647name_res_0x7f0a1866));
                            patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                            patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                            return;
                        }
                        MessageForPic messageForPic = (MessageForPic) jphVar.f73102a;
                        messageForPic.parse();
                        ImageViewParameter imageViewParameter = new ImageViewParameter();
                        chatThumbView.setOnTouchListener(ChatHistory.this.f8660a);
                        chatThumbView.setOnLongClickListener(ChatHistory.this.f8660a);
                        imageViewParameter.f9892a = messageForPic;
                        imageViewParameter.f85112a = chatThumbView;
                        if (QLog.isColorLevel()) {
                            QLog.d("history", 2, "bindView pic.path:" + messageForPic.path + ",pic.uuid:" + messageForPic.uuid);
                        }
                        if (imageViewParameter.f9892a != null && imageViewParameter.f9892a.path != null) {
                            a(imageViewParameter);
                            return;
                        }
                        return;
                    } else if (QLog.isColorLevel()) {
                        QLog.d("history", 2, "holy shit,not messageforpicuniseq:" + jphVar.f73102a.uniseq + ",dbid:" + jphVar.f73102a.getId() + "istroop:" + jphVar.f73102a.istroop + ",msgtype:" + jphVar.f73102a.msgtype);
                        return;
                    } else {
                        return;
                    }
                } else if (i2 == -2002) {
                    byte[] blob4 = cursor.getBlob(cursor.getColumnIndex("msgData"));
                    RichMsg.PttRec pttRec = new RichMsg.PttRec();
                    try {
                        pttRec.mergeFrom(blob4);
                        z = true;
                    } catch (Exception e6) {
                        z = false;
                        e6.printStackTrace();
                    }
                    if (z) {
                        int i8 = pttRec.voiceLength.get();
                        if (jphVar != null && jphVar.f73102a != null && (jphVar.f73102a instanceof MessageForPtt)) {
                            jphVar.f73103a = ((MessageForPtt) jphVar.f73102a).voiceChangeFlag == 1;
                            if (i8 <= 0) {
                                i3 = QQRecorder.a(jphVar.f73102a);
                                boolean z2 = jphVar.f73103a;
                                localFilePath = MessageForPtt.getLocalFilePath(!pttRec.voiceType.has() ? pttRec.voiceType.get() : 0, pttRec.localPath.get());
                                long j2 = pttRec.size.get();
                                int i9 = ChatHistory.this.f8686h;
                                int i10 = ChatHistory.this.i;
                                button.setTag(localFilePath + string2 + j);
                                button.setVisibility(0);
                                button.setText("");
                                button.setText((CharSequence) null);
                                button.setCompoundDrawables(null, null, null, null);
                                button.setPadding(i9, 0, i10, 0);
                                button.setOnTouchListener(ChatHistory.this.f8660a);
                                button.setOnLongClickListener(ChatHistory.this.f8660a);
                                if (i3 <= 0) {
                                    i3 = QQRecorder.a(localFilePath);
                                }
                                if (localFilePath.startsWith(AppConstants.bC) || i3 <= 0) {
                                    button.setCompoundDrawables(null, null, null, null);
                                    button.setText(StepFactory.f18876a + ChatHistory.this.getString(R.string.f64067name_res_0x7f0a1622) + StepFactory.f18879b);
                                    button.setOnClickListener(null);
                                    return;
                                }
                                button.setText(String.valueOf(i3) + "\"");
                                button.setPadding(i9, 0, a(i3), 0);
                                if (ChatHistory.this.f8644a != null && ChatHistory.this.f8644a.a(0, button.getTag())) {
                                    ChatHistory.this.f8644a.a(view, localFilePath);
                                } else {
                                    if (z2) {
                                        drawable = this.f8687a.getResources().getDrawable(R.drawable.f46461name_res_0x7f02150d);
                                    } else {
                                        drawable = this.f8687a.getResources().getDrawable(R.drawable.f46460skin_aio_ptt_action_l_3);
                                    }
                                    drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
                                    button.setCompoundDrawables(drawable, null, null, null);
                                    if (j2 <= 0) {
                                        button.setText(StepFactory.f18876a + ChatHistory.this.getString(R.string.f64068name_res_0x7f0a1623) + StepFactory.f18879b);
                                    }
                                }
                                button.setOnClickListener(new jox(this, i3, localFilePath));
                                return;
                            }
                        }
                        i3 = i8;
                        boolean z22 = jphVar.f73103a;
                        localFilePath = MessageForPtt.getLocalFilePath(!pttRec.voiceType.has() ? pttRec.voiceType.get() : 0, pttRec.localPath.get());
                        long j22 = pttRec.size.get();
                        int i92 = ChatHistory.this.f8686h;
                        int i102 = ChatHistory.this.i;
                        button.setTag(localFilePath + string2 + j);
                        button.setVisibility(0);
                        button.setText("");
                        button.setText((CharSequence) null);
                        button.setCompoundDrawables(null, null, null, null);
                        button.setPadding(i92, 0, i102, 0);
                        button.setOnTouchListener(ChatHistory.this.f8660a);
                        button.setOnLongClickListener(ChatHistory.this.f8660a);
                        if (i3 <= 0) {
                        }
                        if (localFilePath.startsWith(AppConstants.bC)) {
                        }
                        button.setCompoundDrawables(null, null, null, null);
                        button.setText(StepFactory.f18876a + ChatHistory.this.getString(R.string.f64067name_res_0x7f0a1622) + StepFactory.f18879b);
                        button.setOnClickListener(null);
                        return;
                    }
                } else if (i2 == -1035) {
                    mixedMsgLinearLayout.setVisibility(0);
                    a(mixedMsgLinearLayout, (MessageForMixedMsg) jphVar.f73102a);
                    return;
                } else if (i2 == -2017) {
                    patchedTextView.setVisibility(0);
                    patchedTextView.setText(MsgUtils.a((String) null));
                    return;
                } else if (i2 == -2020) {
                    patchedTextView.setVisibility(0);
                    patchedTextView.setOnClickListener(new joz(this, string2));
                    patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                    patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                    if (!MsgUtils.a(i5)) {
                        patchedTextView.setText(ChatHistory.this.app.getApp().getString(R.string.f63442name_res_0x7f0a13b1));
                        return;
                    } else {
                        patchedTextView.setText(ChatHistory.this.app.getApp().getString(R.string.f63443name_res_0x7f0a13b2, new Object[]{ChatHistory.this.f8647a.f12450d}));
                        return;
                    }
                } else if (i2 == -3008) {
                    patchedTextView.setText(BaseApplicationImpl.getContext().getString(R.string.f59350name_res_0x7f0a03b0) + "\"" + str22 + "\"");
                    patchedTextView.setVisibility(0);
                    patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                    patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                    return;
                } else if (i2 == -2022) {
                    patchedTextView.setVisibility(0);
                    patchedTextView.setText(ChatHistory.this.getString(R.string.f65879name_res_0x7f0a1d3b));
                    patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                    patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                    return;
                } else if (i2 == -5002) {
                    if (jphVar.f73102a != null && (jphVar.f73102a instanceof MessageForIncompatibleGrayTips)) {
                        MessageForIncompatibleGrayTips messageForIncompatibleGrayTips = (MessageForIncompatibleGrayTips) jphVar.f73102a;
                        messageForIncompatibleGrayTips.parse();
                        patchedTextView.setText(messageForIncompatibleGrayTips.f88923msg);
                        patchedTextView.setVisibility(0);
                        String str4 = messageForIncompatibleGrayTips.url;
                        SpannableString spannableString = new SpannableString(messageForIncompatibleGrayTips.f88923msg);
                        jpa jpaVar = new jpa(this, str4, string2);
                        spannableString.setSpan(new ForegroundColorSpan(ChatHistory.this.getResources().getColor(R.color.f38788name_res_0x7f0b0183)), messageForIncompatibleGrayTips.linkStart, messageForIncompatibleGrayTips.linkEnd, 33);
                        spannableString.setSpan(jpaVar, messageForIncompatibleGrayTips.linkStart, messageForIncompatibleGrayTips.linkEnd, 33);
                        patchedTextView.setText(spannableString);
                        patchedTextView.setMovementMethod(LinkMovementMethod.getInstance());
                        patchedTextView.setHighlightColor(0);
                        patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                        patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                        return;
                    } else if (QLog.isColorLevel()) {
                        QLog.d("history", 2, "holy shit,not MessageForIncompatibleGrayTipsuniseq:" + jphVar.f73102a.uniseq + ",dbid:" + jphVar.f73102a.getId() + "istroop:" + jphVar.f73102a.istroop + ",msgtype:" + jphVar.f73102a.msgtype);
                        return;
                    } else {
                        return;
                    }
                } else if (i2 == -2025) {
                    MessageForQQWalletMsg messageForQQWalletMsg = new MessageForQQWalletMsg();
                    messageForQQWalletMsg.msgData = cursor.getBlob(cursor.getColumnIndex("msgData"));
                    messageForQQWalletMsg.parse();
                    patchedTextView.setVisibility(0);
                    patchedTextView.setText(messageForQQWalletMsg.getMsgSummary());
                    patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                    patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                    return;
                } else if (i2 == -2036) {
                    MessageForTroopFee messageForTroopFee = new MessageForTroopFee();
                    messageForTroopFee.msgData = cursor.getBlob(cursor.getColumnIndex("msgData"));
                    messageForTroopFee.parse();
                    patchedTextView.setVisibility(0);
                    patchedTextView.setText(messageForTroopFee.getSummaryMsg());
                    patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                    patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                    return;
                } else if (i2 == -2035) {
                    if (QLog.isColorLevel()) {
                        QLog.d(LogTag.bf, 2, "ChatHistory decode MessageForDeliverGiftTips. seq:" + jphVar.f73102a.shmsgseq + "msgtype:" + jphVar.f73102a.msgtype + "msg:" + jphVar.f73102a.f88923msg);
                    }
                    linearLayout.setVisibility(8);
                    patchedTextView.setVisibility(8);
                    textView4.setVisibility(0);
                    textView4.setClickable(true);
                    textView4.setFocusable(true);
                    textView4.setMovementMethod(LinkMovementMethod.getInstance());
                    textView4.setVisibility(0);
                    textView4.setText(((MessageForDeliverGiftTips) jphVar.f73102a).getHightlightMsgText(ChatHistory.this.app, this.f8687a));
                    return;
                } else if (i2 == -2038) {
                    MessageForTroopGift messageForTroopGift = new MessageForTroopGift();
                    messageForTroopGift.msgData = cursor.getBlob(cursor.getColumnIndex("msgData"));
                    messageForTroopGift.parse();
                    patchedTextView.setVisibility(0);
                    patchedTextView.setText(messageForTroopGift.summary);
                    patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                    patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                    return;
                } else if (i2 == -2048) {
                    MessageForTroopReward messageForTroopReward = new MessageForTroopReward();
                    messageForTroopReward.msgData = cursor.getBlob(cursor.getColumnIndex("msgData"));
                    messageForTroopReward.parse();
                    patchedTextView.setVisibility(0);
                    patchedTextView.setText(messageForTroopReward.getSummaryMsg());
                    patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                    patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                    return;
                } else if (i2 == -2044) {
                    MessageForTroopTopic messageForTroopTopic = (MessageForTroopTopic) jphVar.f73102a;
                    messageForTroopTopic.msgData = cursor.getBlob(cursor.getColumnIndex("msgData"));
                    messageForTroopTopic.parse();
                    patchedTextView.setVisibility(0);
                    patchedTextView.setText(messageForTroopTopic.f88923msg);
                    patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                    patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                    return;
                } else if (i2 == -5010) {
                    MessageForDingdongSchedule messageForDingdongSchedule = (MessageForDingdongSchedule) jphVar.f73102a;
                    messageForDingdongSchedule.msgData = cursor.getBlob(cursor.getColumnIndex("msgData"));
                    messageForDingdongSchedule.parse();
                    patchedTextView.setVisibility(0);
                    patchedTextView.setText(messageForDingdongSchedule.f88923msg);
                    patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                    patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                    return;
                } else if (i2 == -8002) {
                    MessageForToDo messageForToDo = (MessageForToDo) jphVar.f73102a;
                    messageForToDo.msgData = cursor.getBlob(cursor.getColumnIndex("msgData"));
                    messageForToDo.parse();
                    patchedTextView.setVisibility(0);
                    patchedTextView.setText("[待办]" + messageForToDo.f88923msg);
                    patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                    patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                    return;
                }
                if (str22 != null && str22.length() > 0 && ChatHistory.this.m2416b(str22.toString())) {
                    String[] split = str22.split("\u0016")[1].split("\\|");
                    String str5 = split[0];
                    int intValue = split.length < 2 ? 1 : Integer.valueOf(split[2]).intValue();
                    if (split.length >= 5) {
                        String str6 = split[4];
                    }
                    if (split.length >= 6) {
                        TransfileUtile.m8624a(str22.toString());
                    }
                    long j3 = 0;
                    if (split != null && split.length > 1) {
                        j3 = Long.parseLong(split[1] == null ? "0" : split[1]);
                    }
                    Uri.parse(str5);
                    switch (intValue) {
                        case 0:
                            patchedTextView.setText(ChatHistory.this.getString(R.string.f64272name_res_0x7f0a16ef));
                            patchedTextView.setVisibility(0);
                            patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                            patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                            return;
                        case 1:
                            chatThumbView.setOnTouchListener(ChatHistory.this.f8660a);
                            chatThumbView.setOnLongClickListener(ChatHistory.this.f8660a);
                            return;
                        case 2:
                            int i11 = ChatHistory.this.f8686h;
                            int i12 = ChatHistory.this.i;
                            button.setTag(str5 + string2 + j);
                            button.setVisibility(0);
                            button.setText("");
                            button.setText((CharSequence) null);
                            button.setCompoundDrawables(null, null, null, null);
                            button.setPadding(i11, 0, i12, 0);
                            button.setOnTouchListener(ChatHistory.this.f8660a);
                            button.setOnLongClickListener(ChatHistory.this.f8660a);
                            int i13 = 0;
                            if (jphVar != null && jphVar.f73102a != null && (jphVar.f73102a instanceof MessageForPtt)) {
                                i13 = QQRecorder.a(jphVar.f73102a);
                            }
                            if (i13 <= 0) {
                                i13 = QQRecorder.a(str5);
                            }
                            if (!str5.startsWith(AppConstants.bC) || i13 <= 0) {
                                button.setCompoundDrawables(null, null, null, null);
                                button.setText(StepFactory.f18876a + ChatHistory.this.getString(R.string.f64067name_res_0x7f0a1622) + StepFactory.f18879b);
                                button.setOnClickListener(null);
                                return;
                            }
                            button.setText(String.valueOf(i13) + "\"");
                            button.setPadding(i11, 0, a(i13), 0);
                            if (ChatHistory.this.f8644a != null && ChatHistory.this.f8644a.a(0, button.getTag())) {
                                ChatHistory.this.f8644a.a(view, str5);
                            } else {
                                Drawable drawable2 = this.f8687a.getResources().getDrawable(R.drawable.f46460skin_aio_ptt_action_l_3);
                                drawable2.setBounds(0, 0, drawable2.getMinimumWidth(), drawable2.getMinimumHeight());
                                button.setCompoundDrawables(drawable2, null, null, null);
                                if (j3 <= 0) {
                                    button.setText(StepFactory.f18876a + ChatHistory.this.getString(R.string.f64068name_res_0x7f0a1623) + StepFactory.f18879b);
                                }
                            }
                            button.setOnClickListener(new jpb(this, i13, str5));
                            return;
                        case 65538:
                            chatThumbView.setVisibility(0);
                            chatThumbView.setOnClickListener(null);
                            chatThumbView.setOnTouchListener(ChatHistory.this.f8660a);
                            chatThumbView.setOnLongClickListener(ChatHistory.this.f8660a);
                            chatThumbView.setImageResource(R.drawable.f41662name_res_0x7f020249);
                            return;
                        default:
                            return;
                    }
                }
                int i14 = cursor.getInt(cursor.getColumnIndex("msgtype"));
                patchedTextView.setVisibility(0);
                if (!MessageUtils.m7812a(i2)) {
                    patchedTextView.setOnTouchListener(ChatHistory.this.f8660a);
                    patchedTextView.setOnLongClickListener(ChatHistory.this.f8660a);
                }
                if (String.valueOf(AppConstants.aK).equals(string2)) {
                    SystemMsg decode = SystemMsg.decode(ChatHistory.this.app, str22, string3, i14);
                    if (decode != null) {
                        patchedTextView.setText(decode.message);
                        if (i == 32769) {
                            textView2.setText(decode.troopCode);
                        }
                    }
                } else if (-2008 == i14) {
                    patchedTextView.setText(ChatHistory.this.getString(R.string.f65017name_res_0x7f0a19dd));
                } else if (-1002 == i14) {
                    patchedTextView.setText(jphVar.f73102a.getExtInfoFromExtStr(MQPSensitiveMsgUtil.f36268d));
                } else {
                    int i15 = cursor.getInt(cursor.getColumnIndex("extraflag"));
                    if (imageView != null && i15 == 32768) {
                        imageView.setVisibility(0);
                    }
                    if (jphVar.f73102a instanceof MessageForUnknownMsg) {
                        if (QLog.isColorLevel()) {
                            QLog.d("ChatHistory", 2, "MessageForUnknownMsg wMsgType:" + i14);
                        }
                        MessageForUnknownMsg messageForUnknownMsg = (MessageForUnknownMsg) jphVar.f73102a;
                        messageForUnknownMsg.parse();
                        patchedTextView.setText(messageForUnknownMsg.sb);
                        return;
                    }
                    patchedTextView.setText(new QQText(str22, 13, 32, ChatHistory.this.f8630a));
                }
            }
        }

        public void a(MixedMsgLinearLayout mixedMsgLinearLayout, MessageForMixedMsg messageForMixedMsg) {
            messageForMixedMsg.parse();
            int size = messageForMixedMsg.msgElemList.size();
            for (int i = 0; i < size; i++) {
                MessageRecord messageRecord = (MessageRecord) messageForMixedMsg.msgElemList.get(i);
                if ((messageRecord instanceof MessageForPic) && ((MessageForPic) messageRecord).time == 0) {
                    MessageForMixedMsg.copyBaseInfoFromMixedToPic((MessageForPic) messageRecord, messageForMixedMsg);
                }
            }
            mixedMsgLinearLayout.a(messageForMixedMsg.msgElemList);
            MixedImageOnclickListener mixedImageOnclickListener = new MixedImageOnclickListener();
            mixedImageOnclickListener.f12367a = ChatHistory.this.f8647a;
            int size2 = messageForMixedMsg.msgElemList.size();
            for (int i2 = 0; i2 < size2; i2++) {
                MessageRecord messageRecord2 = (MessageRecord) messageForMixedMsg.msgElemList.get(i2);
                View childAt = mixedMsgLinearLayout.getChildAt(i2);
                if (messageRecord2 instanceof MessageForText) {
                    AnimationTextView animationTextView = (AnimationTextView) childAt;
                    animationTextView.setTextColor(ChatHistory.this.getResources().getColor(R.color.f39369name_res_0x7f0b03c8));
                    animationTextView.setTextSize(0, AIOUtils.a(16.0f, mixedMsgLinearLayout.getContext().getResources()));
                    if (TextUtils.isEmpty(((MessageForText) messageRecord2).sb2)) {
                        animationTextView.setText(((MessageForText) messageRecord2).sb);
                    } else {
                        animationTextView.setText(((MessageForText) messageRecord2).sb2);
                    }
                } else if (messageRecord2 instanceof MessageForPic) {
                    MessageForPic messageForPic = (MessageForPic) messageRecord2;
                    ChatThumbView chatThumbView = (ChatThumbView) childAt;
                    URLDrawable a2 = PicItemBuilder.a(this.f8687a, messageForPic, chatThumbView);
                    chatThumbView.setTag(R.id.f47183name_res_0x7f090062, messageForPic);
                    chatThumbView.setImageDrawable(a2);
                    chatThumbView.setOnClickListener(mixedImageOnclickListener);
                } else if (QLog.isColorLevel()) {
                    QLog.e("ChatHistory", 2, "mixed type not support yet." + messageRecord2.getClass().getSimpleName());
                }
                childAt.setOnTouchListener(ChatHistory.this.f8660a);
                childAt.setOnLongClickListener(ChatHistory.this.f8660a);
            }
            mixedMsgLinearLayout.setOnTouchListener(ChatHistory.this.f8660a);
            mixedMsgLinearLayout.setOnLongClickListener(ChatHistory.this.f8660a);
        }

        public void a(ImageView imageView, int i, PicEmoticonInfo picEmoticonInfo) {
            if (picEmoticonInfo == null) {
                imageView.setImageResource(R.drawable.f41146name_res_0x7f020044);
            } else if (i == 2) {
                if (!picEmoticonInfo.m6024a()) {
                    URLDrawable b2 = picEmoticonInfo.b(this.f8687a, ChatHistory.this.f8629a);
                    if (b2 != null) {
                        imageView.setImageDrawable(b2);
                        imageView.setOnClickListener(null);
                    }
                } else if (picEmoticonInfo.a("fromAIO", true) != null) {
                    imageView.setOnClickListener(new jpd(this, picEmoticonInfo));
                    View view = (View) imageView.getParent();
                    if (ChatHistory.this.f8644a == null || !ChatHistory.this.f8644a.a(0, imageView.getTag())) {
                        ChatHistory.this.b(view != null ? (ImageView) view.findViewById(R.id.f48548name_res_0x7f0905c0) : null);
                        ChatHistory.this.a(imageView, picEmoticonInfo);
                        return;
                    }
                    ChatHistory.this.f8644a.a(view, EmoticonUtils.k.replace("[epId]", picEmoticonInfo.f22279a.epId).replace("[eId]", picEmoticonInfo.f22279a.eId));
                    ChatHistory.this.a(view != null ? (ImageView) view.findViewById(R.id.f48548name_res_0x7f0905c0) : null);
                }
            } else if (i == 1) {
                URLDrawable m6023a = picEmoticonInfo.m6023a();
                if (m6023a != null) {
                    imageView.setImageDrawable(m6023a);
                }
            } else if (i == 3) {
                MarketFaceItemBuilder.Holder holder = new MarketFaceItemBuilder.Holder();
                imageView.setOnClickListener(null);
                holder.f12964e = imageView;
                holder.f12962a = picEmoticonInfo;
                holder.f85806a = picEmoticonInfo.f22279a.getId();
                ((PngFrameManager) ChatHistory.this.app.getManager(82)).a(picEmoticonInfo.f22279a.magicValue, holder, picEmoticonInfo.f22279a.getId(), false, false, null);
            } else if (i == 0) {
                imageView.setImageResource(R.drawable.f41146name_res_0x7f020044);
            }
        }

        private void a(ImageView imageView, MarkFaceMessage markFaceMessage, ImageView imageView2) {
            int i;
            if (markFaceMessage == null) {
                a(imageView, 0, (PicEmoticonInfo) null);
                return;
            }
            PicEmoticonInfo a2 = ((EmoticonManager) ChatHistory.this.app.getManager(13)).a(markFaceMessage);
            imageView2.setTag(a2);
            if (a2 != null) {
                String replace = EmoticonUtils.t.replace("[epId]", a2.f22279a.epId);
                int a3 = PngFrameUtil.a(a2.f22279a.magicValue);
                if (FileUtils.m9176a(replace) && a3 == 1) {
                    i = 3;
                } else if (a2.b()) {
                    i = 2;
                } else {
                    i = a2.c() ? 1 : 0;
                }
                if (a2.m6024a()) {
                    imageView2.setVisibility(0);
                    imageView2.setImageDrawable(ChatHistory.this.getResources().getDrawable(R.drawable.f44801name_res_0x7f020e91));
                } else if (i == 1) {
                    imageView2.setVisibility(0);
                    imageView2.setImageDrawable(ChatHistory.this.getResources().getDrawable(R.drawable.f41147name_res_0x7f020045));
                }
            } else {
                i = 0;
            }
            imageView.setMinimumHeight((int) (ChatHistory.this.f8629a * 100.0f));
            imageView.setMinimumWidth((int) (ChatHistory.this.f8629a * 100.0f));
            a(imageView, i, a2);
        }

        private void a(ImageViewParameter imageViewParameter) {
            imageViewParameter.f85112a.setImageDrawable(PicItemBuilder.a(ChatHistory.this, imageViewParameter.f9892a));
            imageViewParameter.f85112a.setVisibility(0);
            imageViewParameter.f85112a.setOnClickListener(new jpe(this, imageViewParameter.f9892a.msgtype, imageViewParameter, imageViewParameter.f9892a.action));
        }

        private int a(int i) {
            int i2 = ChatHistory.this.f;
            if (i >= 60) {
                return ChatHistory.this.f8685g;
            }
            if (i > 45 && i < 60) {
                return ((ChatHistory.this.f8685g * 15) / 16) + ((((i - 45) * ChatHistory.this.f8685g) / 15) / 16) + ChatHistory.this.f;
            }
            if (i > 30 && i <= 45) {
                return ((ChatHistory.this.f8685g * 13) / 16) + (((((i - 30) * ChatHistory.this.f8685g) * 2) / 15) / 16) + ChatHistory.this.f;
            }
            if (i > 15 && i <= 30) {
                return ((ChatHistory.this.f8685g * 9) / 16) + (((((i - 15) * ChatHistory.this.f8685g) * 4) / 15) / 16) + ChatHistory.this.f;
            }
            if (i > 0 && i <= 15) {
                return ((((ChatHistory.this.f8685g * i) * 9) / 16) / 15) + ChatHistory.this.f;
            }
            return i2;
        }

        @Override
        public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
            return this.f8688a.inflate(R.layout.f56509name_res_0x7f0300a4, viewGroup, false);
        }

        @Override
        public void changeCursor(Cursor cursor) {
            if (cursor != null) {
                if (getCursor() != null) {
                    getCursor().deactivate();
                }
                super.changeCursor(cursor);
                notifyDataSetChanged();
            }
        }

        public void a() {
            super.changeCursor(null);
        }

        private String a(long j) {
            Time time = new Time();
            Time time2 = new Time();
            time.set(j);
            time2.setToNow();
            if (time.year != time2.year) {
                return time.format("%Y-%m-%d %H:%M:%S");
            }
            if (time.yearDay != time2.yearDay) {
                return time.format("%m-%d %H:%M:%S");
            }
            return time.format("%H:%M:%S");
        }

        public void a(String str, int i, int i2) {
            ThreadManager.m4814b().post(new jpf(this, i, i2, str));
        }
    }

    public void a(ImageView imageView) {
        if (imageView != null) {
            this.f8676c.setBounds(0, 0, this.f8676c.getMinimumWidth(), this.f8676c.getMinimumHeight());
            imageView.setImageDrawable(this.f8676c);
            this.f8676c.stop();
            this.f8676c.start();
        }
    }

    public void b(ImageView imageView) {
        if (imageView != null) {
            this.f8676c.stop();
            imageView.setImageDrawable(getResources().getDrawable(R.drawable.f44801name_res_0x7f020e91));
        }
    }

    public void a(ImageView imageView, PicEmoticonInfo picEmoticonInfo) {
        if (imageView != null && picEmoticonInfo != null && picEmoticonInfo.m6024a()) {
            URLDrawable a2 = picEmoticonInfo.a("fromAIO", true);
            Drawable drawable = imageView.getDrawable();
            if (drawable instanceof URLDrawable) {
                PicEmoticonInfo.b((URLDrawable) drawable);
            }
            imageView.setImageDrawable(a2);
        }
    }

    public void b(ImageView imageView, PicEmoticonInfo picEmoticonInfo) {
        if (imageView != null && picEmoticonInfo != null && picEmoticonInfo.m6024a()) {
            URLDrawable a2 = picEmoticonInfo.a("fromAIO", true);
            if (a2 instanceof URLDrawable) {
                PicEmoticonInfo.a(a2);
            }
            imageView.setImageDrawable(a2);
        }
    }

    public void b(String str) {
        if (f84966a == null) {
            f84966a = Toast.makeText(this, str, 0);
        } else {
            f84966a.setText(str);
        }
        f84966a.show();
    }

    private void q() {
        if (f84966a != null) {
            f84966a.cancel();
            f84966a = null;
        }
    }

    @Override
    public void doOnActivityResult(int i, int i2, Intent intent) {
        super.doOnActivityResult(i, i2, intent);
        switch (i) {
            case 21:
                if (-1 == i2) {
                    a(intent.getExtras());
                    return;
                }
                return;
            case 200:
                this.f8643a.getCursor().requery();
                return;
            default:
                return;
        }
    }

    private void a(Bundle bundle) {
        Intent a2 = AIOUtils.a(new Intent(this, SplashActivity.class), (int[]) null);
        a2.putExtras(new Bundle(bundle));
        startActivity(a2);
    }

    public void a(Message message) {
        this.f8661a.sendMessageDelayed(message, 0L);
    }

    public MsgBody a(int i, int i2, String str, int i3) {
        if (((i2 == -1003 || i2 == -1032 || i2 == -1031 || i2 == 201) && i == 1001) || ActionMsgUtil.a(i2) || i2 == -3001 || i2 == -30002 || i2 == -30003) {
            return ActionMsgUtil.a(str);
        }
        if (i2 == -2009) {
            MsgBody msgBody = new MsgBody();
            msgBody.f80051msg = MsgUtils.a(TransfileUtile.m8625a(str), (Context) this, MsgUtils.b(i3), false);
            msgBody.action = null;
            return msgBody;
        } else if (i2 == -2016) {
            MsgBody msgBody2 = new MsgBody();
            msgBody2.f80051msg = MsgUtils.a(this.app, TransfileUtile.m8625a(str), this, this.f8680d, (String) null, this.f8630a);
            msgBody2.action = null;
            return msgBody2;
        } else {
            MsgBody msgBody3 = new MsgBody();
            msgBody3.f80051msg = str;
            msgBody3.action = null;
            return msgBody3;
        }
    }

    public void a(int i, int i2) {
        int i3;
        int i4;
        this.D = i;
        if (i2 > 0) {
            if (i2 < 8) {
                i3 = 1;
            } else {
                i3 = i2 % 8 == 0 ? i2 / 8 : (i2 / 8) + 1;
            }
            if (i < 8) {
                i4 = 1;
            } else {
                i4 = i % 8 == 0 ? i / 8 : (i / 8) + 1;
            }
            this.f8664b = i4 + i3;
            this.z = i3 * 8;
            this.D += this.z;
        } else if (this.D < 8) {
            this.f8664b = 1;
        } else {
            this.f8664b = this.D % 8 == 0 ? this.D / 8 : (this.D / 8) + 1;
        }
    }

    public boolean m2411c(String str) {
        r();
        MediaPlayerManager.a(this.app).m3086a(true);
        if (this.f8646a == null) {
            this.f8646a = new AudioPlayer(this, this.f8645a);
        }
        boolean a2 = this.f8646a.a(str);
        if (QLog.isColorLevel()) {
            QLog.i("ChatHistory", 2, "playSource|bRet = " + a2);
        }
        if (a2 && this.f8634a != null) {
            this.f8635a.registerListener(this, this.f8634a, 2);
        }
        return a2;
    }

    public void r() {
        if (this.f8646a != null && this.f8646a.m3050a()) {
            this.f8646a.c();
            this.f8646a = null;
        }
        if (this.f8635a != null) {
            this.f8635a.unregisterListener(this);
        }
        setVolumeControlStream(3);
    }

    public void i() {
        AudioUtil.b(R.raw.f58376name_res_0x7f070002, false);
    }

    private void s() {
        this.f8635a = (SensorManager) this.app.getApplication().getSystemService(CameraConfigParser.h);
        this.f8634a = this.f8635a.getDefaultSensor(8);
        if (this.f8634a != null) {
            this.f8663b = this.f8634a.getMaximumRange();
            this.f8663b = this.f8663b > 10.0f ? 10.0f : this.f8663b;
        }
    }

    @Override
    public void onAccuracyChanged(Sensor sensor, int i) {
    }

    @Override
    public void onSensorChanged(SensorEvent sensorEvent) {
        if (!AIOUtils.b()) {
            boolean z = sensorEvent.values[0] < this.f8663b;
            if (this.f8683e != z) {
                this.f8683e = z;
                if (this.f8646a != null) {
                    this.f8646a.m3051a(this.f8683e ? false : true);
                }
                if (!AppSetting.f7081k) {
                    b(this.f8683e ? R.string.f63799name_res_0x7f0a1516 : R.string.f63800name_res_0x7f0a1517);
                }
            }
        }
    }

    public void b(int i) {
        QQToast.a(getActivity(), i, 0).b(getResources().getDimensionPixelSize(R.dimen.f39450title_bar_height));
    }

    public void a(int i, String str) {
        QQToast.a(this, i, str, 0).b(getTitleBarHeight());
    }

    private void c(String str) {
        if (this.f8672b == null) {
            this.f8672b = new QQProgressDialog(this, getTitleBarHeight());
        }
        this.f8672b.setCancelable(true);
        this.f8672b.a(str);
        this.f8672b.show();
    }

    public void j() {
        try {
            if (this.f8672b != null) {
                this.f8672b.dismiss();
                this.f8672b.cancel();
                this.f8672b = null;
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    public class PlayingPttHistoryInfo {
        public static final int f84972a = 0;
        public static final int f84973b = 1;
        public View f8690a;
        public Object f8692a;
        public String f8693a;
        public boolean f8694a;
        public int f84974c;

        public PlayingPttHistoryInfo() {
            a();
        }

        public void a() {
            if (QLog.isColorLevel()) {
                QLog.i("ChatHistory", 2, "reset()");
            }
            this.f84974c = -1;
            this.f8690a = null;
            this.f8692a = null;
            this.f8694a = true;
            this.f8693a = null;
        }

        public boolean a(int i, Object obj) {
            return !this.f8694a && i == this.f84974c && Utils.a(this.f8692a, obj);
        }

        private void c() {
            ImageView imageView;
            ImageView imageView2 = null;
            if (this.f84974c == 0) {
                Button button = this.f8690a != null ? (Button) this.f8690a.findViewById(R.id.f48550name_res_0x7f0905c2) : null;
                if (button != null) {
                    if ((this.f8690a.getTag() == null || !(this.f8690a.getTag() instanceof jph)) ? false : ((jph) this.f8690a.getTag()).f73103a) {
                        ChatHistory.this.f8667b.setBounds(0, 0, ChatHistory.this.f8667b.getMinimumWidth(), ChatHistory.this.f8667b.getMinimumHeight());
                        button.setCompoundDrawables(ChatHistory.this.f8667b, null, null, null);
                        ChatHistory.this.f8667b.stop();
                        ChatHistory.this.f8667b.start();
                        return;
                    }
                    ChatHistory.this.f8633a.setBounds(0, 0, ChatHistory.this.f8633a.getMinimumWidth(), ChatHistory.this.f8633a.getMinimumHeight());
                    button.setCompoundDrawables(ChatHistory.this.f8633a, null, null, null);
                    ChatHistory.this.f8633a.stop();
                    ChatHistory.this.f8633a.start();
                }
            } else if (this.f84974c == 1) {
                if (this.f8690a != null) {
                    imageView2 = (ImageView) this.f8690a.findViewById(R.id.f48547name_res_0x7f0905bf);
                    imageView = (ImageView) this.f8690a.findViewById(R.id.f48548name_res_0x7f0905c0);
                } else {
                    imageView = null;
                }
                if (imageView != null && imageView2 != null) {
                    Object tag = imageView.getTag();
                    if (tag instanceof PicEmoticonInfo) {
                        ChatHistory.this.a(imageView);
                        ChatHistory.this.b(imageView2, (PicEmoticonInfo) tag);
                    }
                }
            }
        }

        private void d() {
            ImageView imageView;
            Drawable drawable;
            ImageView imageView2 = null;
            if (this.f84974c == 0) {
                Button button = this.f8690a != null ? (Button) this.f8690a.findViewById(R.id.f48550name_res_0x7f0905c2) : null;
                if (button != null && button.getTag().equals(this.f8692a)) {
                    if ((this.f8690a.getTag() == null || !(this.f8690a.getTag() instanceof jph)) ? false : ((jph) this.f8690a.getTag()).f73103a) {
                        ChatHistory.this.f8667b.stop();
                        drawable = ChatHistory.this.getResources().getDrawable(R.drawable.f46461name_res_0x7f02150d);
                        drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
                    } else {
                        ChatHistory.this.f8633a.stop();
                        drawable = ChatHistory.this.getResources().getDrawable(R.drawable.f46460skin_aio_ptt_action_l_3);
                        drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
                    }
                    button.setCompoundDrawables(drawable, null, null, null);
                }
            } else if (this.f84974c == 1) {
                if (this.f8690a != null) {
                    imageView2 = (ImageView) this.f8690a.findViewById(R.id.f48547name_res_0x7f0905bf);
                    imageView = (ImageView) this.f8690a.findViewById(R.id.f48548name_res_0x7f0905c0);
                } else {
                    imageView = null;
                }
                if (imageView != null && imageView2 != null) {
                    Object tag = imageView.getTag();
                    if (tag instanceof PicEmoticonInfo) {
                        PicEmoticonInfo picEmoticonInfo = (PicEmoticonInfo) tag;
                        picEmoticonInfo.a("fromAIO", true);
                        ChatHistory.this.b(imageView);
                        ChatHistory.this.a(imageView2, picEmoticonInfo);
                    }
                }
            }
        }

        public void b() {
            if (QLog.isColorLevel()) {
                QLog.i("ChatHistory", 2, "stopPlayPtt()");
            }
            ChatHistory.this.r();
            this.f8694a = true;
            d();
            a();
        }

        public void a(int i, View view, Object obj, String str) {
            if (QLog.isColorLevel()) {
                QLog.i("ChatHistory", 2, "playPtt() type = " + i + ", isFinish = " + this.f8694a);
            }
            if (!this.f8694a && Utils.a(obj, this.f8692a)) {
                if (QLog.isColorLevel()) {
                    QLog.i("ChatHistory", 2, "playPtt() 点击正在播放,即要停止啦!");
                }
                b();
                return;
            }
            if (!this.f8694a) {
                b();
            }
            if (!ChatHistory.this.m2411c(str)) {
                b();
                return;
            }
            this.f8694a = false;
            this.f84974c = i;
            this.f8690a = view;
            this.f8692a = obj;
            this.f8693a = str;
            c();
        }

        public void a(View view, String str) {
            this.f8690a = view;
            this.f8693a = str;
            if (this.f84974c != 1) {
                c();
            }
        }

        public String toString() {
            StringBuilder sb = new StringBuilder();
            sb.append("[type = ").append(this.f84974c).append(", curTag = ").append(this.f8692a).append(", isFinish = ").append(this.f8694a).append(StepFactory.f18879b);
            return sb.toString();
        }
    }

    public static final Object a(View view) {
        if (view == null) {
            return null;
        }
        if (view.getParent() == null || (view.getParent() instanceof XListView)) {
            return view.getTag();
        }
        return a((View) view.getParent());
    }

    public void a(MessageRecord messageRecord) {
        if (QLog.isColorLevel()) {
            if (messageRecord != null) {
                QLog.d(LogTag.G, 2, "startDelMsg is called,mr uniseq is:" + messageRecord.uniseq + ",id is:" + messageRecord.getId());
            } else {
                QLog.d(LogTag.G, 2, "startDelMsg is called,mr is null");
            }
        }
        ActionSheet actionSheet = (ActionSheet) ActionSheetHelper.a(this, (View) null);
        actionSheet.m10334a((CharSequence) getResources().getString(R.string.f60811name_res_0x7f0a0968));
        actionSheet.a(R.string.f63878name_res_0x7f0a1565, 3);
        actionSheet.d(R.string.f63203cancel);
        actionSheet.a(new joo(this, messageRecord, actionSheet));
        actionSheet.show();
    }

    private void t() {
        if (this.f8647a != null) {
            switch (this.f8647a.f85624a) {
                case 0:
                    this.E = 0;
                    break;
                case 1:
                    this.E = 3;
                    break;
                case 3000:
                    this.E = 2;
                    break;
            }
            if (QLog.isColorLevel()) {
                QLog.d("ChatHistory", 2, "AIO_chatlog arg:" + this.E);
            }
            ReportController.b(this.app, "dc01331", "", "", "AIO", "AIO_chatlog", this.E, 0, String.valueOf(this.E), "", "", "");
        }
    }

    public void k() {
        if (!this.f8681d) {
            this.f8681d = true;
            ReportController.b(this.app, "dc01331", "", "", "0X8005690", "0X8005690", this.E, 0, "", "", "", "");
        }
    }

    public Cursor a(String str, String str2, String str3) {
        Cursor a2;
        SQLiteDatabase m4685b = this.app.m4685b();
        if (m4685b == null) {
            if (QLog.isColorLevel()) {
                QLog.e("ChatHistory", 2, "MessageProvide getDB null!");
                return null;
            }
            return null;
        }
        if (str.indexOf("mr_troop_") != -1) {
            String str4 = " where " + str3;
            StringBuilder b2 = MessageDBUtils.b(str2, str, m4685b, str4);
            if (b2 == null) {
                return null;
            }
            b2.append(" t left join TroopMemberInfo m on t.senderuin=m.memberuin and t.frienduin=m.troopuin");
            try {
                a2 = m4685b.m4769a(b2.toString(), (String[]) null);
            } catch (SQLException e) {
                a2 = m4685b.a(str, null, str4, null, null, null);
            }
        } else if (str.indexOf("mr_grp_") != -1) {
            StringBuilder sb = new StringBuilder("select * from ");
            sb.append(str);
            sb.append(" t left join GrpMemberInfo m on t.senderuin=m.mId and t.frienduin=m.grpID left join friends l on m.mId =l.uin ");
            if (str3 != null && str3.length() > 0) {
                sb.append(" where ");
                sb.append(str3);
            }
            try {
                a2 = m4685b.m4769a(sb.toString(), (String[]) null);
            } catch (SQLException e2) {
                a2 = m4685b.a(str, null, str3, null, null, null);
            }
            if (QLog.isColorLevel()) {
                QLog.d("gene", 2, "cursor: " + a2);
            }
        } else if (str.indexOf("mr_discusssion_") != -1) {
            String str5 = " where " + str3;
            StringBuilder b3 = MessageDBUtils.b(str2, str, m4685b, str5);
            if (b3 == null) {
                return null;
            }
            b3.append(" t left join DiscussionMemberInfo m on t.senderuin=m.memberUin and t.frienduin=m.discussionUin");
            try {
                a2 = m4685b.m4769a(b3.toString(), (String[]) null);
            } catch (SQLException e3) {
                a2 = m4685b.a(str, null, str5, null, null, null);
            }
        } else {
            StringBuilder a3 = MessageDBUtils.a(str2, str, m4685b, str3, null);
            if (a3 != null) {
                try {
                    a2 = m4685b.m4769a(a3.toString(), (String[]) null);
                } catch (SQLException e4) {
                    a2 = m4685b.a(str, null, str3, null, null, null);
                }
            } else {
                a2 = null;
            }
        }
        return a2;
    }
}