package com.bytedance.android.livesdk.interaction.poll.ui.progresseffect.widget;

import X.0CB;
import X.0CH;
import X.0b0;
import X.0cm;
import X.158;
import X.1jk;
import X.6Is;
import X.C1059Fv2;
import X.C1064Fv7;
import X.C2200GWb;
import X.C2479Gcq;
import X.C3491GtA;
import X.C4345HGo;
import X.C4453HKs;
import X.G3C;
import X.GMS;
import X.GT5;
import X.GTD;
import X.GTR;
import X.GTS;
import X.GW8;
import X.GWE;
import X.GWI;
import X.H7O;
import X.HFE;
import X.Lel;
import X.M12;
import X.QxX;
import android.os.CountDownTimer;
import android.view.ViewGroup;
import com.bytedance.android.live.gift.IGiftService;
import com.bytedance.android.livesdk.model.Gift;
import com.bytedance.android.livesdk.model.PollData;
import com.bytedance.android.livesdk.model.PollInfo;
import com.bytedance.android.livesdk.model.UserVoteInfo;
import com.bytedance.android.livesdk.model.message.PollEndContent;
import com.bytedance.android.livesdk.model.message.PollMessage;
import com.bytedance.android.livesdk.model.message.PollOptionInfo;
import com.bytedance.android.livesdk.model.message.PollStartContent;
import com.bytedance.android.livesdk.model.message.PollUpdateVotesContent;
import com.bytedance.android.livesdkapi.depend.model.live.Room;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannel;
import com.bytedance.ies.sdk.widgets.LiveRecyclableWidget;
import com.ss.ugc.live.sdk.message.data.IMessage;
import com.ss.ugc.live.sdk.message.interfaces.IMessageManager;
import com.ss.ugc.live.sdk.message.interfaces.OnMessageListener;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import kotlin.h.b.n;

public class LiveAbsPollEffectWidget extends LiveRecyclableWidget implements 6Is, OnMessageListener {
    public QxX LIZ;
    public 1jk LIZIZ;
    public PollStartContent LIZJ;
    public List<PollOptionInfo> LIZLLL;
    public PollMessage LJ;
    public boolean LJFF;
    public Room LJI;
    public boolean LJII;
    public long LJIIIIZZ;
    public long LJIIIZ;
    public int LJIIJ;
    public int LJIIJJI;
    public long LJIIL;
    public boolean LJIILIIL;
    public int LJIILJJIL;
    public final int LJIILL;
    public IMessageManager LJIILLIIL;
    public CountDownTimer LJIIZILJ;
    public boolean LJIJ;
    public boolean LJIJI;
    public final long LJIJJ;
    public final long LJIJJLI;
    public boolean LJIL;

    static {
        Covode.recordClassIndex(17300);
    }

    public LiveAbsPollEffectWidget(byte b) {
        this();
    }

    public void LIZ(int i) {
    }

    public void LJIILIIL() {
    }

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

    public final void LIZ(GTD gtd) {
        List<PollOptionInfo> list;
        HashMap hashMap;
        M12.LIZ(gtd);
        PollMessage pollMessage = new PollMessage();
        this.LJ = pollMessage;
        pollMessage.LIZ = 1;
        DataChannel dataChannel = this.dataChannel;
        PollData pollData = null;
        if (!(dataChannel == null || (hashMap = (HashMap) dataChannel.LIZIZ(HFE.class)) == null)) {
            pollData = (PollData) hashMap.get(Integer.valueOf(gtd.ordinal()));
        }
        PollMessage pollMessage2 = this.LJ;
        if (pollMessage2 != null) {
            pollMessage2.LIZIZ = pollData != null ? pollData.LIZIZ : 0;
        }
        PollMessage pollMessage3 = this.LJ;
        if (pollMessage3 != null) {
            pollMessage3.LJFF = Integer.valueOf(pollData != null ? pollData.LIZ : 0);
        }
        PollEndContent pollEndContent = new PollEndContent();
        if (pollData == null || (list = pollData.LJFF) == null) {
            list = Lel.INSTANCE;
        }
        pollEndContent.LIZIZ = list;
        PollMessage pollMessage4 = this.LJ;
        if (pollMessage4 != null) {
            pollMessage4.LIZLLL = pollEndContent;
        }
    }

