package com.bef.effectsdk.message;

import android.os.Message;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;

public class ResourceMonitor implements MessageInterceptor {
    public Listener mListener;

    public interface Listener {
        static {
            Covode.recordClassIndex(2841);
        }

        void onResourceLoadFinish(String str, boolean z);
    }

    static {
        Covode.recordClassIndex(2840);
    }

    public void destroy() {
        this.mListener = null;
    }

    public void reset() {
    }

    public void setListener(Listener listener) {
        this.mListener = listener;
    }

    public boolean intercept(Message message) {
        Listener listener;
        if (17 != message.what) {
            return false;
        }
        String str = (String) message.obj;
        if (TextUtils.isEmpty(str)) {
            return true;
        }
        int i = message.arg1;
        if (i == 3) {
            Listener listener2 = this.mListener;
            if (listener2 != null) {
                listener2.onResourceLoadFinish(str, true);
            }
        } else if (i == 4 && (listener = this.mListener) != null) {
            listener.onResourceLoadFinish(str, false);
        }
        return true;
    }
}
