Пример #1
0
  /** Displays a XActivityToast. */
  private void displaySuperToast(XActivityToast xActivityToast) {

    /* If this XActivityToast is somehow already showing do nothing */
    if (xActivityToast.isShowing()) {

      return;
    }

    final ViewGroup viewGroup = xActivityToast.getViewGroup();

    final View toastView = xActivityToast.getView();

    if (viewGroup != null) {

      try {

        viewGroup.addView(toastView);

        if (!xActivityToast.getShowImmediate()) {

          toastView.startAnimation(getShowAnimation(xActivityToast));
        }

      } catch (IllegalStateException e) {

        this.cancelAllSuperActivityToastsForActivity(xActivityToast.getActivity());
      }
    }

    /* Dismiss the XActivityToast at the set duration time unless indeterminate */
    if (!xActivityToast.isIndeterminate()) {

      Message message = obtainMessage(Messages.REMOVE);
      message.obj = xActivityToast;
      sendMessageDelayed(
          message, xActivityToast.getDuration() + getShowAnimation(xActivityToast).getDuration());
    }
  }