    public /* synthetic */ LiveAbsPollEffectWidget() {
        this(0);
    }

    private final void LJIILJJIL() {
        QxX qxX = this.LIZ;
        if (qxX == null) {
            n.LIZ("");
        }
        qxX.setScaleSize(this.LJIIJJI);
    }

    public final void LJI() {
        CountDownTimer countDownTimer = this.LJIIZILJ;
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
        this.LJIL = false;
        this.LJIIIIZZ = -1;
        this.LJIIIZ = -1;
        this.LJIIL = -1;
        this.LJIJ = false;
        this.LJIJI = false;
        this.LJII = false;
        this.LJIILJJIL = 2;
        this.LJIIJJI = 0;
        this.LJIIJ = 0;
    }

    public void onUnload() {
        QxX qxX = this.LIZ;
        if (qxX == null) {
            n.LIZ("");
        }
        qxX.clearAnimation();
        LJI();
        this.LIZLLL = null;
        this.LJIILIIL = true;
    }

    public void LIZIZ() {
        1jk findViewById = findViewById(2131372219);
        n.LIZIZ(findViewById, "");
        this.LIZIZ = findViewById;
        this.LJIILLIIL = (IMessageManager) this.dataChannel.LIZIZ(C4345HGo.class);
        DataChannel dataChannel = this.dataChannel;
        if (dataChannel != null) {
            dataChannel.LIZ((0CH) this, C2479Gcq.class, new GTS(this));
        }
    }

    public void LIZJ() {
        Room room;
        boolean z;
        Boolean bool;
        DataChannel dataChannel = this.dataChannel;
        if (dataChannel != null) {
            room = (Room) dataChannel.LIZIZ(C1064Fv7.class);
        } else {
            room = null;
        }
        this.LJI = room;
        DataChannel dataChannel2 = this.dataChannel;
        if (dataChannel2 == null || (bool = (Boolean) dataChannel2.LIZIZ(C1059Fv2.class)) == null) {
            z = false;
        } else {
            z = bool.booleanValue();
        }
        this.LJFF = z;
        this.LJIILIIL = true;
    }

    public final void LJIIL() {
        if (this.LJIILL == 257 && !this.LJFF && !this.LJIJI) {
            this.LJIJI = true;
            GTR.LIZIZ.LIZ(this.LJ, this.LIZJ, this.LIZLLL, this.dataChannel, this.LJIILJJIL);
        }
    }

    public void LJII() {
        String str;
        long j;
        PollOptionInfo pollOptionInfo;
        PollOptionInfo pollOptionInfo2;
        PollOptionInfo pollOptionInfo3;
        PollOptionInfo pollOptionInfo4;
        List<PollOptionInfo> list = this.LIZLLL;
        if (list != null && list.size() > 1) {
            List<PollOptionInfo> list2 = this.LIZLLL;
            String str2 = null;
            if (list2 == null || (pollOptionInfo4 = list2.get(0)) == null) {
                str = null;
            } else {
                str = pollOptionInfo4.LIZIZ;
            }
            List<PollOptionInfo> list3 = this.LIZLLL;
            if (!(list3 == null || (pollOptionInfo3 = list3.get(1)) == null)) {
                str2 = pollOptionInfo3.LIZIZ;
            }
            QxX qxX = this.LIZ;
            if (qxX == null) {
                n.LIZ("");
            }
            if (str == null) {
                str = "1";
            }
            if (str2 == null) {
                str2 = "2";
            }
            qxX.LIZ(str, str2);
            List<PollOptionInfo> list4 = this.LIZLLL;
            long j2 = 0;
            if (list4 == null || (pollOptionInfo2 = list4.get(0)) == null) {
                j = 0;
            } else {
                j = pollOptionInfo2.LIZ;
            }
            List<PollOptionInfo> list5 = this.LIZLLL;
            if (!(list5 == null || (pollOptionInfo = list5.get(1)) == null)) {
                j2 = pollOptionInfo.LIZ;
            }
            LIZ(j, j2);
        }
    }

