package com.hc.viewmodel;

import android.arch.lifecycle.LifecycleOwner;
import android.arch.lifecycle.Observer;
import android.support.annotation.Nullable;

public class SingleBooleanEvent extends SingleLiveEvent<Boolean> {

    public void observe(LifecycleOwner owner, final SingleBooleanEventObserver observer) {
        super.observe(owner, new Observer<Boolean>() {
            @Override
            public void onChanged(@Nullable Boolean show) {
                observer.observeResult(show == null ? false : show);
            }
        });
    }

    public interface SingleBooleanEventObserver {
        /**
         * 是否显示加载框
         * @param show <code>true</code>为显示，<code>false</code>则隐藏。
         */
        void observeResult(boolean show);
    }
}
