package com.ycgis.macall.personalcenter.p.presenter;

import android.content.Context;

import com.rs.macall.androidx.basemodel.callback.BasePresenterCallback;
import com.rs.macall.androidx.basemodel.utils.ProgressDialogUtils;


/**
 * @Author macall
 * @Create 2019/12/4 0004
 * @Describe
 */
public abstract class BasePresenter<T extends BasePresenterCallback> {
    protected static String TAG = "";
    protected Context context;
    protected T callBack;

    private ProgressDialogUtils dialogUtils;

    public BasePresenter(Context context, T callback){
        this.context = context;
        this.callBack = callback;
        TAG = getClass().getSimpleName();
    }

    public Context getContext() {
        return context;
    }

    public void baseShowDialog(String mess) {
        baseShowDialog("提示信息", mess);
    }

    public void baseShowDialog(String title, String mess) {
        if (dialogUtils == null) dialogUtils = new ProgressDialogUtils(context);
        else dialogUtils.dismiss();
        dialogUtils.show(title, mess);
    }

    public void baseShowFaseDialong(String title, String mess) {
        if (dialogUtils == null) dialogUtils = new ProgressDialogUtils(context);
        else dialogUtils.dismiss();
        dialogUtils.showFase(title, mess);
    }

    public void baseDialogUpdateMessage(String mess) {
        if (dialogUtils == null) {
            baseShowDialog(mess);
        } else {
            dialogUtils.setMessage(mess);
        }
    }

    public void baseDismissDialog() {
        if (dialogUtils != null) dialogUtils.dismiss();
    }

}
