package com.ss.android.ugc.aweme.find.viewholder;

import X.0CB;
import X.0CH;
import X.2Pr;
import X.6Is;
import X.Ar5;
import X.C1590DcA;
import X.C1793DfR;
import X.C3157E3l;
import X.C3159E3n;
import X.DL2;
import X.E4R;
import X.E4U;
import X.Ls2;
import X.LsF;
import X.M12;
import android.view.View;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.find.viewmodel.FindFriendsViewModel;
import com.ss.android.ugc.aweme.profile.model.User;
import kotlin.h.b.n;

public final class RecommendFriendViewHolder extends FindFriendsBaseViewHolder implements 6Is {
    public E4R LIZJ;
    public User LIZLLL;
    public int LJ;
    public String LJFF = "suggest_account";
    public final C1793DfR LJI;
    public final Ls2<Boolean> LJII;
    public final LsF<User, Integer, String, String, 2Pr> LJIIIIZZ;

    static {
        Covode.recordClassIndex(80575);
    }

    public final void onStateChanged(0CH r1, 0CB r2) {
        super.onStateChanged(r1, r2);
    }

    public final void LIZ(User user, C3159E3n e3n) {
        String str;
        C3157E3l e3l = new C3157E3l();
        e3l.LJIIZILJ(this.LIZ.LJI);
        e3l.LIZ("find_friends_page");
        e3l.LIZ = E4U.CARD;
        e3l.LIZIZ = e3n;
        e3l.LIZ(user);
        if (user != null) {
            str = user.getRequestId();
        } else {
            str = null;
        }
        e3l.LJIJJ(str);
        e3l.LJFF();
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public RecommendFriendViewHolder(C1793DfR dfR, Ls2<Boolean> ls2, LsF<? super User, ? super Integer, ? super String, ? super String, 2Pr> lsF) {
        super(dfR.getView());
        M12.LIZ(dfR, ls2, lsF);
        this.LJI = dfR;
        this.LJII = ls2;
        this.LJIIIIZZ = lsF;
        this.LIZJ = dfR.getRelationBtn();
        dfR.getView().addOnAttachStateChangeListener(new View.OnAttachStateChangeListener(this) {
            public final /* synthetic */ RecommendFriendViewHolder LIZ;

            static {
                Covode.recordClassIndex(80576);
            }

            public final void onViewDetachedFromWindow(View view) {
            }

            {
                this.LIZ = r1;
            }

            public final void onViewAttachedToWindow(View view) {
                String str;
                User user;
                RecommendFriendViewHolder recommendFriendViewHolder = this.LIZ;
                FindFriendsViewModel findFriendsViewModel = recommendFriendViewHolder.LIZ;
                DL2 dl2 = findFriendsViewModel.LJFF;
                if (dl2 == null) {
                    n.LIZ("");
                }
                if (!dl2.LIZ()) {
                    DL2 dl22 = findFriendsViewModel.LJFF;
                    if (dl22 == null) {
                        n.LIZ("");
                    }
                    dl22.LJ();
                    DL2 dl23 = findFriendsViewModel.LJFF;
                    if (dl23 == null) {
                        n.LIZ("");
                    }
                    dl23.LJFF();
                }
                if (!((Boolean) recommendFriendViewHolder.LJII.invoke()).booleanValue() && (user = recommendFriendViewHolder.LIZLLL) != null) {
                    recommendFriendViewHolder.LJIIIIZZ.invoke(user, Integer.valueOf(recommendFriendViewHolder.LJ), recommendFriendViewHolder.LJFF, recommendFriendViewHolder.LIZ.LJI);
                }
                User user2 = recommendFriendViewHolder.LIZLLL;
                if (user2 != null && user2.isShould_write_impr()) {
                    C1590DcA dcA = Ar5.LIZ;
                    User user3 = recommendFriendViewHolder.LIZLLL;
                    if (user3 != null) {
                        str = user3.getUid();
                    } else {
                        str = null;
                    }
                    dcA.LIZ(1, str);
                }
            }
        });
    }
}
