package com.bytedance.android.livesdk.chatroom.ui;

import X.05h;
import X.08X;
import X.08o;
import X.0AA;
import X.0GV;
import X.0GZ;
import X.0HH;
import X.0SC;
import X.0Zv;
import X.0Zy;
import X.0Zz;
import X.0b0;
import X.0bM;
import X.0c0;
import X.0cm;
import X.0dA;
import X.0dK;
import X.0eg;
import X.15V;
import X.1IL;
import X.1IN;
import X.1JL;
import X.1hK;
import X.1j7;
import X.1j9;
import X.2M2;
import X.C0850Thi;
import X.C0854Thm;
import X.C0859Thr;
import X.C0870Ti2;
import X.C0878TiA;
import X.C0883TiF;
import X.C0884TiG;
import X.C0893TiP;
import X.C0897TiT;
import X.C0903TiZ;
import X.C0904Tia;
import X.C0905Tib;
import X.C0906Tic;
import X.C0912Tii;
import X.Fbl;
import X.Fjp;
import X.FkL;
import X.Fz8;
import X.Fzd;
import X.G5d;
import X.GSF;
import X.Gg0;
import X.Ggr;
import X.GhW;
import X.Ght;
import X.GpU;
import X.HeD;
import X.HxC;
import X.Szz;
import X.T0N;
import X.T1A;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.ColorStateList;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.Editable;
import android.text.InputFilter;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.DialogFragment;
import com.bytedance.android.live.base.model.emoji.EmoteModel;
import com.bytedance.android.livesdk.chatroom.model.InputAttrs;
import com.bytedance.android.livesdk.chatroom.utils.EmoteFixTextHelper;
import com.bytedance.android.livesdk.livesetting.comment.EnableLiveKeyboardWithHeightSetting;
import com.bytedance.android.livesdk.livesetting.comment.LiveCommentInputDialogDismissFixSetting;
import com.bytedance.android.livesdk.livesetting.comment.LiveInputDialogAnimationSetting;
import com.bytedance.android.livesdkapi.host.IHostEmoji;
import com.bytedance.covode.number.Covode;
import com.bytedance.fresco.nativeheif.BuildConfig;
import com.bytedance.ies.sdk.datachannel.DataChannel;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;

