package com.ss.android.ugc.aweme.profile.viewer.ui;

import X.0HH;
import X.0Q2;
import X.2yb;
import X.306;
import X.33J;
import X.4QM;
import X.4QR;
import X.4eJ;
import X.4wQ;
import X.7he;
import X.AjM;
import X.BT2;
import X.C0295Crj;
import X.C3147E3b;
import X.C3148E3c;
import X.C3150E3e;
import X.C3157E3l;
import X.C3159E3n;
import X.E3U;
import X.E3W;
import X.E4U;
import X.M12;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.powerlist.PowerCell;
import com.bytedance.lighten.loader.SmartImageView;
import com.ss.android.ugc.aweme.profile.model.MatchedFriendStruct;
import com.ss.android.ugc.aweme.profile.model.User;
import com.ss.android.ugc.aweme.profile.viewer.viewmodel.ProfileViewerViewModel;
import kotlin.h.b.n;

public final class ProfileViewerCell extends PowerCell<4QM> {
    public static final C3150E3e LIZ = new C3150E3e((byte) 0);
    public final C0295Crj LIZIZ = 7he.LIZ(4eJ.LIZ);
    public final C0295Crj LJIIIZ = 7he.LIZ(new 2yb(this));
    public final C0295Crj LJIIJ = 7he.LIZ(new 33J(this));
    public final C0295Crj LJIIJJI = 7he.LIZ(new 306(this));
    public final C0295Crj LJIIL = 7he.LIZ(new C3147E3b(this));
    public final C0295Crj LJIILIIL = 7he.LIZ(new C3148E3c(this));
    public final C0295Crj LJIILJJIL = 7he.LIZ(new E3U(this));

    static {
        Covode.recordClassIndex(99556);
    }

    private final SmartImageView LIZLLL() {
        return (SmartImageView) this.LJIIJ.getValue();
    }

    private final BT2 LJ() {
        return (BT2) this.LJIIL.getValue();
    }

    public final ProfileViewerViewModel LIZ() {
        return (ProfileViewerViewModel) this.LJIIIZ.getValue();
    }

    public final AjM LIZIZ() {
        return (AjM) this.LJIILIIL.getValue();
    }

    public final void bD_() {
        super.bD_();
        0Q2 r2 = 0Q2.LIZ;
        View view = this.itemView;
        n.LIZIZ(view, "");
        r2.LIZIZ(view, new E3W(this));
    }

