Пример #1
0
 @Override
 public void onWindowFocusChanged(boolean hasFocus) {
     super.onWindowFocusChanged(hasFocus);
     if (hasFocus) {
         showTop = layoutReason.getTop();
         scrollViewTop = winchanceScrollView.getTop();
         int height = outRect.height() - 2 * linearLayoutShowContent.getHeight();
         stickyTop = linearLayoutShowContent.getTop() - height;
     }
 }
  /**
   * 彈幾個按鈕出嚟
   *
   * @param durationMillis 用幾多時間
   */
  public void startAnimationsIn(int durationMillis) {
    isOpen = true;
    for (int i = 0; i < clayout.getChildCount(); i++) {
      final LinearLayout inoutimagebutton = (LinearLayout) clayout.getChildAt(i);

      double offangle = fullangle / (amount - 1);

      final double deltaY, deltaX;
      if (pc == LEFTCENTER || pc == RIGHTCENTER) {
        deltaX = Math.sin(offangle * i * Math.PI / 180) * R;
        deltaY = Math.cos(offangle * i * Math.PI / 180) * R;
      } else {
        deltaY = Math.sin(offangle * i * Math.PI / 180) * R;
        deltaX = Math.cos(offangle * i * Math.PI / 180) * R;
      }

      ViewPropertyAnimator viewPropertyAnimator = viewAnimators.get(i);
      viewPropertyAnimator.setListener(null);

      inoutimagebutton.setVisibility(View.VISIBLE);
      viewPropertyAnimator
          .x((float) (inoutimagebutton.getLeft() + xOri * deltaX))
          .y((float) (inoutimagebutton.getTop() + yOri * deltaY));
    }
  }
  private void bounceBackHeader() {
    int yTranslate =
        state == State.REFRESHING
            ? header.getHeight() - headerContainer.getHeight()
            : -headerContainer.getHeight() - headerContainer.getTop();

    TranslateAnimation bounceAnimation =
        new TranslateAnimation(
            TranslateAnimation.ABSOLUTE,
            0,
            TranslateAnimation.ABSOLUTE,
            0,
            TranslateAnimation.ABSOLUTE,
            0,
            TranslateAnimation.ABSOLUTE,
            yTranslate);

    bounceAnimation.setDuration(BOUNCE_ANIMATION_DURATION);
    bounceAnimation.setFillEnabled(true);
    bounceAnimation.setFillAfter(false);
    bounceAnimation.setFillBefore(true);
    bounceAnimation.setInterpolator(new OvershootInterpolator(BOUNCE_OVERSHOOT_TENSION));
    bounceAnimation.setAnimationListener(new HeaderAnimationListener(yTranslate));

    startAnimation(bounceAnimation);
  }
 /**
  * 收埋幾個按鈕入去
  *
  * @param durationMillis 用幾多時間
  */
 public void startAnimationsOut(int durationMillis) {
   isOpen = false;
   for (int i = 0; i < clayout.getChildCount(); i++) {
     final LinearLayout inoutimagebutton = (LinearLayout) clayout.getChildAt(i);
     ViewPropertyAnimator viewPropertyAnimator = viewAnimators.get(i);
     viewPropertyAnimator.setListener(null);
     viewPropertyAnimator
         .x((float) inoutimagebutton.getLeft())
         .y((float) inoutimagebutton.getTop());
     viewPropertyAnimator.setListener(new AnimListener(inoutimagebutton));
   }
 }
Пример #5
0
  @Override
  public void onClick(View v) {

    int[] location = new int[2];
    firstBlock.getLocationOnScreen(location);
    LinearLayout map = (LinearLayout) findViewById(R.id.map);
    Log.v("Left", "" + location[0]);
    Log.v("Top", "" + location[1]);
    Log.v("Left", "" + map.getLeft());
    Log.v("Top", "" + map.getTop());
    //				case R.id.restart:
    //					BallStart();
  }
Пример #6
0
    public int a()
    {
        LinearLayout linearlayout = (LinearLayout)findViewById(0x7f11049b);
        int i = linearlayout.getChildCount();
        int j = 0;
        for (; i > 0; i--)
        {
            LinearLayout linearlayout1 = (LinearLayout)linearlayout.getChildAt(i - 1);
            for (int l = linearlayout1.getChildCount(); l > 1; l--)
            {
                j++;
                if (j >= 3)
                {
                    i = linearlayout1.getChildAt(l - 1).getTop();
                    int k = linearlayout1.getTop();
                    return linearlayout.getTop() + (k + i);
                }
            }

        }

        return 0;
    }
Пример #7
0
 /**
  * 得到高度
  */
 private void getTopDistance() {
     showTop = layoutReason.getTop();
     scrollViewTop = winchanceScrollView.getTop();
     int height = outRect.height() - 2 * linearLayoutShowContent.getHeight();
     stickyTop = linearLayoutShowContent.getTop() - height;
 }
Пример #8
0
 private boolean isTop() {
   return getScrollY() <= 0
       || mHeader.getVisibleHeight() > mHeaderHeight
       || mContentLayout.getTop() > 0;
 }