package kr.co.zumo.app.lifeplus.manager;

import android.support.annotation.StringRes;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

/**
 * Fragment의 ActionBar 관리
 * <pre>
 * </pre>
 *
 * @author 하세미
 * @version 1.0
 * @history 하세미   [2018. 9. 5.]   [최초 작성]
 * @since 2018. 9. 5.
 */
public class ActionBarManager {

  private static final ActionBarManager ourInstance = new ActionBarManager();

  public static ActionBarManager getInstance() {
    return ourInstance;
  }

  private AppCompatActivity activity;
  private ActionBar actionBar;

  private ActionBarManager() {
  }

  /**
   * activity 정보 받아옴.
   *
   * @param activityInfo
   */
  public void setActivityInfo(AppCompatActivity activityInfo) {
    activity = activityInfo;
    actionBar = activityInfo.getSupportActionBar();
  }


  /**
   * actionbar 제목 설정
   *
   * @param stringId
   */
  public void setTitle(@StringRes int stringId) {
    actionBar.setTitle(stringId);
  }

  /**
   * actionbar back 설정 유무
   *
   * @param isEnabled
   */
  public void setDisplayHomeAsUpEnabled(boolean isEnabled) {
    actionBar.setDisplayHomeAsUpEnabled(isEnabled);
  }

  /**
   * actionbar 유무
   *
   * @param isEnabled
   */
  public void setDisplayShowTitleEnabled(boolean isEnabled) {actionBar.setDisplayShowTitleEnabled(isEnabled);}

  /**
   * actionbar hide
   */
  public void hide() {
    actionBar.hide();
  }

  /**
   * show
   */
  public void show() {
    actionBar.show();
  }

  public void setCustomView(View view) {actionBar.setCustomView(view);}

  public void setDisplayOptions(int displayOptions) {actionBar.setDisplayOptions(displayOptions);}

  public void setElevation(int elevation) {actionBar.setElevation(elevation);}

  /***********************************
   * life-cycle
   ***********************************/
  //  public void init() {
//
//  }
//
//  public void start() {
//
//  }
//
//  public void stop() {
//
//  }
//
//  public void dispose() {
//
//  }
}
