コード例 #1
0
 public void close() {
   float width = this.getWidthXY(TransformSpace.RELATIVE_TO_PARENT);
   //		IAnimation closeAnim = new Animation("Window Fade", new MultiPurposeInterpolator(width, 1,
   // 350, 0.2f, 0.5f, 1), this);
   IAnimation closeAnim = new AniAnimation(width, 1, 350, AniAnimation.SINE_IN, this);
   closeAnim.addAnimationListener(
       new IAnimationListener() {
         public void processAnimationEvent(AnimationEvent ae) {
           //				float delta = ae.getAnimation().getInterpolator().getCurrentStepDelta();
           switch (ae.getId()) {
             case AnimationEvent.ANIMATION_STARTED:
             case AnimationEvent.ANIMATION_UPDATED:
               float currentVal = ae.getAnimation().getValue();
               setWidthXYRelativeToParent(currentVal);
               rotateZ(getCenterPointRelativeToParent(), -ae.getDelta() * 0.3f);
               break;
             case AnimationEvent.ANIMATION_ENDED:
               setVisible(false);
               destroy();
               break;
             default:
               break;
           } // switch
         } // processanimation
       });
   closeAnim.start();
 }
コード例 #2
0
  /**
   * Shows a disappearing animation and closes the AbstractOverlay instance.
   *
   * <p>Adapted from {@link org.mt4j.components.visibleComponents.widgets.keyboard.MTKeyboard}
   *
   * @see MTKeyboard#close()
   */
  private void onCloseButtonTapped() {

    log.debug("Entering onCloseButtonTapped()"); // $NON-NLS-1$

    // Get width
    float width = this.getWidthXY(TransformSpace.RELATIVE_TO_PARENT);

    // Create new animation
    IAnimation overlayCloseAnim =
        new Animation(
            "Status Message Fade",
            new MultiPurposeInterpolator(width, 1, 300, 0.2f, 0.5f, 1),
            this); //$NON-NLS-1$

    // Add Animation listener to animation
    overlayCloseAnim.addAnimationListener(
        new IAnimationListener() {

          @Override
          public void processAnimationEvent(AnimationEvent ae) {
            switch (ae.getId()) {
              case AnimationEvent.ANIMATION_STARTED:
              case AnimationEvent.ANIMATION_UPDATED:

                // Get animation value
                float currentVal = ae.getAnimation().getValue();

                // Set StatusMessageDialog width the animation value
                setWidthRelativeToParent(currentVal);

                break;
              case AnimationEvent.ANIMATION_ENDED:

                // Set AbstractOverlayDefaultList instance invisible and
                // destroy
                setVisible(false);
                destroy();

                break;
              default:
                break;
            }
          }
        });

    // Start Animation
    overlayCloseAnim.start();

    log.debug("Leaving onCloseButtonTapped()"); // $NON-NLS-1$
  }