    /* JADX WARNING: Code restructure failed: missing block: B:12:0x0087, code lost:
        if (r3 == null) goto L_0x0089;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZJ() {
        /*
            r19 = this;
            r3 = r19
            T r0 = r3.LIZLLL
            X.4QM r0 = (X.4QM) r0
            if (r0 == 0) goto L_0x0010
            X.4QR r0 = r0.LIZ
            if (r0 == 0) goto L_0x0010
            com.ss.android.ugc.aweme.profile.model.User r2 = r0.LIZJ
            if (r2 != 0) goto L_0x0011
        L_0x0010:
            return
        L_0x0011:
            X.2UX r7 = new X.2UX
            r7.<init>()
            java.lang.String r5 = "enter_from"
            java.lang.String r4 = "profile_visitor_list"
            r7.LIZ(r5, r4)
            com.ss.android.ugc.aweme.profile.viewer.viewmodel.ProfileViewerViewModel r0 = r19.LIZ()
            java.lang.String r1 = r0.LJFF
            java.lang.String r0 = "previous_page"
            r7.LIZ(r0, r1)
            java.lang.String r1 = r2.getUid()
            java.lang.String r0 = "rec_uid"
            r7.LIZ(r0, r1)
            java.lang.String r1 = r2.getUid()
            java.lang.String r0 = "to_user_id"
            r7.LIZ(r0, r1)
            java.lang.String r1 = r2.getRequestId()
            java.lang.String r0 = "req_id"
            r7.LIZ(r0, r1)
            java.lang.String r1 = X.4wQ.LIZIZ(r2)
            java.lang.String r0 = "follow_status"
            r7.LIZ(r0, r1)
            java.lang.String r1 = r2.getRecType()
            java.lang.String r0 = "rec_type"
            r7.LIZ(r0, r1)
            java.lang.String r1 = r2.getFriendTypeStr()
            java.lang.String r0 = "relation_type"
            r7.LIZ(r0, r1)
            java.lang.String r6 = ""
            kotlin.h.b.n.LIZIZ(r7, r6)
            X.Bi4.LIZ(r7, r2)
            java.util.Map r1 = r7.LIZ
            java.lang.String r0 = "enter_personal_detail"
            X.2nK.LIZ(r0, r1)
            X.E3n r0 = X.C3159E3n.ENTER_PROFILE
            r3.LIZ((X.C3159E3n) r0)
            android.view.View r0 = r3.itemView
            kotlin.h.b.n.LIZIZ(r0, r6)
            android.content.Context r3 = r0.getContext()
            kotlin.h.b.n.LIZIZ(r3, r6)
        L_0x007e:
            r1 = 0
            if (r3 == 0) goto L_0x0129
            boolean r0 = r3 instanceof android.app.Activity
            if (r0 == 0) goto L_0x011d
            android.app.Activity r3 = (android.app.Activity) r3
            if (r3 != 0) goto L_0x008c
        L_0x0089:
            kotlin.h.b.n.LIZIZ()
        L_0x008c:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "aweme://user/profile/"
            r1.<init>(r0)
            java.lang.String r0 = r2.getUid()
            r1.append(r0)
            java.lang.String r0 = r1.toString()
            com.bytedance.router.SmartRoute r0 = com.bytedance.router.SmartRouter.buildRoute(r3, r0)
            java.lang.String r3 = r2.getUid()
            java.lang.String r1 = "uid"
            r0.withParam(r1, r3)
            java.lang.String r3 = r2.getSecUid()
            java.lang.String r1 = "sec_user_id"
            r0.withParam(r1, r3)
            r0.withParam(r5, r4)
            java.lang.String r1 = "extra_from_pre_page"
            r0.withParam(r1, r4)
            com.ss.android.ugc.aweme.profile.model.MatchedFriendStruct r3 = r2.getMatchedFriendStruct()
            r1 = 1
            r1 = 0
            if (r3 == 0) goto L_0x00e2
            com.ss.android.ugc.aweme.friends.model.MutualStruct r1 = r3.getMMutualStruct()
            if (r1 == 0) goto L_0x00d6
            java.util.List r1 = r1.getUserList()
            if (r1 == 0) goto L_0x00d6
            boolean r1 = r1.isEmpty()
            if (r1 == 0) goto L_0x00e7
        L_0x00d6:
            java.lang.String r1 = r3.getRecommendReason()
            if (r1 == 0) goto L_0x00e2
            int r1 = r1.length()
            if (r1 != 0) goto L_0x00e7
        L_0x00e2:
            r0.open()
            goto L_0x0010
        L_0x00e7:
            X.E3m r3 = new X.E3m
            com.ss.android.ugc.aweme.profile.viewer.viewmodel.ProfileViewerViewModel r1 = r19.LIZ()
            java.lang.String r5 = r1.LJFF
            X.E4U r6 = X.E4U.CARD
            java.lang.String r7 = r2.getRecType()
            X.AkL r8 = X.C3164E3s.LIZ((com.ss.android.ugc.aweme.profile.model.User) r2)
            java.lang.String r9 = r2.getUid()
            r10 = 0
            r11 = 0
            java.lang.String r12 = r2.getRequestId()
            r13 = 0
            java.lang.String r14 = r2.getFriendTypeStr()
            java.lang.String r15 = r2.getSocialInfo()
            r16 = 0
            r17 = 4096(0x1000, float:5.74E-42)
            r18 = 0
            java.lang.String r4 = "profile_visitor_list"
            r3.<init>(r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, r18)
            java.lang.String r1 = "recommend_enter_profile_params"
            r0.withParam(r1, r3)
            goto L_0x00e2
        L_0x011d:
            boolean r0 = r3 instanceof android.content.ContextWrapper
            if (r0 == 0) goto L_0x0129
            android.content.ContextWrapper r3 = (android.content.ContextWrapper) r3
            android.content.Context r3 = r3.getBaseContext()
            goto L_0x007e
        L_0x0129:
            r3 = r1
            goto L_0x0089
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.profile.viewer.ui.ProfileViewerCell.LIZJ():void");
    }

    public final View LIZ(ViewGroup viewGroup) {
        M12.LIZ(viewGroup);
        View LIZ2 = 0HH.LIZ(LayoutInflater.from(viewGroup.getContext()), 2131560832, viewGroup, false);
        n.LIZIZ(LIZ2, "");
        return LIZ2;
    }

    public final boolean LIZ(C3159E3n e3n) {
        4QR r0;
        User user;
        Integer valueOf;
        String str;
        4QM r02 = (4QM) this.LIZLLL;
        boolean z = false;
        if (r02 == null || (r0 = r02.LIZ) == null || (user = r0.LIZJ) == null) {
            return false;
        }
        String LIZIZ2 = 4wQ.LIZIZ(user);
        C3157E3l e3l = new C3157E3l();
        e3l.LIZIZ = e3n;
        e3l.LIZ = E4U.CARD;
        e3l.LIZ("profile_visitor_list");
        n.LIZIZ(LIZIZ2, "");
        if (LIZIZ2.length() == 0) {
            z = true;
        }
        String str2 = null;
        if (z) {
            valueOf = null;
        } else {
            valueOf = Integer.valueOf(Integer.parseInt(LIZIZ2));
        }
        e3l.LIZ(valueOf);
        e3l.LJIIZILJ(LIZ().LJFF);
        e3l.LIZ(user);
        MatchedFriendStruct matchedFriendStruct = user.getMatchedFriendStruct();
        if (matchedFriendStruct != null) {
            str = matchedFriendStruct.getRelationType();
        } else {
            str = null;
        }
        e3l.LJIL(str);
        MatchedFriendStruct matchedFriendStruct2 = user.getMatchedFriendStruct();
        if (matchedFriendStruct2 != null) {
            str2 = matchedFriendStruct2.getRecType();
        }
        e3l.LJJ(str2);
        e3l.LJFF();
        return true;
    }

    /* JADX WARNING: Removed duplicated region for block: B:17:0x00cf  */
    /* JADX WARNING: Removed duplicated region for block: B:21:? A[RETURN, SYNTHETIC] */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final /* synthetic */ void LIZ(X.C1481DaP r8) {
        /*
            r7 = this;
            X.4QM r8 = (X.4QM) r8
            X.M12.LIZ(r8)
            super.LIZ(r8)
            X.4QR r0 = r8.LIZ
            com.ss.android.ugc.aweme.profile.model.User r3 = r0.LIZJ
            android.view.View r1 = r7.itemView
            X.E3Z r0 = new X.E3Z
            r0.<init>(r7)
            r1.setOnClickListener(r0)
            com.bytedance.lighten.loader.SmartImageView r1 = r7.LIZLLL()
            X.E3a r0 = new X.E3a
            r0.<init>(r7)
            r1.setOnClickListener(r0)
            com.ss.android.ugc.aweme.base.model.UrlModel r0 = r3.getAvatarThumb()
            X.B9H r0 = X.3EX.LIZ(r0)
            X.QJt r2 = X.QHW.LIZ(r0)
            java.lang.String r0 = "ProfileViewerCell"
            r2.LIZ(r0)
            com.bytedance.lighten.loader.SmartImageView r0 = r7.LIZLLL()
            r2.LJJIIZ = r0
            X.JIy r0 = new X.JIy
            r0.<init>()
            r1 = 1
            r0.LIZ = r1
            X.JIz r0 = r0.LIZ()
            r2.LJIL = r0
            r2.LIZJ = r1
            r2.LIZJ()
            X.Crj r0 = r7.LJIIJJI
            java.lang.Object r1 = r0.getValue()
            X.Qeg r1 = (X.Qeg) r1
            java.lang.String r4 = ""
            kotlin.h.b.n.LIZIZ(r1, r4)
            java.lang.String r0 = r3.getNickname()
            r1.setText(r0)
            com.ss.android.ugc.aweme.profile.model.MatchedFriendStruct r6 = r3.getMatchedFriendStruct()
            r1 = 0
            if (r6 == 0) goto L_0x0088
            com.ss.android.ugc.aweme.friends.model.MutualStruct r0 = r6.getMMutualStruct()
            if (r0 == 0) goto L_0x0071
            java.util.List r1 = r0.getUserList()
        L_0x0071:
            r5 = 0
            if (r1 == 0) goto L_0x007a
            boolean r0 = r1.isEmpty()
            if (r0 == 0) goto L_0x00fd
        L_0x007a:
            if (r6 == 0) goto L_0x0088
            java.lang.String r0 = r6.getRecommendReason()
            if (r0 == 0) goto L_0x0088
            int r0 = r0.length()
            if (r0 != 0) goto L_0x00dc
        L_0x0088:
            X.BT2 r1 = r7.LJ()
            kotlin.h.b.n.LIZIZ(r1, r4)
            r0 = 8
            r1.setVisibility(r0)
        L_0x0094:
            X.BT2 r2 = r7.LJ()
            android.view.View r0 = r7.itemView
            kotlin.h.b.n.LIZIZ(r0, r4)
            android.content.res.Resources r1 = r0.getResources()
            r0 = 2131099758(0x7f06006e, float:1.7811878E38)
            int r0 = r1.getColor(r0)
            r2.setTextColor(r0)
            X.AjM r1 = r7.LIZIZ()
            X.Crj r0 = r7.LIZIZ
            java.lang.Object r0 = r0.getValue()
            java.lang.Boolean r0 = (java.lang.Boolean) r0
            boolean r0 = r0.booleanValue()
            r1.setShouldShowMessageText(r0)
            X.Crj r0 = r7.LJIILJJIL
            java.lang.Object r0 = r0.getValue()
            X.EIT r0 = (X.EIT) r0
            r0.LIZ((com.ss.android.ugc.aweme.profile.model.User) r3)
            X.4QR r0 = r8.LIZ
            boolean r0 = r0.LIZ
            if (r0 == 0) goto L_0x00db
            android.view.View r1 = r7.itemView
            r0 = 2131099682(0x7f060022, float:1.7811724E38)
            int r0 = X.4Og.LIZIZ(r0)
            r1.setBackgroundColor(r0)
        L_0x00db:
            return
        L_0x00dc:
            X.BT2 r0 = r7.LJ()
            r0.LIZ()
            X.BT2 r0 = r7.LJ()
            X.Qeg r1 = r0.getTvDesc()
            java.lang.String r0 = r6.getRecommendReason()
            r1.setText(r0)
            X.BT2 r0 = r7.LJ()
            kotlin.h.b.n.LIZIZ(r0, r4)
            r0.setVisibility(r5)
            goto L_0x0094
        L_0x00fd:
            X.BT2 r2 = r7.LJ()
            com.ss.android.ugc.aweme.friends.model.MutualStruct r1 = r6.getMMutualStruct()
            r0 = 4
            r2.LIZ(r1, r0)
            X.BT2 r0 = r7.LJ()
            kotlin.h.b.n.LIZIZ(r0, r4)
            r0.setVisibility(r5)
            goto L_0x0094
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.profile.viewer.ui.ProfileViewerCell.LIZ(X.DaP):void");
    }
}