public class LiveEmojiInputDialogV6Fragment extends DialogFragment implements 0Zy, 0Zz, GhW {
    public boolean LIZ;
    public C0884TiG LIZIZ;
    public C0904Tia LIZJ;
    public boolean LIZLLL;
    public boolean LJ;
    public 0eg LJFF = 0eg.Keyboard;
    public 0eg LJI = 0eg.Keyboard;
    public InputFilter LJII;
    public boolean LJIIIIZZ;
    public boolean LJIIIZ;
    public String LJIIJ;
    public ImageView LJIIJJI;
    public ImageView LJIIL;
    public ImageView LJIILIIL;
    public Fbl LJIILJJIL;
    public TextView LJIILL;
    public View LJIILLIIL;
    public View LJIIZILJ;
    public View LJIJ;
    public C0905Tib LJIJI;
    public T1A LJIJJ;
    public 0GZ LJIJJLI;
    public ViewGroup LJIL;
    public 0SC LJJ;
    public EmoteFixTextHelper LJJI;
    public EmoteFixTextHelper LJJIFFI;
    public 1IL LJJII;
    public int LJJIII;
    public int LJJIIJ;
    public int LJJIIJZLJL;
    public int LJJIIZ;
    public boolean LJJIIZI;
    public int LJJIJ;
    public int LJJIJIIJI = 32;
    public int LJJIJIIJIL = 8;
    public int LJJIJIL = 6;
    public boolean LJJIJL;
    public boolean LJJIJLIJ = true;
    public boolean LJJIL;
    public boolean LJJIZ;
    public final 1j9 LJJJ = new 1j9() {
        static {
            Covode.recordClassIndex(14010);
        }

        public final void LIZ(0SC r1) {
        }

        public final void LIZ() {
            LiveEmojiInputDialogV6Fragment.this.LIZIZ();
        }

        public final void LIZLLL() {
            LiveEmojiInputDialogV6Fragment.this.LJII();
        }

        public final void LIZIZ() {
            LiveEmojiInputDialogV6Fragment.this.LJIILJJIL.dispatchKeyEvent(new KeyEvent(0, 67));
        }

        public final boolean LIZJ() {
            return TextUtils.isEmpty(LiveEmojiInputDialogV6Fragment.this.LJIIJ);
        }

        public final void LIZ(1JL r5) {
            int i;
            if (r5 != null && r5.LIZ != null && LiveEmojiInputDialogV6Fragment.this.LJIILJJIL != null && LiveEmojiInputDialogV6Fragment.this.LJIILJJIL.getText() != null) {
                int LIZJ = LiveEmojiInputDialogV6Fragment.this.LJJI.LIZJ() + r5.LIZ.length();
                if (LiveEmojiInputDialogV6Fragment.this.LJIIIIZZ) {
                    i = 15;
                } else {
                    i = 100;
                }
                if (LIZJ > i) {
                    Fz8.LIZ(0b0.LJ(), LiveEmojiInputDialogV6Fragment.this.getString(2131828455), 0);
                } else if (!TextUtils.isEmpty(r5.LIZ)) {
                    int selectionStart = LiveEmojiInputDialogV6Fragment.this.LJIILJJIL.getSelectionStart();
                    Editable text = LiveEmojiInputDialogV6Fragment.this.LJIILJJIL.getText();
                    LiveEmojiInputDialogV6Fragment.this.LJJIJL = true;
                    text.insert(selectionStart, r5.LIZ);
                    LiveEmojiInputDialogV6Fragment.this.LJJIJL = false;
                    if (!LiveEmojiInputDialogV6Fragment.this.LJJIJL) {
                        LiveEmojiInputDialogV6Fragment.this.LJJI.LIZ(selectionStart, r5.LIZ);
                    }
                }
            }
        }
    };
    public final List<0SC> LJJJI = new ArrayList();
    public C0854Thm LJJJIL;
    public int LJJJJ;
    public boolean LJJJJI;
    public String LJJJJIZL;
    public boolean LJJJJJ;
    public boolean LJJJJJL;
    public boolean LJJJJL;
    public boolean LJJJJLI;
    public boolean LJJJJLL;
    public 0Zv LJJJJZ;
    public ValueAnimator LJJJJZI;
    public T0N LJJJLIIL;
    public LinearLayout LJJJLL;
    public ViewGroup LJJJLZIJ;
    public EmoteFixTextHelper LJJJZ;
    public 1IN LJJL;
    public long LJJLI;
    public boolean LJJLIIIIJ;
    public boolean LJJLIIIJ;
    public boolean LJJLIIIJILLIZJL;
    public final View.OnClickListener LJJLIIIJJI = new C0859Thr(this);
    public final TextWatcher LJJLIIIJJIZ = new TextWatcher() {
        public int LIZ = -1;
        public int LIZIZ = -1;
        public int LIZJ = -1;
        public int LIZLLL = -1;
        public boolean LJ;

        static {
            Covode.recordClassIndex(14009);
        }

        public final void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        public final void afterTextChanged(Editable editable) {
            String obj;
            int i;
            if (LiveEmojiInputDialogV6Fragment.this.LIZ && LiveEmojiInputDialogV6Fragment.this.LJIILJJIL != null) {
                Editable text = LiveEmojiInputDialogV6Fragment.this.LJIILJJIL.getText();
                LiveEmojiInputDialogV6Fragment liveEmojiInputDialogV6Fragment = LiveEmojiInputDialogV6Fragment.this;
                if (text == null) {
                    obj = BuildConfig.VERSION_NAME;
                } else {
                    obj = text.toString();
                }
                liveEmojiInputDialogV6Fragment.LJIIJ = obj;
                boolean isEmpty = TextUtils.isEmpty(LiveEmojiInputDialogV6Fragment.this.LJIIJ);
                if (isEmpty) {
                    LiveEmojiInputDialogV6Fragment.this.LJIILL.setVisibility(0);
                    LiveEmojiInputDialogV6Fragment.this.LJIILIIL.setClickable(false);
                } else {
                    LiveEmojiInputDialogV6Fragment.this.LJIILL.setVisibility(8);
                    if (!LiveEmojiInputDialogV6Fragment.this.LJJIIZI && LiveEmojiInputDialogV6Fragment.this.LIZIZ != null) {
                        LiveEmojiInputDialogV6Fragment.this.LJJIIZI = true;
                        LiveEmojiInputDialogV6Fragment.this.LIZIZ.LIZIZ();
                    }
                    LiveEmojiInputDialogV6Fragment.this.LJIILIIL.setClickable(true);
                }
                LiveEmojiInputDialogV6Fragment.this.LIZIZ(isEmpty);
                int i2 = this.LIZJ;
                if (i2 != -1) {
                    int i3 = this.LIZLLL;
                    this.LIZJ = -1;
                    this.LIZLLL = -1;
                    text.delete(i2, i3 + i2);
                    return;
                }
                int LIZJ2 = LiveEmojiInputDialogV6Fragment.this.LJJI.LIZJ();
                int i4 = 15;
                if (LiveEmojiInputDialogV6Fragment.this.LJIIIIZZ) {
                    i = 15;
                } else {
                    i = 100;
                }
                if (LIZJ2 > i) {
                    LiveEmojiInputDialogV6Fragment.this.LJII = Szz.LIZ.LIZ(LiveEmojiInputDialogV6Fragment.this.LJIILJJIL, LiveEmojiInputDialogV6Fragment.this.LJIIJ.length());
                } else {
                    LiveEmojiInputDialogV6Fragment.this.LJII = Szz.LIZ.LIZ(LiveEmojiInputDialogV6Fragment.this.LJIILJJIL, LiveEmojiInputDialogV6Fragment.this.LJII);
                }
                if (!LiveEmojiInputDialogV6Fragment.this.LJIIIIZZ) {
                    i4 = 100;
                }
                if (LIZJ2 > i4) {
                    this.LJ = false;
                    Fz8.LIZ(0b0.LJ(), LiveEmojiInputDialogV6Fragment.this.getString(2131828455), 0);
                    text.delete(LiveEmojiInputDialogV6Fragment.this.LJJI.LIZLLL, LiveEmojiInputDialogV6Fragment.this.LJJI.LIZLLL + LiveEmojiInputDialogV6Fragment.this.LJJI.LJ);
                    try {
                        LiveEmojiInputDialogV6Fragment.this.LJIILJJIL.setSelection(LiveEmojiInputDialogV6Fragment.this.LJJI.LIZLLL);
                    } catch (Exception e) {
                        HashMap hashMap = new HashMap();
                        hashMap.put("error", e.getMessage());
                        0c0.LIZ("ttlive_emoji_fragment_error", 1, hashMap);
                    }
                } else if (!LiveEmojiInputDialogV6Fragment.this.LJJIL && this.LJ && !LiveEmojiInputDialogV6Fragment.this.LJJIJL) {
                    this.LJ = false;
                    int i5 = this.LIZ;
                    if (i5 < this.LIZIZ + i5 && LiveEmojiInputDialogV6Fragment.this.LJIIJ.length() >= this.LIZ + this.LIZIZ && text.length() >= this.LIZ + this.LIZIZ) {
                        String str = LiveEmojiInputDialogV6Fragment.this.LJIIJ;
                        int i6 = this.LIZ;
                        String replace = str.substring(i6, this.LIZIZ + i6).replace(65532, ' ');
                        int i7 = this.LIZ;
                        text.replace(i7, this.LIZIZ + i7, replace);
                    }
                }
                LiveEmojiInputDialogV6Fragment.this.LJJJ.LIZ(LiveEmojiInputDialogV6Fragment.this.LJJII);
            }
        }

        public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            if (!LiveEmojiInputDialogV6Fragment.this.LJJIJL) {
                if (i2 != 0) {
                    LiveEmojiInputDialogV6Fragment.this.LJJI.LIZ(i, i2 + i);
                }
                if (i3 != 0) {
                    if (!(LiveEmojiInputDialogV6Fragment.this.LJI == 0eg.Keyboard || !(LiveEmojiInputDialogV6Fragment.this.LJJ instanceof 1IN) || charSequence.charAt(i) == 65532)) {
                        this.LIZJ = i;
                        this.LIZLLL = i3;
                    }
                    LiveEmojiInputDialogV6Fragment.this.LJJI.LIZLLL = i;
                    LiveEmojiInputDialogV6Fragment.this.LJJI.LJ = i3;
                    for (int i4 = i; i4 < i + i3; i4++) {
                        if (charSequence.charAt(i4) != 65532 || LiveEmojiInputDialogV6Fragment.this.LJJIJLIJ) {
                            LiveEmojiInputDialogV6Fragment.this.LJJI.LIZ(i4, charSequence.subSequence(i4, i4 + 1));
                        }
                    }
                }
                if (!LiveEmojiInputDialogV6Fragment.this.LJJIL && i3 != 0) {
                    int i5 = i;
                    while (true) {
                        if (i5 >= i + i3) {
                            break;
                        } else if (charSequence.charAt(i5) == 65532) {
                            this.LJ = true;
                            break;
                        } else {
                            i5++;
                        }
                    }
                    this.LIZ = i;
                    this.LIZIZ = i3;
                }
                LiveEmojiInputDialogV6Fragment.this.LJJIJLIJ = true;
            }
        }
    };

    static {
        Covode.recordClassIndex(14005);
    }

    public final void LIZJ() {
        this.LJJJJLL = true;
    }

    public final void LIZ(boolean z, int i) {
        if (z) {
            this.LJJLI = SystemClock.uptimeMillis();
            if (this.LJFF != 0eg.Keyboard) {
                this.LJFF = 0eg.Keyboard;
            }
            Ght.LIZ("Open keyboard");
            this.LIZLLL = true;
            this.LJIIJJI.setImageResource(2131234679);
            if (this.LJJIJ == 2) {
                this.LJIIL.setImageResource(2131234680);
            }
            this.LJJJLL.setVisibility(8);
            this.LJIJI = new C0905Tib(i, LJIIL(), true);
            Gg0.LIZ().LIZ(this.LJIJI);
        } else if (this.LJFF == 0eg.Panel) {
            this.LJJJJZ.setVisibility(0);
            if (this.LJJJLL.getVisibility() != 0) {
                this.LJJJLL.setVisibility(0);
                LIZ((ViewGroup) this.LJJJLL);
            }
            this.LJIJI = new C0905Tib(this.LJJIIZ, LJIIL(), true);
            Gg0.LIZ().LIZ(this.LJIJI);
        } else {
            Ght.LIZ("close keyboard");
            if (!LiveCommentInputDialogDismissFixSetting.getValue().LIZ || SystemClock.uptimeMillis() - this.LJJLI >= LiveCommentInputDialogDismissFixSetting.getValue().LIZIZ) {
                LJFF();
            } else {
                Ght.LIZ("Unexpected close keyboard");
            }
        }
    }

    public final void LIZ(boolean z, int i, int i2) {
        int measuredHeight;
        int LIZLLL2;
        int LIZ2;
        int i3 = i2;
        if (z) {
            int i4 = i;
            if (!this.LIZLLL) {
                this.LJIJI = new C0905Tib(i4, LJIIL(), true, (byte) 0);
                Gg0.LIZ().LIZ(this.LJIJI);
                this.LJJLI = SystemClock.uptimeMillis();
            }
            this.LIZLLL = true;
            if (this.LJFF != 0eg.Keyboard) {
                this.LJFF = 0eg.Keyboard;
            }
            if (this.LJJIIJ != i4) {
                this.LJJIIJ = i4;
            }
            Ght.LIZ("Open keyboard");
            if (this.LJJ == null || this.LJJJLL.getVisibility() != 0) {
                LIZ((-i3) - this.LJIIZILJ.getMeasuredHeight());
                Gg0 LIZ3 = Gg0.LIZ();
                int i5 = this.LJJIIJ;
                LIZ3.LIZ(new C0906Tic(i3, i5, i5, (byte) 0));
            } else if (!this.LJJLIIIJ) {
                final float translationY = this.LJIILLIIL.getTranslationY();
                ValueAnimator valueAnimator = this.LJJJJZI;
                if (valueAnimator != null) {
                    valueAnimator.cancel();
                }
                ValueAnimator duration = ValueAnimator.ofFloat(new float[]{0.0f, 1.0f}).setDuration(100);
                this.LJJJJZI = duration;
                this.LJJLIIIJ = true;
                duration.setInterpolator(new DecelerateInterpolator());
                final int i6 = i4 - this.LJJIIZ;
                this.LJIJI = new C0905Tib(i6, LJIIL(), true, (byte) 0);
                Gg0.LIZ().LIZ(this.LJIJI);
                this.LJJJJZI.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                    static {
                        Covode.recordClassIndex(14011);
                    }

                    public final void onAnimationUpdate(ValueAnimator valueAnimator) {
                        int animatedFraction = (int) (translationY - (valueAnimator.getAnimatedFraction() * ((float) i6)));
                        LiveEmojiInputDialogV6Fragment.this.LIZ(animatedFraction);
                        Gg0.LIZ().LIZ(new C0906Tic(-(animatedFraction + LiveEmojiInputDialogV6Fragment.this.LJIIZILJ.getMeasuredHeight()), LiveEmojiInputDialogV6Fragment.this.LJJIIJ, LiveEmojiInputDialogV6Fragment.this.LJJIIJ));
                    }
                });
                this.LJJJJZI.start();
            }
            this.LJIIJJI.setImageResource(2131234679);
            if (this.LJJIJ == 2) {
                this.LJIIL.setImageResource(2131234680);
            }
            if (i3 == i4) {
                this.LJJLIIIJ = false;
                this.LJJJLL.setVisibility(8);
            }
        } else if (this.LJFF == 0eg.Panel) {
            if (this.LJJIJ != 2) {
                this.LJIIJJI.setImageResource(2131234681);
            }
            if (this.LJJJLL.getVisibility() != 0) {
                this.LJJJLL.setVisibility(0);
                LIZ((ViewGroup) this.LJJJLL);
                if (this.LJJIJ == 1) {
                    LIZLLL2 = (this.LJJIIJ - 0b0.LIZLLL(2131166128)) - 0b0.LIZLLL(2131166131);
                    LIZ2 = 0b0.LIZ(1.0f);
                } else {
                    LIZLLL2 = this.LJJIIJ - 0b0.LIZLLL(2131166128);
                    LIZ2 = 0b0.LIZ(1.0f);
                }
                int i7 = LIZLLL2 - LIZ2;
                ValueAnimator valueAnimator2 = this.LJJJJZI;
                if (valueAnimator2 != null) {
                    valueAnimator2.cancel();
                }
                this.LJIJI = new C0905Tib(i7, LJIIL(), true, (byte) 0);
                Gg0.LIZ().LIZ(this.LJIJI);
                ValueAnimator duration2 = ValueAnimator.ofFloat(new float[]{0.0f, 1.0f}).setDuration(100);
                this.LJJJJZI = duration2;
                duration2.setInterpolator(new DecelerateInterpolator());
                this.LJJJJZI.addUpdateListener(new C0893TiP(this, i7));
                this.LJJJJZI.start();
            }
        } else if (!LiveCommentInputDialogDismissFixSetting.getValue().LIZ || SystemClock.uptimeMillis() - this.LJJLI >= LiveCommentInputDialogDismissFixSetting.getValue().LIZIZ) {
            if (this.LJJIIJ < i3) {
                this.LJJIIJ = i3;
            }
            if (this.LIZLLL) {
                Gg0 LIZ4 = Gg0.LIZ();
                int i8 = this.LJJIIJ;
                LIZ4.LIZ(new C0906Tic(i8, i8, 0, false, true));
            } else {
                Gg0.LIZ().LIZ(new C0906Tic(i3, this.LJJIIJ, 0, (byte) 0));
            }
            this.LIZLLL = false;
            float f = (float) i3;
            float f2 = f / (((float) this.LJJIIJ) * 1.0f);
            if (f2 < 0.3f) {
                measuredHeight = (int) (((float) (-(i3 + this.LJIIZILJ.getMeasuredHeight()))) * f2);
            } else {
                measuredHeight = (-i3) - this.LJIIZILJ.getMeasuredHeight();
            }
            if (f == 1.0f) {
                this.LJJLIIIJILLIZJL = true;
                this.LJJJJZ.setVisibility(8);
                if (!(getDialog() == null || getDialog().getWindow() == null)) {
                    getDialog().getWindow().setNavigationBarColor(-16777216);
                }
                C0905Tib tib = new C0905Tib(0, LJIIL(), false, (byte) 0);
                this.LJIJI = tib;
                tib.LIZLLL = true;
                Gg0.LIZ().LIZ(this.LJIJI);
            }
            LIZ(measuredHeight);
            if (f == 0.0f) {
                Ght.LIZ("close keyboard");
                try {
                    dismiss();
                } catch (IllegalStateException unused) {
                }
            }
        } else {
            Ght.LIZ("Unexpected close keyboard");
        }
    }

    public final void LIZ(EmoteFixTextHelper emoteFixTextHelper) {
        EmoteFixTextHelper emoteFixTextHelper2 = this.LJJI;
        if (emoteFixTextHelper2 != null) {
            emoteFixTextHelper2.LIZIZ = false;
        }
        this.LJIILJJIL.getEditableText().clear();
        this.LJJI = emoteFixTextHelper;
        this.LJJIJL = true;
        emoteFixTextHelper.LIZIZ = false;
        this.LJJI.LIZ(this.LJJIJIIJI, (float) this.LJJIJIL, this.LJJIJIIJIL, this.LJIILJJIL.getEditableText());
        this.LJJI.LIZIZ = true;
        this.LJJIJL = false;
    }

    public final void LIZ(boolean z) {
        if (isAdded() && !this.LJIIIZ) {
            if (this.LJIIIIZZ) {
                if (z) {
                    return;
                }
            } else if (!z) {
                return;
            }
            this.LJIIIIZZ = z;
            if (z) {
                this.LJIJJ.LIZ(true);
            } else {
                this.LJIJJ.LIZ();
            }
            LJI();
        }
    }

    public final void LIZ(String str) {
        if (isAdded() && !this.LJIIIZ) {
            this.LJIIJ = str;
            this.LJIILJJIL.setText(str);
            if (!TextUtils.isEmpty(this.LJIIJ) && !15V.LIZ(getContext())) {
                this.LJIILJJIL.setSelection(this.LJIIJ.length());
            }
            if (this.LJIIJ.length() == 0) {
                this.LJJIFFI.LIZLLL();
                this.LJJJZ.LIZLLL();
            }
            LJI();
        }
    }

    public final void LIZIZ() {
        LJIIJJI();
        dismissAllowingStateLoss();
    }

    public void onDestroy() {
        LiveEmojiInputDialogV6Fragment.super.onDestroy();
        this.LIZ = false;
    }

    public final void LJIIJJI() {
        if (this.LJIILJJIL != null) {
            2M2.LIZIZ(getContext(), this.LJIILJJIL);
        }
    }

    public void onPause() {
        LiveEmojiInputDialogV6Fragment.super.onPause();
        this.LJJJJZ.getKeyBoardObservable().LIZIZ(this);
    }

    private int LJIIL() {
        View view = this.LJIIZILJ;
        if (view == null || view.getMeasuredHeight() == 0) {
            return 0b0.LIZ(60.0f);
        }
        return this.LJIIZILJ.getMeasuredHeight();
    }

    private InputAttrs LJIILIIL() {
        Bundle arguments = getArguments();
        if (arguments != null) {
            return arguments.getParcelable("live.intent.extra.INPUT_ATTRS");
        }
        return null;
    }

    private boolean LJIILJJIL() {
        if (!0cm.LIZ(IHostEmoji.class).LIZIZ() || this.LJJJJ == 2) {
            return false;
        }
        return true;
    }

    private void LJIILL() {
        for (0SC LIZJ2 : this.LJJJI) {
            LIZJ2.LIZJ(this.LJIIIZ);
        }
    }

    public final void LIZ() {
        1IN r1;
        if (isAdded() && !this.LJIIIZ && (r1 = this.LJJL) != null) {
            r1.LIZ((List) null);
        }
    }

    public final void LIZLLL() {
        LJIIJ();
        int i = this.LJJIJ;
        if (i == 1) {
            this.LJIIJJI.setImageResource(2131234681);
        } else if (i == 2) {
            this.LJIIL.setImageResource(2131234681);
        }
    }

    public final void LJ() {
        Fbl fbl;
        if (!this.LJJIZ && (fbl = this.LJIILJJIL) != null) {
            fbl.post(new Runnable() {
                static {
                    Covode.recordClassIndex(14006);
                }

                public final void run() {
                    try {
                        LiveEmojiInputDialogV6Fragment.this.LJIILJJIL.requestFocus();
                    } catch (Exception e) {
                        0HH.LIZ(e);
                    }
                }
            });
            this.LJIILJJIL.setOnFocusChangeListener(new View.OnFocusChangeListener() {
                static {
                    Covode.recordClassIndex(14007);
                }

                public final void onFocusChange(View view, boolean z) {
                    view.postDelayed(new Runnable() {
                        static {
                            Covode.recordClassIndex(14008);
                        }

                        public final void run() {
                            if (LiveEmojiInputDialogV6Fragment.this.isAdded() && LiveEmojiInputDialogV6Fragment.this.getContext() != null) {
                                if (LiveEmojiInputDialogV6Fragment.this.getActivity() != null) {
                                    LiveEmojiInputDialogV6Fragment.this.getActivity().getWindow().setSoftInputMode(48);
                                }
                                if (!LiveEmojiInputDialogV6Fragment.this.LIZLLL) {
                                    Ght.LIZ("Keyboard will open");
                                    2M2.LIZ(LiveEmojiInputDialogV6Fragment.this.getContext(), LiveEmojiInputDialogV6Fragment.this.LJIILJJIL);
                                }
                            }
                        }
                    }, 100);
                    LiveEmojiInputDialogV6Fragment.this.LJIILJJIL.setOnFocusChangeListener((View.OnFocusChangeListener) null);
                    LiveEmojiInputDialogV6Fragment.this.LJJIZ = true;
                }
            });
        }
    }

    public final void LJFF() {
        if (this.LIZLLL) {
            this.LIZLLL = false;
            this.LJJJJZ.setVisibility(8);
            try {
                dismiss();
            } catch (IllegalStateException unused) {
            }
        }
    }

    public void onDestroyView() {
        LiveEmojiInputDialogV6Fragment.super.onDestroyView();
        this.LJJJJI = false;
        T1A t1a = this.LJIJJ;
        if (t1a != null) {
            t1a.clearAnimation();
            this.LJIJJ = null;
        }
        ValueAnimator valueAnimator = this.LJJJJZI;
        if (valueAnimator != null) {
            valueAnimator.cancel();
        }
    }

    public final void LJIIIIZZ() {
        if (!this.LJIIIZ) {
            LIZ(this.LJJIFFI);
            this.LJFF = 0eg.Keyboard;
            this.LJI = 0eg.Keyboard;
            boolean isEmpty = TextUtils.isEmpty(this.LJIILJJIL.getText());
            LIZIZ(isEmpty);
            if (!isEmpty) {
                this.LJIILIIL.setClickable(true);
            }
            LIZIZ(this.LJFF);
        }
    }

    public final void LJIIJ() {
        int indexOf;
        if (!this.LJIIIZ) {
            LIZJ(LJIILJJIL());
            this.LJFF = 0eg.Panel;
            this.LJI = 0eg.Panel;
            1IN r1 = this.LJJL;
            this.LJJ = r1;
            if (this.LJ && (indexOf = this.LJJJI.indexOf(r1)) != -1) {
                LIZIZ(indexOf);
                this.LJIJJLI.setCurrentItem(indexOf, false);
            }
            LIZIZ(this.LJFF);
        }
    }

    public void onResume() {
        LiveEmojiInputDialogV6Fragment.super.onResume();
        this.LJJLIIIJILLIZJL = false;
        this.LJJJJZ.getKeyBoardObservable().LIZ(this);
        if (this.LJJJJI && this.LJFF == 0eg.Keyboard) {
            this.LJJJJI = false;
            LIZ(200, 1, 5);
        } else if (this.LJFF == 0eg.Keyboard) {
            LJ();
        }
    }

    public final void LJI() {
        if (isAdded()) {
            if (this.LJIIIZ) {
                this.LJIILJJIL.setText(BuildConfig.VERSION_NAME);
                this.LJIILL.setText(2131829410);
                this.LJIILJJIL.setEnabled(false);
                return;
            }
            this.LJIILJJIL.setTextSize(1, 17.0f);
            if (this.LJIIIIZZ) {
                this.LJIILL.setText(2131833769);
            } else if (!TextUtils.isEmpty(this.LJJJJIZL)) {
                this.LJIILL.setText(this.LJJJJIZL);
            } else {
                this.LJIILL.setText(2131829245);
            }
            this.LJIILJJIL.setEnabled(true);
        }
    }

    public final void LJIIIZ() {
        int indexOf;
        if (!this.LJIIIZ) {
            LIZJ(LJIILJJIL());
            this.LJFF = 0eg.Panel;
            this.LJI = 0eg.Panel;
            1IL r1 = this.LJJII;
            this.LJJ = r1;
            if (this.LJ && (indexOf = this.LJJJI.indexOf(r1)) != -1) {
                LIZIZ(indexOf);
                this.LJIJJLI.setCurrentItem(indexOf, false);
            }
            boolean isEmpty = TextUtils.isEmpty(this.LJIILJJIL.getText());
            LIZIZ(isEmpty);
            if (!isEmpty) {
                this.LJIILIIL.setClickable(true);
            }
            LIZIZ(this.LJFF);
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:36:0x00c3, code lost:
        if (r3.length() > 0) goto L_0x00c5;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LJII() {
        /*
            r8 = this;
            X.TiG r0 = r8.LIZIZ
            if (r0 == 0) goto L_0x0007
            r0.LIZ()
        L_0x0007:
            X.H7d r0 = X.H7d.LIZ()
            X.Glh r0 = r0.LIZIZ()
            boolean r0 = r0.LJ()
            if (r0 != 0) goto L_0x0058
            X.1hK r0 = r8.getActivity()
            if (r0 != 0) goto L_0x0026
            android.content.Context r1 = X.0b0.LJ()
            r0 = 2131833745(0x7f113391, float:1.930058E38)
            X.Fz8.LIZ(r1, r0)
            return
        L_0x0026:
            X.H7d r0 = X.H7d.LIZ()
            X.Glh r3 = r0.LIZIZ()
            X.1hK r2 = r8.getActivity()
            X.Gg2 r1 = X.Gg3.LIZ()
            r0 = 2131834112(0x7f113500, float:1.9301325E38)
            java.lang.String r0 = X.0b0.LIZ(r0)
            r1.LIZ = r0
            java.lang.String r0 = "comment_live"
            r1.LIZLLL = r0
            r0 = 1000(0x3e8, float:1.401E-42)
            r1.LIZJ = r0
            X.Gg3 r0 = r1.LIZ()
            X.PgU r1 = r3.LIZ(r2, r0)
            X.Gb7 r0 = new X.Gb7
            r0.<init>()
            r1.LIZIZ(r0)
            return
        L_0x0058:
            X.H7d r0 = X.H7d.LIZ()
            X.Glh r1 = r0.LIZIZ()
            X.Gio r0 = X.Gio.COMMENT
            boolean r0 = r1.LIZ(r0)
            if (r0 == 0) goto L_0x0069
            return
        L_0x0069:
            boolean r0 = r8.LJIIIIZZ
            if (r0 == 0) goto L_0x0086
            java.lang.Class<com.bytedance.android.livesdkapi.host.IHostContext> r0 = com.bytedance.android.livesdkapi.host.IHostContext.class
            X.0UT r0 = X.0cm.LIZ(r0)
            com.bytedance.android.livesdkapi.host.IHostContext r0 = (com.bytedance.android.livesdkapi.host.IHostContext) r0
            boolean r0 = r0.isNeedProtectMinor()
            if (r0 == 0) goto L_0x0086
            android.content.Context r1 = X.0b0.LJ()
            r0 = 2131834017(0x7f1134a1, float:1.9301132E38)
            X.Fz8.LIZ(r1, r0)
            return
        L_0x0086:
            X.TiG r0 = r8.LIZIZ
            if (r0 != 0) goto L_0x008b
            return
        L_0x008b:
            X.Fbl r0 = r8.LJIILJJIL
            android.text.Editable r0 = r0.getText()
            if (r0 != 0) goto L_0x0094
            return
        L_0x0094:
            X.Fbl r0 = r8.LJIILJJIL
            android.text.Editable r0 = r0.getText()
            java.lang.String r3 = r0.toString()
            r7 = 0
            r2 = 0
            r0 = 0
        L_0x00a1:
            int r0 = r3.length()
            r1 = 1
            if (r2 >= r0) goto L_0x00b6
            char r0 = r3.charAt(r2)
            boolean r0 = java.lang.Character.isWhitespace(r0)
            r0 = r0 ^ r1
            if (r0 != 0) goto L_0x00bf
            int r2 = r2 + 1
            goto L_0x00a1
        L_0x00b6:
            com.bytedance.android.livesdk.chatroom.utils.EmoteFixTextHelper r0 = r8.LJJI
            int r0 = r0.LIZIZ()
            if (r0 != 0) goto L_0x00c5
            return
        L_0x00bf:
            int r0 = r3.length()
            if (r0 <= 0) goto L_0x00b6
        L_0x00c5:
            X.TiG r6 = r8.LIZIZ
            com.bytedance.android.livesdk.chatroom.utils.EmoteFixTextHelper r0 = r8.LJJI
            java.lang.String r5 = r0.LJ()
            boolean r4 = r8.LJIIIIZZ
            int r3 = r8.LJJIII
            X.GiH r2 = new X.GiH
            com.bytedance.android.livesdk.chatroom.utils.EmoteFixTextHelper r0 = r8.LJJI
            java.lang.String r1 = r0.LJFF()
            com.bytedance.android.livesdk.chatroom.utils.EmoteFixTextHelper r0 = r8.LJJI
            java.util.ArrayList r0 = r0.LIZ()
            r2.<init>(r1, r0)
            r6.LIZ(r5, r4, r3, r2)
            r8.LJJIII = r7
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.livesdk.chatroom.ui.LiveEmojiInputDialogV6Fragment.LJII():void");
    }

    public final void LIZ(C0854Thm thm) {
        this.LJJJIL = thm;
    }

    public final void LIZ(0eg r1) {
        this.LJFF = r1;
        this.LJI = r1;
    }

    public void onSaveInstanceState(Bundle bundle) {
        LiveEmojiInputDialogV6Fragment.super.onSaveInstanceState(bundle);
        this.LJJJJI = this.LIZLLL;
    }

    private void LIZ(ViewGroup viewGroup) {
        viewGroup.post(new C0850Thi(this));
    }

    public final void LIZIZ(0eg r3) {
        this.LJIILJJIL.post(new C0870Ti2(this, r3));
    }

    private void LIZJ(boolean z) {
        DataChannel LIZ2 = GSF.LIZ(this);
        if (LIZ2 != null) {
            Ggr.LIZ.LIZ(LIZ2, z, LJIILIIL());
        }
    }

    public final void LIZIZ(String str) {
        this.LJJJJIZL = str;
        LJI();
    }

    public void onActivityCreated(Bundle bundle) {
        Window window;
        LiveEmojiInputDialogV6Fragment.super.onActivityCreated(bundle);
        Dialog dialog = getDialog();
        if (!(dialog == null || (window = dialog.getWindow()) == null)) {
            window.setLayout(-1, -1);
        }
        if (this.LJJLIIIIJ) {
            this.LJJJJZ.setWindowInsetsEnable(true);
        }
    }

    public final void LIZ(int i) {
        this.LJIILLIIL.setTranslationY((float) i);
        ViewGroup.LayoutParams layoutParams = this.LJIJ.getLayoutParams();
        layoutParams.height = Math.abs(i);
        this.LJIJ.setLayoutParams(layoutParams);
    }

    public final void LIZIZ(boolean z) {
        if (z) {
            this.LJIILIIL.setImageResource(2131234996);
            08o.LIZ(this.LJIILIIL, (ColorStateList) null);
            return;
        }
        this.LJIILIIL.setImageResource(2131234994);
        ImageView imageView = this.LJIILIIL;
        08o.LIZ(imageView, ColorStateList.valueOf(0dA.LIZ(imageView, 2130971317)));
    }

    public final void LIZIZ(int i) {
        boolean z;
        0SC r4 = this.LJJJI.get(i);
        if (r4 instanceof 1IN) {
            LIZ(this.LJJJZ);
        } else {
            LIZ(this.LJJIFFI);
        }
        if (this.LJJI.LIZJ() == 0) {
            z = true;
        } else {
            z = false;
        }
        LIZIZ(z);
        this.LJIILIIL.setClickable(!z);
        this.LJJ = r4;
        for (int i2 = 0; i2 < this.LJJJI.size(); i2++) {
            if (i2 != i) {
                this.LJJJI.get(i2).LIZLLL(false);
            }
        }
        r4.LIZLLL(true);
    }

    public Dialog onCreateDialog(Bundle bundle) {
        Dialog onCreateDialog = LiveEmojiInputDialogV6Fragment.super.onCreateDialog(bundle);
        onCreateDialog.setCanceledOnTouchOutside(this.LJJJJLL);
        Window window = onCreateDialog.getWindow();
        if (window != null) {
            window.setGravity(80);
            window.setLayout(-1, -2);
            window.setBackgroundDrawable(new ColorDrawable(0));
            Ght.LIZ("Input Dialog Setting is" + this.LJJLIIIIJ);
            window.addFlags(32);
            if ((!LiveInputDialogAnimationSetting.enableOpt() || Build.VERSION.SDK_INT < 30) && !this.LJJLIIIIJ) {
                window.setSoftInputMode(3);
            } else {
                window.setSoftInputMode(19);
            }
            if (!this.LJJLIIIIJ && ((getActivity() != null && getActivity().getRequestedOrientation() == 0) || (!this.LJJJJJ && !0bM.LIZ(getActivity())))) {
                window.addFlags(1024);
            }
            window.clearFlags(2);
        }
        return onCreateDialog;
    }

    public void onDismiss(DialogInterface dialogInterface) {
        Ght.LIZ("Dialog onDismiss");
        Fzd.LIZ().LIZJ();
        if (!this.LJJLIIIJILLIZJL) {
            this.LJIJI = new C0905Tib(0, LJIIL(), false);
            Gg0.LIZ().LIZ(this.LJIJI);
        }
        LiveEmojiInputDialogV6Fragment.super.onDismiss(dialogInterface);
        if (this.LIZIZ != null) {
            InputAttrs inputAttrs = new InputAttrs();
            inputAttrs.LIZIZ = this.LJJJJJ;
            inputAttrs.LIZJ = this.LJIIIZ;
            inputAttrs.LIZLLL = this.LJJJJJL;
            inputAttrs.LIZ = this.LJIIIIZZ;
            inputAttrs.LJ = BuildConfig.VERSION_NAME;
            inputAttrs.LJFF = this.LJJIFFI;
            inputAttrs.LJI = this.LJJJZ;
            inputAttrs.LJII = this.LJJJJL;
            1IN r0 = this.LJJL;
            if (r0 != null) {
                inputAttrs.LIZ(r0.LIZJ);
            }
            this.LIZIZ.LIZ(inputAttrs);
            this.LIZIZ = null;
            this.LIZLLL = false;
        }
        this.LJJIIZI = false;
    }

    public final void LIZ(G5d g5d) {
        if (isAdded()) {
            if (this.LJIIIZ && g5d.LIZ) {
                return;
            }
            if (this.LJIIIZ || g5d.LIZ) {
                this.LJIIIZ = g5d.LIZ;
                this.LJJJJJL = g5d.LIZIZ;
                LJI();
                LJIILL();
            }
        }
    }

    public void onCreate(Bundle bundle) {
        String str;
        EmoteFixTextHelper emoteFixTextHelper;
        EmoteFixTextHelper emoteFixTextHelper2;
        LiveEmojiInputDialogV6Fragment.super.onCreate(bundle);
        this.LIZ = true;
        setCancelable(true);
        InputAttrs LJIILIIL2 = LJIILIIL();
        if (LJIILIIL2 != null) {
            this.LJIIIIZZ = LJIILIIL2.LIZ;
            this.LJJJJJ = LJIILIIL2.LIZIZ;
            this.LJIIIZ = LJIILIIL2.LIZJ;
            this.LJJJJJL = LJIILIIL2.LIZLLL;
            if (LJIILIIL2.LJ == null) {
                str = BuildConfig.VERSION_NAME;
            } else {
                str = LJIILIIL2.LJ;
            }
            this.LJIIJ = str;
            if (LJIILIIL2.LJFF == null) {
                emoteFixTextHelper = new EmoteFixTextHelper();
            } else {
                emoteFixTextHelper = LJIILIIL2.LJFF;
            }
            this.LJJIFFI = emoteFixTextHelper;
            if (LJIILIIL2.LJI == null) {
                emoteFixTextHelper2 = new EmoteFixTextHelper();
            } else {
                emoteFixTextHelper2 = LJIILIIL2.LJI;
            }
            this.LJJJZ = emoteFixTextHelper2;
            this.LJJJJL = LJIILIIL2.LJII;
            this.LJJJJLI = LJIILIIL2.LJIIIIZZ;
            this.LJJJJ = LJIILIIL2.LJIIIZ ^ true ? 1 : 0;
            this.LJJJJIZL = LJIILIIL2.LJIILIIL;
        } else {
            this.LJJIFFI = new EmoteFixTextHelper();
            this.LJJJZ = new EmoteFixTextHelper();
        }
        this.LJJI = this.LJJIFFI;
        LiveInputDialogAnimationSetting.INSTANCE.setDisable(this.LJJJJJ);
        if (this.LJJJJ == 2) {
            this.LJFF = 0eg.Panel;
            this.LJI = 0eg.Panel;
        }
        boolean windowInsetsAnimationEnable = LiveInputDialogAnimationSetting.windowInsetsAnimationEnable();
        this.LJJLIIIIJ = windowInsetsAnimationEnable;
        if (windowInsetsAnimationEnable) {
            setStyle(1, 2131887262);
        } else {
            setStyle(1, 2131887261);
        }
        this.LJJIJ = Fjp.LIZ.LIZ(GSF.LIZ(this));
    }

    public final void LIZ(C0884TiG tiG) {
        this.LIZIZ = tiG;
    }

    public final void LIZ(EmoteModel emoteModel) {
        for (int i = 0; i < this.LJJJI.size(); i++) {
            1IN r1 = (0SC) this.LJJJI.get(i);
            if (r1 instanceof 1IN) {
                LIZIZ(i);
                this.LJIJJLI.setCurrentItem(i);
                GpU gpU = r1.LIZIZ;
                if (gpU != null) {
                    FkL adapter = gpU.getRecyclerView().getAdapter();
                    List list = adapter.LIZIZ;
                    ArrayList arrayList = new ArrayList();
                    for (int i2 = 0; i2 < list.size(); i2++) {
                        if (!(list.get(i2) instanceof EmoteModel) || !emoteModel.LJI.equals(((EmoteModel) list.get(i2)).LJI)) {
                            arrayList.add(list.get(i2));
                        } else {
                            EmoteModel emoteModel2 = (EmoteModel) list.get(i2);
                            emoteModel2.LJIIJ = true;
                            arrayList.add(emoteModel2);
                            int oneLineCount = gpU.getOneLineCount();
                            if (i2 > oneLineCount) {
                                gpU.getRecyclerView().LIZIZ(i2 - oneLineCount);
                            }
                        }
                    }
                    adapter.LIZ(arrayList);
                    adapter.notifyDataSetChanged();
                }
            }
        }
    }

    public void show(0AA r2, String str) {
        Fzd.LIZ().LIZIZ();
        LiveEmojiInputDialogV6Fragment.super.show(r2, str);
    }

    public void showNow(0AA r2, String str) {
        Fzd.LIZ().LIZIZ();
        LiveEmojiInputDialogV6Fragment.super.showNow(r2, str);
    }

    public void onViewCreated(View view, Bundle bundle) {
        boolean z;
        InputAttrs LJIILIIL2;
        LiveEmojiInputDialogV6Fragment.super.onViewCreated(view, bundle);
        if (this.LJJLIIIIJ) {
            Window window = getDialog().getWindow();
            0dK.LIZ(window);
            window.addFlags(Integer.MIN_VALUE);
            window.setStatusBarColor(0);
            window.setNavigationBarColor(-1);
        }
        this.LJIJJ.setOnClickListener(this.LJJLIIIJJI);
        this.LJIIJJI.setOnClickListener(this.LJJLIIIJJI);
        int i = this.LJJIJ;
        boolean z2 = true;
        if (i == 1) {
            this.LJIIL.setVisibility(8);
            this.LJIIL.setOnClickListener((View.OnClickListener) null);
        } else if (i == 2) {
            this.LJIIL.setVisibility(0);
            this.LJIIL.setOnClickListener(this.LJJLIIIJJI);
            this.LJIJJLI.setOnPageChangeListener(new 0GV() {
                static {
                    Covode.recordClassIndex(14013);
                }

                public final void LIZ(int i, float f, int i2) {
                }

                public final void LIZIZ(int i) {
                }

                public final void e_(int i) {
                    if (LiveEmojiInputDialogV6Fragment.this.LJIJJLI.getCurrentItem() == 0) {
                        LiveEmojiInputDialogV6Fragment.this.LJIIJJI.setImageResource(2131234681);
                        LiveEmojiInputDialogV6Fragment.this.LJIIL.setImageResource(2131234680);
                        return;
                    }
                    LiveEmojiInputDialogV6Fragment.this.LJIIL.setImageResource(2131234681);
                    LiveEmojiInputDialogV6Fragment.this.LJIIJJI.setImageResource(2131234679);
                }
            });
        }
        if (this.LJJJJLI) {
            HeD.LIZ(this.LJIJJ, 8);
        }
        this.LJJIIJZLJL = (int) HeD.LIZIZ(getContext(), 8.0f);
        LIZJ(LJIILJJIL());
        final Context context = view.getContext();
        this.LJIJJ.post(new C0878TiA(this));
        this.LJJII = new 1IL(context);
        this.LJJIJIIJI = context.getResources().getDimensionPixelSize(2131166125);
        this.LJJIJIIJIL = context.getResources().getDimensionPixelSize(2131166126);
        this.LJJIJIL = context.getResources().getDimensionPixelSize(2131166124);
        this.LJJII.LJII = GSF.LIZ(this);
        1IL r1 = this.LJJII;
        C0904Tia tia = this.LIZJ;
        if (tia == null || tia.LIZIZ()) {
            z = true;
        } else {
            z = false;
        }
        r1.LJIIIZ = z;
        this.LJJII.LIZ(this.LJJJ);
        if (this.LJJJJ != 2) {
            this.LJJJI.add(this.LJJII);
            this.LJIIJJI.setVisibility(0);
        } else {
            this.LJIIJJI.setVisibility(8);
        }
        if (this.LJJJJ != 1) {
            1IN r0 = new 1IN(context, true);
            this.LJJL = r0;
            r0.LJI = true;
            this.LJJL.LJII = GSF.LIZ(this);
            1IN r12 = this.LJJL;
            C0904Tia tia2 = this.LIZJ;
            if (tia2 != null && !tia2.LIZIZ()) {
                z2 = false;
            }
            r12.LJIIIZ = z2;
            this.LJJL.LIZ(new 1j7() {
                static {
                    Covode.recordClassIndex(14014);
                }

                public final void LIZ(0SC r1) {
                }

                public final void LIZ() {
                    LiveEmojiInputDialogV6Fragment.this.LIZIZ();
                }

                public final void LIZIZ() {
                    LiveEmojiInputDialogV6Fragment.this.LJIILJJIL.dispatchKeyEvent(new KeyEvent(0, 67));
                }

                public final void LIZ(List<? extends EmoteModel> list) {
                    if (LiveEmojiInputDialogV6Fragment.this.LIZIZ != null) {
                        LiveEmojiInputDialogV6Fragment.this.LIZIZ.LIZ(list);
                    }
                }

                public final void LIZ(1JL r9) {
                    String obj;
                    int i;
                    String string;
                    if (LiveEmojiInputDialogV6Fragment.this.LJIILJJIL != null) {
                        Editable text = LiveEmojiInputDialogV6Fragment.this.LJIILJJIL.getText();
                        LiveEmojiInputDialogV6Fragment liveEmojiInputDialogV6Fragment = LiveEmojiInputDialogV6Fragment.this;
                        if (text == null) {
                            obj = BuildConfig.VERSION_NAME;
                        } else {
                            obj = text.toString();
                        }
                        liveEmojiInputDialogV6Fragment.LJIIJ = obj;
                        EmoteModel emoteModel = (EmoteModel) r9;
                        Drawable drawable = emoteModel.LJIILIIL;
                        drawable.mutate().setBounds(0, 0, LiveEmojiInputDialogV6Fragment.this.LJJIJIIJI, LiveEmojiInputDialogV6Fragment.this.LJJIJIIJI);
                        08X.LIZIZ(drawable, 15V.LIZ(context) ? 1 : 0);
                        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
                        HxC hxC = new HxC(drawable);
                        hxC.LIZ((float) LiveEmojiInputDialogV6Fragment.this.LJJIJIL);
                        hxC.LIZJ = LiveEmojiInputDialogV6Fragment.this.LJJIJIIJIL / 2;
                        hxC.LIZLLL = LiveEmojiInputDialogV6Fragment.this.LJJIJIIJIL / 2;
                        spannableStringBuilder.append(65532);
                        spannableStringBuilder.setSpan(hxC, spannableStringBuilder.length() - 1, spannableStringBuilder.length(), 33);
                        int LIZJ = LiveEmojiInputDialogV6Fragment.this.LJJI.LIZJ() + LiveEmojiInputDialogV6Fragment.this.LJJI.LIZ;
                        if (LiveEmojiInputDialogV6Fragment.this.LJIIIIZZ) {
                            i = 15;
                        } else {
                            i = 100;
                        }
                        if (LIZJ > i) {
                            if (LiveEmojiInputDialogV6Fragment.this.LJIIIIZZ) {
                                string = LiveEmojiInputDialogV6Fragment.this.getString(2131833879);
                            } else {
                                string = LiveEmojiInputDialogV6Fragment.this.getString(2131828455);
                            }
                            Fz8.LIZ(0b0.LJ(), string, 0);
                            return;
                        }
                        LiveEmojiInputDialogV6Fragment.this.LJJIJLIJ = false;
                        int selectionStart = LiveEmojiInputDialogV6Fragment.this.LJIILJJIL.getSelectionStart();
                        LiveEmojiInputDialogV6Fragment.this.LJJIL = true;
                        text.insert(selectionStart, spannableStringBuilder);
                        LiveEmojiInputDialogV6Fragment.this.LJJIL = false;
                        if (!LiveEmojiInputDialogV6Fragment.this.LJJIJL) {
                            LiveEmojiInputDialogV6Fragment.this.LJJI.LIZ(selectionStart, emoteModel);
                        }
                    }
                }
            });
            this.LJJJI.add(this.LJJL);
        }
        LJIILL();
        LJI();
        if (!this.LJIIIZ && this.LJIIIIZZ) {
            this.LJIJJ.LIZ(false);
        }
        this.LJIJJ.setVisibility(8);
        if (this.LJJL != null && (LJIILIIL2 = LJIILIIL()) != null) {
            this.LJJL.LIZ(Collections.unmodifiableList(LJIILIIL2.LJIIJJI));
        }
    }

    public final void LIZ(Activity activity, String str) {
        show(((1hK) activity).getSupportFragmentManager(), str);
    }

    /*  JADX ERROR: JadxRuntimeException in pass: CodeShrinkVisitor
        jadx.core.utils.exceptions.JadxRuntimeException: Don't wrap MOVE or CONST insns: 0x0005: MOVE  (r6v0 int) = (r11v0 int)
        	at jadx.core.dex.instructions.args.InsnArg.wrapArg(InsnArg.java:164)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.assignInline(CodeShrinkVisitor.java:133)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.checkInline(CodeShrinkVisitor.java:118)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.shrinkBlock(CodeShrinkVisitor.java:65)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.shrinkMethod(CodeShrinkVisitor.java:43)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.visit(CodeShrinkVisitor.java:35)
        */
    public final void LIZ(long r8, int r10, int r11) {
        /*
            r7 = this;
            X.Fbl r0 = r7.LJIILJJIL
            if (r0 == 0) goto L_0x0008
            r5 = r10
            r6 = r11
            if (r5 <= r6) goto L_0x0009
        L_0x0008:
            return
        L_0x0009:
            X.Ti8 r1 = new X.Ti8
            r2 = r7
            r3 = r8
            r1.<init>(r2, r3, r5, r6)
            r0.postDelayed(r1, r3)
            goto L_0x0008
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.livesdk.chatroom.ui.LiveEmojiInputDialogV6Fragment.LIZ(long, int, int):void");
    }

    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        boolean z;
        int i;
        0Zv LIZ2 = 0HH.LIZ(LayoutInflater.from(getContext()), 2131561759, viewGroup, false);
        this.LJJJJZ = LIZ2;
        if (EnableLiveKeyboardWithHeightSetting.INSTANCE.getValue() && getActivity() != null && getActivity().getRequestedOrientation() == 1) {
            this.LJJJJZ.LIZ();
        }
        T0N findViewById = this.LJJJJZ.findViewById(2131372956);
        this.LJJJLIIL = findViewById;
        if (!this.LJJJJLL) {
            findViewById.setActivity(getActivity());
        }
        this.LJIIJJI = (ImageView) LIZ2.findViewById(2131368242);
        this.LJIIL = (ImageView) LIZ2.findViewById(2131368243);
        ImageView imageView = (ImageView) LIZ2.findViewById(2131370099);
        this.LJIILIIL = imageView;
        imageView.setOnClickListener(new C0883TiF(this));
        this.LJIJJ = LIZ2.findViewById(2131362620);
        this.LJIILLIIL = LIZ2.findViewById(2131366019);
        this.LJIJ = LIZ2.findViewById(2131366020);
        View findViewById2 = LIZ2.findViewById(2131366067);
        this.LJIIZILJ = findViewById2;
        findViewById2.addOnLayoutChangeListener(new C0897TiT(this));
        Fbl findViewById3 = LIZ2.findViewById(2131364420);
        this.LJIILJJIL = findViewById3;
        findViewById3.LIZ(new C0912Tii(this));
        this.LJIILJJIL.addTextChangedListener(this.LJJLIIIJJIZ);
        this.LJIILJJIL.setOnKeyListener(new C0903TiZ(this));
        Szz.LIZ.LIZ(this.LJIILJJIL);
        if (this.LJJLIIIIJ) {
            this.LJJJJZ.setKeyboardAnimatorObserver(this);
        } else {
            T0N t0n = this.LJJJLIIL;
            if (!this.LJJJJJ || (getActivity() != null && getActivity().getRequestedOrientation() == 0)) {
                z = false;
            } else {
                z = true;
            }
            t0n.setShowStatusBar(z);
        }
        if (this.LJJLIIIIJ && this.LJFF == 0eg.Keyboard) {
            this.LJJJLIIL.LIZ = false;
            05h layoutParams = this.LJIILLIIL.getLayoutParams();
            layoutParams.topToBottom = 2131366021;
            layoutParams.bottomToBottom = -1;
            this.LJIILLIIL.setLayoutParams(layoutParams);
        }
        this.LJIILL = (TextView) LIZ2.findViewById(2131364421);
        T1A t1a = this.LJIJJ;
        if (this.LJJJJL) {
            i = 0;
        } else {
            i = 8;
        }
        HeD.LIZ(t1a, i);
        if (!this.LJJJJL) {
            this.LJIIIIZZ = false;
        }
        this.LJJJLL = (LinearLayout) LIZ2.findViewById(2131364512);
        this.LJIJJLI = LIZ2.findViewById(2131366075);
        this.LJIL = (ViewGroup) LIZ2.findViewById(2131366073);
        this.LJJJLZIJ = (ViewGroup) LIZ2.findViewById(2131371581);
        if (this.LJJIJ == 2) {
            this.LJIL.setVisibility(8);
            this.LJJJLZIJ.setVisibility(8);
        } else {
            this.LJIL.setVisibility(0);
            this.LJJJLZIJ.setVisibility(0);
        }
        if (getDialog() != null) {
            this.LJJJLIIL.setOnClickListener(new View.OnClickListener() {
                static {
                    Covode.recordClassIndex(14012);
                }

                public final void onClick(View view) {
                    LiveEmojiInputDialogV6Fragment.this.LJFF = 0eg.Close;
                    LiveEmojiInputDialogV6Fragment.this.LJI = 0eg.Close;
                    LiveEmojiInputDialogV6Fragment.this.LJIIJJI();
                    if (LiveEmojiInputDialogV6Fragment.this.LIZJ != null) {
                        LiveEmojiInputDialogV6Fragment.this.LIZJ.LIZJ();
                        try {
                            LiveEmojiInputDialogV6Fragment.this.LJFF();
                            LiveEmojiInputDialogV6Fragment.this.dismiss();
                        } catch (Exception e) {
                            0HH.LIZ(e);
                        }
                    }
                }
            });
        }
        if (this.LJJIJ == 1) {
            this.LJJIIZ = 0b0.LIZLLL(2131166128) + 0b0.LIZLLL(2131166129) + 0b0.LIZLLL(2131166131) + 0b0.LIZ(1.0f);
        } else {
            this.LJJIIZ = 0b0.LIZLLL(2131166128) + 0b0.LIZ(1.0f);
        }
        if (this.LJFF == 0eg.Panel) {
            this.LJJJJZ.setVisibility(0);
            LIZ((ViewGroup) this.LJJJLL);
            this.LJIJI = new C0905Tib(this.LJJIIZ, LJIIL(), true);
            Gg0.LIZ().LIZ(this.LJIJI);
        }
        return LIZ2;
    }
}
