package com.ss.android.ugc.aweme.view.editor;

import X.5vY;
import X.JFQ;
import X.JFW;
import X.JFZ;
import X.QeP;
import android.util.SparseArray;
import android.view.View;
import android.widget.SeekBar;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.viewModel.ProfileNaviEditorViewModel;
import java.util.HashMap;
import kotlin.h.b.n;

public final class ProfileNaviEditorEffectFragment extends ProfileNaviViewPagerFragment implements SeekBar.OnSeekBarChangeListener, 5vY {
    public static final JFZ LIZJ = new JFZ((byte) 0);
    public JFQ LIZ;
    public JFW LIZIZ;
    public int LIZLLL;
    public SparseArray LJ;

    static {
        Covode.recordClassIndex(123362);
    }

    public final int LIZ() {
        return 2131560860;
    }

    public final View LIZ(int i) {
        if (this.LJ == null) {
            this.LJ = new SparseArray();
        }
        View view = (View) this.LJ.get(i);
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i);
        this.LJ.put(i, findViewById);
        return findViewById;
    }

    public final void LIZJ() {
        SparseArray sparseArray = this.LJ;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    public final /* synthetic */ void onDestroyView() {
        ProfileNaviEditorEffectFragment.super.onDestroyView();
        LIZJ();
    }

    public final void onStartTrackingTouch(SeekBar seekBar) {
    }

    public final void onStopTrackingTouch(SeekBar seekBar) {
    }

    public final void LIZIZ() {
        if (this.LIZIZ != null) {
            JFQ jfq = this.LIZ;
            if (jfq == null) {
                n.LIZIZ();
            }
            HashMap<String, JFW> LJI = jfq.LJI();
            JFW jfw = this.LIZIZ;
            if (jfw == null) {
                n.LIZIZ();
            }
            if (!LJI.containsKey(jfw.LIZIZ)) {
                JFQ jfq2 = this.LIZ;
                if (jfq2 == null) {
                    n.LIZIZ();
                }
                HashMap<String, JFW> LJI2 = jfq2.LJI();
                JFW jfw2 = this.LIZIZ;
                if (jfw2 == null) {
                    n.LIZIZ();
                }
                JFW jfw3 = LJI2.get(jfw2.LIZIZ);
                if (jfw3 == null) {
                    n.LIZIZ();
                }
                JFW jfw4 = jfw3;
                JFW jfw5 = this.LIZIZ;
                if (jfw5 == null) {
                    n.LIZIZ();
                }
                jfw4.LIZ = jfw5.LJFF;
            }
            JFQ jfq3 = this.LIZ;
            if (jfq3 == null) {
                n.LIZIZ();
            }
            HashMap<String, JFW> LJI3 = jfq3.LJI();
            JFW jfw6 = this.LIZIZ;
            if (jfw6 == null) {
                n.LIZIZ();
            }
            JFW jfw7 = LJI3.get(jfw6.LIZIZ);
            if (jfw7 == null) {
                n.LIZIZ();
            }
            this.LIZLLL = jfw7.LIZ;
            QeP LIZ2 = LIZ(2131368916);
            if (LIZ2 != null) {
                LIZ2.setOnSeekBarChangeListener(this);
            }
            QeP LIZ3 = LIZ(2131368916);
            if (LIZ3 != null) {
                int i = this.LIZLLL;
                JFW jfw8 = this.LIZIZ;
                if (jfw8 == null) {
                    n.LIZIZ();
                }
                float f = (float) (i - jfw8.LIZLLL);
                JFW jfw9 = this.LIZIZ;
                if (jfw9 == null) {
                    n.LIZIZ();
                }
                int i2 = jfw9.LJ;
                JFW jfw10 = this.LIZIZ;
                if (jfw10 == null) {
                    n.LIZIZ();
                }
                LIZ3.setProgress((int) ((f / ((float) (i2 - jfw10.LIZLLL))) * 100.0f));
            }
        }
    }

    public final void onProgressChanged(SeekBar seekBar, int i, boolean z) {
        JFW jfw = this.LIZIZ;
        if (jfw != null) {
            float f = (float) jfw.LIZLLL;
            JFW jfw2 = this.LIZIZ;
            if (jfw2 == null) {
                n.LIZIZ();
            }
            int i2 = jfw2.LJ;
            JFW jfw3 = this.LIZIZ;
            if (jfw3 == null) {
                n.LIZIZ();
            }
            int i3 = (int) (f + (((float) ((i2 - jfw3.LIZLLL) * i)) / 100.0f));
            JFW jfw4 = this.LIZIZ;
            if (jfw4 == null) {
                n.LIZIZ();
            }
            this.LIZLLL = i3 - (i3 % jfw4.LJI);
            ProfileNaviEditorViewModel LIZLLL2 = LIZLLL();
            JFW jfw5 = this.LIZIZ;
            if (jfw5 == null) {
                n.LIZIZ();
            }
            LIZLLL2.LIZ(jfw5.LIZIZ, this.LIZLLL);
        }
    }
}
