/*
 * COPYRIGHT (c) 2018 All rights reserved by HANWHA LIFE.
 */
package kr.co.zumo.app.lifeplus.view.dialog;

import android.support.v4.app.DialogFragment;

import kr.co.zumo.app.R;

/**
 * DialogBase
 * <pre>
 * </pre>
 *
 * @author 민효동
 * @version 1.0
 * @history 민효동   [2018. 9. 14.]   [최초 작성]
 * @since 2018. 9. 14.
 */
public abstract class DialogBase extends DialogFragment {
  private IDialogResultListener resultListener;
  private boolean isDismissed = false;

  public IDialogResultListener getResultListener() {
    return resultListener;
  }

  public void setResultListener(IDialogResultListener resultListener) {
    this.resultListener = resultListener;
  }

  /**
   * dismiss 확인
   *
   * @return
   */
  public boolean isDismissed() {
    return isDismissed;
  }

  /**
   * Full screen
   *
   * @return
   */
  @Override
  public int getTheme() {
    return R.style.FullScreenDialog;
  }

  @Override
  public void dismiss() {
    super.dismiss();
    isDismissed = true;
  }

  @Override
  public void dismissAllowingStateLoss() {
    super.dismissAllowingStateLoss();
    isDismissed = true;
  }

  /**
   * dispose
   */
  public void dispose() {
    if (isDismissed() == false) {
      dismiss();
    }
  }
}
