@Override
  public void onBackPressed() {
    if (!inProgress) {
      hideProgress();

      FragmentManager supportFragmentManager = getSupportFragmentManager();
      BaseFragment current =
          (BaseFragment) supportFragmentManager.findFragmentById(getContainerID());
      if (current != null && current.getPreviousFragment() != null) {
        supportFragmentManager.popBackStack(
            current.getPreviousFragment(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
        if (hasChild()) {
          getToolbar().showBackIcon();
        } else {
          getToolbar().showHomeIcon();
        }
      } else {
        exit();
      }
    }
  }
  void nextFragment() {
    if (nextFragment != null) {
      BaseFragment currentFragment =
          (BaseFragment) getSupportFragmentManager().findFragmentById(getContainerID());
      boolean hasOldFragment = currentFragment != null;
      boolean isAlreadyLoaded = false;
      if (hasOldFragment) {
        isAlreadyLoaded =
            currentFragment
                .getClass()
                .getSimpleName()
                .equals(nextFragment.getClass().getSimpleName());
      }

      if (!(hasOldFragment && isAlreadyLoaded)) {
        if (isRoot) {
          clearBackStack();
          getToolbar().showHomeIcon();
        } else {
          getToolbar().showBackIcon();
        }
        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        boolean b = backStack || isRoot;
        fragmentTransaction.replace(
            getContainerID(), nextFragment, nextFragment.getClass().getSimpleName());
        if (currentFragment != null && !isRoot) {
          nextFragment.setPreviousFragment(
              b
                  ? currentFragment.getClass().getSimpleName()
                  : currentFragment.getPreviousFragment());
          fragmentTransaction.addToBackStack(currentFragment.getClass().getSimpleName());
        } else {
          nextFragment.setPreviousFragment(null);
          fragmentTransaction.addToBackStack(null);
        }
        fragmentTransaction.commit();
      }
      nextFragment = null;
    }
  }