package com.tencent.mm.plugin.sns.ui.d;

import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.sns.data.b;
import com.tencent.mm.plugin.sns.model.af;
import com.tencent.mm.plugin.sns.model.r;
import com.tencent.mm.plugin.sns.storage.AdLandingPagesStorage.i;
import com.tencent.mm.plugin.sns.storage.a;
import com.tencent.mm.plugin.sns.storage.b$b;
import com.tencent.mm.plugin.sns.storage.n;
import com.tencent.mm.plugin.sns.ui.c;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.ytcommon.BuildConfig;

class b$27 implements OnItemClickListener {
    final /* synthetic */ b rKt;

    b$27(b bVar) {
        this.rKt = bVar;
    }

    public final void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
        AppMethodBeat.i(40283);
        ab.i("MicroMsg.TimelineClickListener", "unlike click");
        if (adapterView.getAdapter() instanceof c) {
            b bVar = (b) view.getTag();
            n YT = af.cnF().YT(bVar.cwT);
            if (YT == null) {
                AppMethodBeat.o(40283);
                return;
            } else if (i == 0) {
                Object obj;
                if (YT.DI(32)) {
                    Object obj2;
                    a a = b.a(this.rKt, YT);
                    if (a == null) {
                        obj2 = BuildConfig.FLAVOR;
                    } else {
                        String obj22 = a.hnw;
                    }
                    ((com.tencent.mm.plugin.sns.b.c) g.K(com.tencent.mm.plugin.sns.b.c.class)).a(11855, YT.cre(), Integer.valueOf(3), obj22, Integer.valueOf(YT.cre()));
                }
                if (bVar.qFH.rDn.qTP.coJ().size() > 0) {
                    obj = 1;
                } else {
                    obj = null;
                }
                a.b.a aVar;
                r rVar;
                if (obj != null) {
                    c cVar = (c) adapterView.getAdapter();
                    cVar.hzv++;
                    cVar.notifyDataSetChanged();
                    adapterView.setOnItemClickListener(this.rKt.rKk);
                    this.rKt.crF();
                    aVar = new a.b.a();
                    aVar.qUc = a.b.a.qTY;
                    aVar.qFI = bVar.qFI;
                    aVar.qUd = 0;
                    rVar = new r(YT.field_snsId, 8, aVar);
                    g.RQ();
                    g.RO().eJo.a(rVar, 0);
                    AppMethodBeat.o(40283);
                    return;
                } else if (bVar.qFH.rDn.qTT) {
                    AppMethodBeat.o(40283);
                    return;
                } else {
                    this.rKt.dL(view);
                    aVar = new a.b.a();
                    aVar.qFI = bVar.qFI;
                    aVar.qUd = System.currentTimeMillis();
                    rVar = new r(YT.field_snsId, 8, aVar);
                    g.RQ();
                    g.RO().eJo.a(rVar, 0);
                    AppMethodBeat.o(40283);
                    return;
                }
            } else if (bVar.qFH.rDm.qUZ == null) {
                ab.e("MicroMsg.TimelineClickListener", "click feedback item but no report url");
                AppMethodBeat.o(40283);
                return;
            } else {
                com.tencent.mm.plugin.sns.storage.b.a aVar2 = bVar.qFH.rDm.qUZ;
                int i2 = i - 1;
                if (i2 < aVar2.list.size()) {
                    String str = ((b$b) aVar2.list.get(i2)).url;
                    try {
                        String[] strArr = new String[4];
                        strArr[0] = String.format("snsid=%s", new Object[]{YT.cqu().Id});
                        strArr[1] = String.format("aid=%s", new Object[]{YT.cqZ()});
                        strArr[2] = String.format("traceid=%s", new Object[]{YT.cra()});
                        Object[] objArr = new Object[1];
                        g.RN();
                        objArr[0] = com.tencent.mm.kernel.a.QG();
                        strArr[3] = String.format("uin=%s", objArr);
                        str = i.m(str, strArr);
                    } catch (Exception e) {
                    }
                    Intent intent = new Intent();
                    intent.putExtra("rawUrl", str);
                    intent.putExtra("useJs", true);
                    intent.putExtra("KPublisherId", "sns_" + com.tencent.mm.plugin.sns.data.i.jV(YT.field_snsId));
                    intent.putExtra("pre_username", YT.field_userName);
                    intent.putExtra("prePublishId", "sns_" + com.tencent.mm.plugin.sns.data.i.jV(YT.field_snsId));
                    intent.putExtra("preUsername", YT.field_userName);
                    com.tencent.mm.plugin.sns.c.a.gkE.i(intent, this.rKt.activity);
                }
                AppMethodBeat.o(40283);
                return;
            }
        }
        ab.w("MicroMsg.TimelineClickListener", "unknown unlike adapter click");
        AppMethodBeat.o(40283);
    }
}
