@Override
          public void onClick(View v) {
            if (startButton.getVisibility() == View.VISIBLE) {
              startButton.setVisibility(View.INVISIBLE);
            }

            if (upAnimation.isStarted()) {
              upAnimation.cancel();
            }

            if (startPosition == 0) {
              startPosition = bird.getTop();
            }

            isUpAnimationCancelled = false;
            isDownEndByClick = true;
            // bird.layout(bird.getLeft(), 228, bird.getRight(), 228 + bird.getMeasuredHeight());
            bird.layout(
                bird.getLeft(),
                (int) bird.getY(),
                bird.getRight(),
                (int) bird.getY() + bird.getMeasuredHeight());
            bird.setTranslationY(0);
            upAnimation.start();
          }
Esempio n. 2
0
  @Override
  public void onGlobalLayout() {
    ImageView imageView = getImageView();
    if (null != imageView) {
      if (mZoomEnabled) {
        final int top = imageView.getTop();
        final int right = imageView.getRight();
        final int bottom = imageView.getBottom();
        final int left = imageView.getLeft();

        /**
         * We need to check whether the ImageView's bounds have changed. This would be easier if we
         * targeted API 11+ as we could just use View.OnLayoutChangeListener. Instead we have to
         * replicate the work, keeping track of the ImageView's bounds and then checking if the
         * values change.
         */
        if (top != mIvTop || bottom != mIvBottom || left != mIvLeft || right != mIvRight) {
          // Update our base matrix, as the bounds have changed
          updateBaseMatrix(imageView.getDrawable());

          // Update values as something has changed
          mIvTop = top;
          mIvRight = right;
          mIvBottom = bottom;
          mIvLeft = left;
        }
      } else {
        updateBaseMatrix(imageView.getDrawable());
      }
    }
  }
Esempio n. 3
0
  @Override
  public void setScale(float scale, boolean animate) {
    ImageView imageView = getImageView();

    if (null != imageView) {
      setScale(scale, (imageView.getRight()) / 2, (imageView.getBottom()) / 2, animate);
    }
  }
Esempio n. 4
0
 public void BallStart() {
   int height = image.getBottom() - image.getTop();
   int width = image.getRight() - image.getLeft();
   Log.v("hehe", "" + arrayMap.getStart());
   image.layout(
       arrayMap.getStart().x - width / 2,
       arrayMap.getStart().y - height / 2,
       arrayMap.getStart().x - width / 2 + width,
       arrayMap.getStart().y - height / 2 + height);
 }
    void hide() {
      boolean horiz = alignment == ALIGN_LEFT || alignment == ALIGN_RIGHT;
      int dx =
          horiz
              ? (alignment == ALIGN_LEFT
                  ? alignment_value - tab.getRight()
                  : alignment_value - tab.getLeft())
              : 0;
      int dy =
          horiz
              ? 0
              : (alignment == ALIGN_TOP
                  ? alignment_value - tab.getBottom()
                  : alignment_value - tab.getTop());

      Animation trans = new TranslateAnimation(0, dx, 0, dy);
      trans.setDuration(ANIM_DURATION);
      trans.setFillAfter(true);
      tab.startAnimation(trans);
      text.startAnimation(trans);
      target.setVisibility(View.INVISIBLE);
    }
 void reset(boolean animate) {
   setState(STATE_NORMAL);
   text.setVisibility(View.VISIBLE);
   text.setTextAppearance(text.getContext(), R.style.TextAppearance_SlidingTabNormal);
   tab.setVisibility(View.VISIBLE);
   target.setVisibility(View.INVISIBLE);
   final boolean horiz = alignment == ALIGN_LEFT || alignment == ALIGN_RIGHT;
   int dx =
       horiz
           ? (alignment == ALIGN_LEFT
               ? alignment_value - tab.getLeft()
               : alignment_value - tab.getRight())
           : 0;
   int dy =
       horiz
           ? 0
           : (alignment == ALIGN_TOP
               ? alignment_value - tab.getTop()
               : alignment_value - tab.getBottom());
   if (animate) {
     TranslateAnimation trans = new TranslateAnimation(0, dx, 0, dy);
     trans.setDuration(ANIM_DURATION);
     trans.setFillAfter(false);
     text.startAnimation(trans);
     tab.startAnimation(trans);
   } else {
     if (horiz) {
       text.offsetLeftAndRight(dx);
       tab.offsetLeftAndRight(dx);
     } else {
       text.offsetTopAndBottom(dy);
       tab.offsetTopAndBottom(dy);
     }
     text.clearAnimation();
     tab.clearAnimation();
     target.clearAnimation();
   }
 }
 @Override
 public void onAnimationEnd(Animator animation) {
   // TODO Auto-generated method stub
   Log.v(
       "Debug",
       "Animation End: "
           + bird.getY()
           + ".."
           + bird.getTop()
           + ".."
           + bird.getTranslationY());
   if (!isUpAnimationCancelled) {
     // start to drop
     // downAnimation.setFloatValues(deltaY);
     bird.layout(
         bird.getLeft(),
         (int) bird.getY(),
         bird.getRight(),
         (int) bird.getY() + bird.getMeasuredHeight());
     bird.setTranslationY(0);
     downAnimation.setFloatValues(startPosition - bird.getTop());
     downAnimation.start();
   }
 }
	public void setPageControlPosition(
			int offsetX )
	{
		pageControl.layout( offsetX / 3 , pageControl.getTop() , pageControl.getRight() , pageControl.getBottom() );
		;
	}