package com.ss.android.ugc.aweme.sticker.presenter.handler;

import X.0CB;
import X.0CH;
import X.0CN;
import X.2Pr;
import X.6Is;
import X.72n;
import X.C2464NFb;
import X.Crj;
import X.IFh;
import X.Ls2;
import X.M12;
import X.NBS;
import X.NFH;
import X.NFV;
import X.NKQ;
import X.NKR;
import X.NKS;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.shortvideo.SafeHandler;
import com.ss.android.ugc.effectmanager.effect.model.Effect;

public final class GameStickerHandler extends NFV implements 6Is, C2464NFb, 72n {
    public static final NKS LIZJ = new NKS((byte) 0);
    public Effect LIZ;
    public final Crj<NKR> LIZIZ;
    public SafeHandler LIZLLL;
    public final Ls2<2Pr> LJ;

    static {
        Covode.recordClassIndex(116118);
    }

    public final void LIZ() {
        this.LIZ = null;
    }

    public final void onStateChanged(0CH r2, 0CB r3) {
        if (r3 == 0CB.ON_STOP) {
            onStop();
        } else if (r3 == 0CB.ON_DESTROY) {
            onDestroy();
        }
    }

    @0CN(LIZ = 0CB.ON_DESTROY)
    private final void onDestroy() {
        if (this.LIZIZ.isInitialized()) {
            ((NKR) this.LIZIZ.getValue()).LIZLLL();
        }
    }

    @0CN(LIZ = 0CB.ON_STOP)
    private final void onStop() {
        if (this.LIZIZ.isInitialized()) {
            ((NKR) this.LIZIZ.getValue()).LIZIZ();
        }
    }

    public final boolean LIZIZ() {
        if (!this.LIZIZ.isInitialized() || !((NKR) this.LIZIZ.getValue()).LIZJ()) {
            return false;
        }
        return true;
    }

    public final boolean LIZ(NBS nbs) {
        M12.LIZ(nbs);
        return NFH.LIZLLL(nbs.LIZ);
    }

    public /* synthetic */ GameStickerHandler(0CH r2, Crj crj) {
        this(r2, crj, AnonymousClass1.LIZ);
    }

    public final void LIZ(IFh iFh, NBS nbs) {
        M12.LIZ(iFh, nbs);
        this.LJ.invoke();
        this.LIZ = nbs.LIZ;
    }

    public GameStickerHandler(0CH r3, Crj<? extends NKR> crj, Ls2<2Pr> ls2) {
        M12.LIZ(r3, crj, ls2);
        this.LIZIZ = crj;
        this.LJ = ls2;
        this.LIZLLL = new SafeHandler(r3);
        r3.getLifecycle().LIZ(this);
    }

    public final void LIZ(int i, int i2, int i3, String str) {
        if (NFH.LIZLLL(this.LIZ)) {
            this.LIZLLL.post(new NKQ(this, i, i2, i3, str));
        }
    }
}
