コード例 #1
0
  /**
   * Shows material view with fade in animation
   *
   * @param activity
   */
  private void show(Activity activity) {

    if (preferencesManager.isDisplayed(materialIntroViewId)) return;

    ((ViewGroup) activity.getWindow().getDecorView()).addView(this);

    setReady(true);

    handler.postDelayed(
        new Runnable() {
          @Override
          public void run() {
            if (isFadeAnimationEnabled)
              AnimationFactory.animateFadeIn(
                  MaterialIntroView.this,
                  fadeAnimationDuration,
                  new AnimationListener.OnAnimationStartListener() {
                    @Override
                    public void onAnimationStart() {
                      setVisibility(VISIBLE);
                    }
                  });
            else setVisibility(VISIBLE);
          }
        },
        delayMillis);
  }
コード例 #2
0
  /** Dismiss Material Intro View */
  private void dismiss() {
    preferencesManager.setDisplayed(materialIntroViewId);
    AnimationFactory.animateFadeOut(
        this,
        fadeAnimationDuration,
        new AnimationListener.OnAnimationEndListener() {
          @Override
          public void onAnimationEnd() {
            setVisibility(INVISIBLE);

            if (materialIntroListener != null)
              materialIntroListener.onUserClicked(materialIntroViewId);
          }
        });
  }