    public void LJIIJ() {
        LIZ(32.0f);
        LIZ(true);
        LIZ(0.6f, 0.6f);
        LIZIZ(QxX.LJ, QxX.LJFF);
        int i = this.LJIIJJI;
        if (i == 1) {
            LIZ(0b0.LIZIZ(2131100857), 0b0.LIZIZ(2131100854));
        } else if (i != 2) {
            LIZ(0b0.LIZIZ(2131100854), 0b0.LIZIZ(2131100854));
        } else {
            LIZ(0b0.LIZIZ(2131100854), 0b0.LIZIZ(2131100856));
        }
    }

    public final void LIZLLL() {
        long j;
        long j2;
        List<PollOptionInfo> list;
        boolean z;
        UserVoteInfo userVoteInfo;
        Integer valueOf;
        UserVoteInfo userVoteInfo2;
        PollData pollData;
        PollData pollData2;
        PollData pollData3;
        int i;
        PollData pollData4;
        long j3;
        PollData pollData5;
        PollData pollData6;
        Room room = this.LJI;
        if (room != null) {
            PollMessage pollMessage = new PollMessage();
            this.LJ = pollMessage;
            pollMessage.LIZ = 2;
            PollInfo pollInfo = room.advancedPollInfo;
            long j4 = 0;
            if (pollInfo == null || (pollData6 = pollInfo.LIZ) == null) {
                j = 0;
            } else {
                j = pollData6.LIZIZ;
            }
            GT5.LIZIZ = j;
            PollMessage pollMessage2 = this.LJ;
            if (pollMessage2 != null) {
                PollInfo pollInfo2 = room.advancedPollInfo;
                if (pollInfo2 == null || (pollData5 = pollInfo2.LIZ) == null) {
                    j3 = 0;
                } else {
                    j3 = pollData5.LIZIZ;
                }
                pollMessage2.LIZIZ = j3;
            }
            PollMessage pollMessage3 = this.LJ;
            int i2 = 0;
            if (pollMessage3 != null) {
                PollInfo pollInfo3 = room.advancedPollInfo;
                if (pollInfo3 == null || (pollData4 = pollInfo3.LIZ) == null) {
                    i = 0;
                } else {
                    i = pollData4.LIZ;
                }
                pollMessage3.LJFF = Integer.valueOf(i);
            }
            PollStartContent pollStartContent = new PollStartContent();
            PollInfo pollInfo4 = room.advancedPollInfo;
            if (pollInfo4 == null || (pollData3 = pollInfo4.LIZ) == null) {
                j2 = 0;
            } else {
                j2 = pollData3.LIZLLL;
            }
            pollStartContent.LIZ = j2;
            PollInfo pollInfo5 = room.advancedPollInfo;
            if (!(pollInfo5 == null || (pollData2 = pollInfo5.LIZ) == null)) {
                j4 = pollData2.LJ;
            }
            pollStartContent.LIZIZ = j4;
            PollMessage pollMessage4 = this.LJ;
            if (pollMessage4 != null) {
                pollMessage4.LIZJ = pollStartContent;
            }
            this.LIZJ = pollStartContent;
            PollUpdateVotesContent pollUpdateVotesContent = new PollUpdateVotesContent();
            PollInfo pollInfo6 = room.advancedPollInfo;
            if (pollInfo6 == null || (pollData = pollInfo6.LIZ) == null || (list = pollData.LJFF) == null) {
                list = Lel.INSTANCE;
            }
            pollUpdateVotesContent.LIZ = list;
            PollMessage pollMessage5 = this.LJ;
            if (pollMessage5 != null) {
                pollMessage5.LJ = pollUpdateVotesContent;
            }
            PollInfo pollInfo7 = room.advancedPollInfo;
            if (pollInfo7 == null || (userVoteInfo2 = pollInfo7.LIZIZ) == null) {
                z = false;
            } else {
                z = userVoteInfo2.LIZ;
            }
            this.LJIIJ = 0;
            if (z) {
                PollInfo pollInfo8 = room.advancedPollInfo;
                if (!(pollInfo8 == null || (userVoteInfo = pollInfo8.LIZIZ) == null || (valueOf = Integer.valueOf(userVoteInfo.LIZIZ)) == null)) {
                    if (valueOf.intValue() == 0) {
                        i2 = 1;
                    } else if (valueOf.intValue() == 1) {
                        i2 = 2;
                    }
                }
                this.LJIIJ = i2;
            }
        }
    }

    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r1v8, resolved type: com.bytedance.android.livesdk.model.message.PollStartContent} */
    /* JADX WARNING: type inference failed for: r1v0 */
    /* JADX WARNING: type inference failed for: r1v2, types: [java.util.List<com.bytedance.android.livesdk.model.message.PollOptionInfo>] */
    /* JADX WARNING: type inference failed for: r1v5, types: [java.util.List<com.bytedance.android.livesdk.model.message.PollOptionInfo>] */
    /* JADX WARNING: type inference failed for: r1v10 */
    /* JADX WARNING: type inference failed for: r1v11 */
    /* JADX WARNING: type inference failed for: r1v12 */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void LJ() {
        /*
            r10 = this;
            com.bytedance.android.livesdk.model.message.PollMessage r0 = r10.LJ
            r1 = 0
            if (r0 == 0) goto L_0x0010
            long r2 = r0.LIZ
            java.lang.Long r9 = java.lang.Long.valueOf(r2)
            r8 = 0
            r2 = 0
            if (r9 != 0) goto L_0x0023
        L_0x0010:
            X.H7O r0 = X.H7O.INSTANCE
            com.bytedance.android.livesdk.model.message.PollMessage r1 = r0.pollMessage
            if (r1 == 0) goto L_0x0022
            com.bytedance.android.livesdk.model.message.PollStartContent r0 = r1.LIZJ
            if (r0 != 0) goto L_0x0022
            com.bytedance.android.livesdk.model.message.PollStartContent r0 = r10.LIZJ
            r1.LIZJ = r0
            X.H7O r0 = X.H7O.INSTANCE
            r0.pollMessage = r1
        L_0x0022:
            return
        L_0x0023:
            long r4 = r9.longValue()
            int r0 = (r4 > r2 ? 1 : (r4 == r2 ? 0 : -1))
            if (r0 != 0) goto L_0x0047
            X.GT5.LIZJ = r8
            com.bytedance.android.livesdk.model.message.PollMessage r0 = r10.LJ
            if (r0 == 0) goto L_0x0045
            com.bytedance.android.livesdk.model.message.PollStartContent r0 = r0.LIZJ
            if (r0 == 0) goto L_0x0045
            java.util.List<com.bytedance.android.livesdk.model.message.PollOptionInfo> r0 = r0.LIZJ
        L_0x0037:
            r10.LIZLLL = r0
            com.bytedance.android.livesdk.model.message.PollMessage r0 = r10.LJ
            if (r0 == 0) goto L_0x003f
            com.bytedance.android.livesdk.model.message.PollStartContent r1 = r0.LIZJ
        L_0x003f:
            r10.LIZJ = r1
            r10.LJI()
            goto L_0x0010
        L_0x0045:
            r0 = r1
            goto L_0x0037
        L_0x0047:
            long r6 = r9.longValue()
            r4 = 2
            int r0 = (r6 > r4 ? 1 : (r6 == r4 ? 0 : -1))
            if (r0 != 0) goto L_0x0069
            r0 = 1
            X.GT5.LIZJ = r0
            com.bytedance.android.livesdk.model.message.PollMessage r0 = r10.LJ
            if (r0 == 0) goto L_0x005e
            com.bytedance.android.livesdk.model.message.PollUpdateVotesContent r0 = r0.LJ
            if (r0 == 0) goto L_0x005e
            java.util.List<com.bytedance.android.livesdk.model.message.PollOptionInfo> r1 = r0.LIZ
        L_0x005e:
            r10.LIZLLL = r1
            com.bytedance.android.livesdk.model.message.PollMessage r1 = r10.LJ
            if (r1 == 0) goto L_0x0010
            com.bytedance.android.livesdk.model.message.PollStartContent r0 = r10.LIZJ
            r1.LIZJ = r0
            goto L_0x0010
        L_0x0069:
            long r6 = r9.longValue()
            r4 = 1
            int r0 = (r6 > r4 ? 1 : (r6 == r4 ? 0 : -1))
            if (r0 != 0) goto L_0x0010
            X.GT5.LIZJ = r8
            com.bytedance.android.livesdk.model.message.PollMessage r0 = r10.LJ
            if (r0 == 0) goto L_0x007f
            com.bytedance.android.livesdk.model.message.PollEndContent r0 = r0.LIZLLL
            if (r0 == 0) goto L_0x007f
            java.util.List<com.bytedance.android.livesdk.model.message.PollOptionInfo> r1 = r0.LIZIZ
        L_0x007f:
            r10.LIZLLL = r1
            com.bytedance.android.livesdk.model.message.PollMessage r1 = r10.LJ
            if (r1 == 0) goto L_0x0089
            com.bytedance.android.livesdk.model.message.PollStartContent r0 = r10.LIZJ
            r1.LIZJ = r0
        L_0x0089:
            com.bytedance.android.livesdk.model.message.PollMessage r0 = r10.LJ
            if (r0 == 0) goto L_0x0093
            com.bytedance.android.livesdkapi.message.CommonMessageData r0 = r0.LJJJJ
            if (r0 == 0) goto L_0x0093
            long r2 = r0.LIZ
        L_0x0093:
            r10.LJIIL = r2
            com.bytedance.android.livesdk.model.message.PollMessage r0 = r10.LJ
            if (r0 == 0) goto L_0x00a3
            com.bytedance.android.livesdk.model.message.PollEndContent r0 = r0.LIZLLL
            if (r0 == 0) goto L_0x00a3
            int r0 = r0.LIZ
        L_0x009f:
            r10.LJIILJJIL = r0
            goto L_0x0010
        L_0x00a3:
            r0 = 2
            goto L_0x009f
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.livesdk.interaction.poll.ui.progresseffect.widget.LiveAbsPollEffectWidget.LJ():void");
    }

    public final void LJFF() {
        PollStartContent pollStartContent;
        PollStartContent pollStartContent2;
        PollEndContent pollEndContent;
        PollMessage pollMessage = this.LJ;
        if (pollMessage == null || pollMessage.LIZ != 1) {
            PollMessage pollMessage2 = this.LJ;
            long j = 0;
            if (pollMessage2 == null || pollMessage2.LIZ != 0) {
                PollMessage pollMessage3 = this.LJ;
                if (pollMessage3 != null && pollMessage3.LIZ == 2) {
                    PollMessage pollMessage4 = this.LJ;
                    if (!(pollMessage4 == null || (pollStartContent = pollMessage4.LIZJ) == null)) {
                        j = pollStartContent.LIZIZ;
                    }
                    if (j > GMS.LIZ()) {
                        LIZ((j - GMS.LIZ()) + this.LJIJJLI, true);
                    }
                    if (this.LJIILIIL) {
                        LJIIIIZZ();
                        this.LJIILIIL = false;
                        return;
                    }
                    return;
                }
                return;
            }
            LJIIIIZZ();
            PollMessage pollMessage5 = this.LJ;
            if (!(pollMessage5 == null || (pollStartContent2 = pollMessage5.LIZJ) == null)) {
                j = pollStartContent2.LIZIZ;
            }
            if (j > GMS.LIZ()) {
                LIZ((j - GMS.LIZ()) + this.LJIJJLI, true);
                return;
            }
            return;
        }
        LJIIIZ();
        PollMessage pollMessage6 = this.LJ;
        if (!(pollMessage6 == null || (pollEndContent = pollMessage6.LIZLLL) == null || pollEndContent.LIZ == 0)) {
            CountDownTimer countDownTimer = this.LJIIZILJ;
            if (countDownTimer != null) {
                countDownTimer.cancel();
            }
            this.LJIL = false;
        }
        LIZ(this.LJIJJLI, false);
        LJIIL();
        long j2 = GTR.LIZ;
        PollMessage pollMessage7 = this.LJ;
        if (pollMessage7 == null || j2 != pollMessage7.LIZIZ) {
            LJIILIIL();
        }
    }

    public void LJIIIIZZ() {
        switch (this.LJIILL) {
            case 257:
                LIZ(28.0f);
                LIZ(false);
                LIZ(2131235132);
                int i = QxX.LJI;
                LIZIZ(i, i);
                LIZ(0b0.LIZIZ(2131100850), 0b0.LIZIZ(2131100857), 0b0.LIZIZ(2131100856), 0b0.LIZIZ(2131100849));
                int i2 = this.LJIIJ;
                if (i2 != 1) {
                    if (i2 == 2) {
                        LIZ(0.4f, 1.0f);
                        break;
                    } else {
                        LIZ(0.6f, 0.6f);
                        break;
                    }
                } else {
                    LIZ(1.0f, 0.4f);
                    break;
                }
            case 258:
                LIZ(32.0f);
                LIZ(true);
                LIZ(0.6f, 0.6f);
                LIZ(2131235132);
                LIZIZ(QxX.LJ, QxX.LJFF);
                LIZ(0b0.LIZIZ(2131100857), 0b0.LIZIZ(2131100856));
                break;
            case 259:
                LJIIJ();
                break;
        }
        LJII();
    }

    public void LJIIIZ() {
        long j;
        long j2;
        long j3;
        int i;
        PollOptionInfo pollOptionInfo;
        PollOptionInfo pollOptionInfo2;
        PollOptionInfo pollOptionInfo3;
        PollOptionInfo pollOptionInfo4;
        List<PollOptionInfo> list = this.LIZLLL;
        if (list != null && list.size() > 1) {
            List<PollOptionInfo> list2 = this.LIZLLL;
            long j4 = 0;
            if (list2 == null || (pollOptionInfo4 = list2.get(0)) == null) {
                j = 0;
            } else {
                j = pollOptionInfo4.LIZ;
            }
            List<PollOptionInfo> list3 = this.LIZLLL;
            if (list3 == null || (pollOptionInfo3 = list3.get(1)) == null) {
                j2 = 0;
            } else {
                j2 = pollOptionInfo3.LIZ;
            }
            if (j > j2) {
                i = 1;
            } else {
                List<PollOptionInfo> list4 = this.LIZLLL;
                if (list4 == null || (pollOptionInfo2 = list4.get(0)) == null) {
                    j3 = 0;
                } else {
                    j3 = pollOptionInfo2.LIZ;
                }
                List<PollOptionInfo> list5 = this.LIZLLL;
                if (!(list5 == null || (pollOptionInfo = list5.get(1)) == null)) {
                    j4 = pollOptionInfo.LIZ;
                }
                if (j3 < j4) {
                    i = 2;
                } else {
                    i = 0;
                }
            }
            this.LJIIJJI = i;
        }
        switch (this.LJIILL) {
            case 257:
                LIZ(28.0f);
                LIZ(false);
                LIZ(2131235132);
                int i2 = QxX.LJI;
                LIZIZ(i2, i2);
                LJIILJJIL();
                int i3 = this.LJIIJJI;
                if (i3 != 1) {
                    if (i3 == 2) {
                        LIZ(0b0.LIZIZ(2131100848), 0b0.LIZIZ(2131100855), 0b0.LIZIZ(2131100856), 0b0.LIZIZ(2131100849));
                        LIZ(0.4f, 1.0f);
                        break;
                    } else {
                        LIZ(0b0.LIZIZ(2131100850), 0b0.LIZIZ(2131100857), 0b0.LIZIZ(2131100856), 0b0.LIZIZ(2131100849));
                        LIZ(1.0f, 1.0f);
                        break;
                    }
                } else {
                    LIZ(0b0.LIZIZ(2131100850), 0b0.LIZIZ(2131100857), 0b0.LIZIZ(2131100855), 0b0.LIZIZ(2131100848));
                    LIZ(1.0f, 0.4f);
                    break;
                }
            case 258:
                LJIILJJIL();
                break;
            case 259:
                break;
        }
        LJIIJ();
        LJII();
    }

    public final void LJIIJJI() {
        Integer num;
        Long l;
        Long l2;
        Gift gift;
        Gift gift2;
        if (this.LJIILL == 257 && !this.LJIJ && !this.LJFF) {
            PollMessage pollMessage = this.LJ;
            DataChannel dataChannel = this.dataChannel;
            HashMap hashMap = new HashMap();
            IGiftService LIZ2 = 0cm.LIZ(IGiftService.class);
            n.LIZIZ(LIZ2, "");
            GWE pollGifts = LIZ2.getPollGifts();
            Long l3 = null;
            if (pollMessage != null) {
                num = pollMessage.LJFF;
            } else {
                num = null;
            }
            if (num != null && num.intValue() == 0) {
                hashMap.put("poll_type", "normal_poll");
            } else {
                hashMap.put("poll_type", "gift_poll");
                if (pollGifts == null || (gift2 = pollGifts.LIZ) == null) {
                    l = null;
                } else {
                    l = Long.valueOf(gift2.LIZLLL);
                }
                hashMap.put("gift_1_id", String.valueOf(l));
                if (pollGifts == null || (gift = pollGifts.LIZIZ) == null) {
                    l2 = null;
                } else {
                    l2 = Long.valueOf(gift.LIZLLL);
                }
                hashMap.put("gift_2_id", String.valueOf(l2));
            }
            C3491GtA LIZ3 = C3491GtA.LJFF.LIZ("livesdk_poll_effect_show");
            if (pollMessage != null) {
                l3 = Long.valueOf(pollMessage.LIZIZ);
            }
            LIZ3.LIZ("poll_id", (Number) l3);
            LIZ3.LIZ(dataChannel);
            LIZ3.LIZ((Map<String, String>) hashMap);
            LIZ3.LIZLLL();
            this.LJIJ = true;
        }
    }

    public final QxX LIZ() {
        QxX qxX = this.LIZ;
        if (qxX == null) {
            n.LIZ("");
        }
        return qxX;
    }

    public void onInit(Object[] objArr) {
        LIZIZ();
    }

    public final void LIZ(QxX qxX) {
        M12.LIZ(qxX);
        this.LIZ = qxX;
    }

    public LiveAbsPollEffectWidget(int i) {
        this.LJIILL = i;
        this.LJIIIIZZ = -1;
        this.LJIIIZ = -1;
        this.LJIJJ = 3000;
        this.LJIJJLI = 5000;
        this.LJIIL = -1;
        this.LJIILIIL = true;
        this.LJIILJJIL = 2;
    }

    public void onLoad(Object[] objArr) {
        158.POLL.load(this.dataChannel, new G3C());
        IMessageManager iMessageManager = this.LJIILLIIL;
        if (iMessageManager != null) {
            iMessageManager.addMessageListener(C4453HKs.LIVE_POLL_MESSAGE.getIntType(), this);
        }
        LIZJ();
        hide();
        if (this.LJIILL == 257) {
            QxX qxX = this.LIZ;
            if (qxX == null) {
                n.LIZ("");
            }
            qxX.postDelayed(new C2200GWb(this), this.LJIJJ);
            return;
        }
        LJ();
    }

    public void onMessage(IMessage iMessage) {
        long j;
        Integer num;
        if (iMessage instanceof PollMessage) {
            PollMessage pollMessage = (PollMessage) iMessage;
            Integer num2 = pollMessage.LJFF;
            if ((num2 != null && num2.intValue() == 1) || ((num = pollMessage.LJFF) != null && num.intValue() == 0)) {
                long j2 = pollMessage.LJJJJ.LIZ / 1000;
                Room room = this.LJI;
                if (room != null) {
                    j = room.nowTime;
                } else {
                    j = 0;
                }
                if (j2 >= j) {
                    GT5.LIZIZ = pollMessage.LIZIZ;
                    this.LJ = pollMessage;
                    LJ();
                }
            }
        }
    }

    public final void LIZIZ(GTD gtd) {
        HashMap hashMap;
        PollData pollData;
        PollInfo pollInfo;
        M12.LIZ(gtd);
        DataChannel dataChannel = this.dataChannel;
        if (dataChannel != null && (hashMap = (HashMap) dataChannel.LIZIZ(HFE.class)) != null && (pollData = (PollData) hashMap.get(Integer.valueOf(gtd.ordinal()))) != null) {
            n.LIZIZ(pollData, "");
            Room room = this.LJI;
            if (room != null) {
                room.advancedPollInfo = new PollInfo();
            }
            Room room2 = this.LJI;
            if (!(room2 == null || (pollInfo = room2.advancedPollInfo) == null)) {
                pollInfo.LIZ = pollData;
            }
            GT5.LIZIZ = pollData.LIZIZ;
            PollMessage pollMessage = this.LJ;
            if (pollMessage != null) {
                pollMessage.LIZIZ = pollData.LIZIZ;
            }
            PollMessage pollMessage2 = this.LJ;
            if (pollMessage2 != null) {
                pollMessage2.LJFF = Integer.valueOf(pollData.LIZ);
            }
            PollStartContent pollStartContent = new PollStartContent();
            pollStartContent.LIZ = pollData.LIZLLL;
            pollStartContent.LIZIZ = pollData.LJ;
            PollMessage pollMessage3 = this.LJ;
            if (pollMessage3 != null) {
                pollMessage3.LIZJ = pollStartContent;
            }
            this.LIZJ = pollStartContent;
            PollUpdateVotesContent pollUpdateVotesContent = new PollUpdateVotesContent();
            pollUpdateVotesContent.LIZ = pollData.LJFF;
            PollMessage pollMessage4 = this.LJ;
            if (pollMessage4 != null) {
                pollMessage4.LJ = pollUpdateVotesContent;
            }
            H7O.INSTANCE.pollMessage = this.LJ;
        }
    }

    private final void LIZ(boolean z) {
        QxX qxX = this.LIZ;
        if (qxX == null) {
            n.LIZ("");
        } else {
            qxX.setDrawRadius(z);
        }
    }

    public void LIZ(float f) {
        QxX qxX = this.LIZ;
        if (qxX == null) {
            n.LIZ("");
        }
        ViewGroup.LayoutParams layoutParams = qxX.getLayoutParams();
        layoutParams.height = 0b0.LIZ(f);
        if (this.LJIILL == 257) {
            layoutParams.width = 0b0.LIZ(214.0f);
        } else {
            layoutParams.width = -1;
        }
        QxX qxX2 = this.LIZ;
        if (qxX2 == null) {
            n.LIZ("");
        }
        qxX2.setLayoutParams(layoutParams);
    }

    private final void LIZ(float f, float f2) {
        QxX qxX = this.LIZ;
        if (qxX == null) {
            n.LIZ("");
        }
        qxX.LIZ(f, f2);
    }

    private final void LIZIZ(int i, int i2) {
        QxX qxX = this.LIZ;
        if (qxX == null) {
            n.LIZ("");
        }
        qxX.LIZIZ(i, i2);
    }

    private void LIZ(int i, int i2) {
        QxX qxX = this.LIZ;
        if (qxX == null) {
            n.LIZ("");
        }
        qxX.LIZ(i, i2);
    }

    private final void LIZIZ(long j, boolean z) {
        long j2 = j;
        GW8 gw8 = new GW8(this, z, j2, j2);
        this.LJIIZILJ = gw8;
        gw8.start();
        this.LJIL = true;
    }

    private final void LIZ(long j, boolean z) {
        if (!this.LJIL && j > 0) {
            LIZIZ(j, z);
            CountDownTimer countDownTimer = this.LJIIZILJ;
            if (countDownTimer != null) {
                countDownTimer.start();
            }
        }
    }

    public void LIZ(long j, long j2) {
        long j3 = j;
        long j4 = j2;
        if (j3 > this.LJIIIIZZ || j4 > this.LJIIIZ) {
            this.LJIIIIZZ = j3;
            this.LJIIIZ = j4;
            QxX qxX = this.LIZ;
            if (qxX == null) {
                n.LIZ("");
            }
            qxX.LIZ(j3, j4);
            QxX qxX2 = this.LIZ;
            if (qxX2 == null) {
                n.LIZ("");
            }
            qxX2.post(new GWI(this, j3, j4));
        }
    }

    private final void LIZ(int i, int i2, int i3, int i4) {
        QxX qxX = this.LIZ;
        if (qxX == null) {
            n.LIZ("");
        }
        qxX.LIZ(i, i2, i3, i4);
    }
}
