Java 类android.animation.RectEvaluator 实例源码

项目:quiz_helper    文件:BigBangHeader.java   
@Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        int width = getMeasuredWidth();
        int height = getMeasuredHeight();

        layoutSubView(mSearch, mActionGap, 0);
        layoutSubView(mShare, 2 * mActionGap + mSearch.getMeasuredWidth(), 0);
        layoutSubView(mTrans, 3 * mActionGap + mTrans.getMeasuredWidth() + mShare.getMeasuredWidth(), 0);

//        layoutSubView(mSelectAll, 2 * mActionGap + mSearch.getMeasuredWidth() , 0);
//        layoutSubView(mSelectOther, 3 * mActionGap + mTrans.getMeasuredWidth()+ mShare.getMeasuredWidth() , 0);
//
//        layoutSubView(mDrag, width - mActionGap * 2 - mShare.getMeasuredWidth() - mCopy.getMeasuredWidth(), 0);
        layoutSubView(mCopy, width - mActionGap - mCopy.getMeasuredWidth(), 0);
        layoutSubView(mClose, ((width - (this.mActionGap * 2)) - this.mCopy.getMeasuredWidth()) - this.mClose.getMeasuredHeight(), 0);

        Rect oldBounds = mBorder.getBounds();
        Rect newBounds = new Rect(0, mSearch.getMeasuredHeight() / 2, width, height);

        if (!stickHeader && !oldBounds.equals(newBounds)) {
            ObjectAnimator.ofObject(new BoundWrapper(oldBounds), "bound", new RectEvaluator(), oldBounds, newBounds).setDuration(200).start();
        }
    }
项目:ankihelper    文件:BigBangHeader.java   
@Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        int width = getMeasuredWidth();
        int height = getMeasuredHeight();

        layoutSubView(mSearch, mActionGap, 0);
        layoutSubView(mShare, 2 * mActionGap + mSearch.getMeasuredWidth(), 0);
        layoutSubView(mTrans, 3 * mActionGap + mTrans.getMeasuredWidth() + mShare.getMeasuredWidth(), 0);

//        layoutSubView(mSelectAll, 2 * mActionGap + mSearch.getMeasuredWidth() , 0);
//        layoutSubView(mSelectOther, 3 * mActionGap + mTrans.getMeasuredWidth()+ mShare.getMeasuredWidth() , 0);
//
//        layoutSubView(mDrag, width - mActionGap * 2 - mShare.getMeasuredWidth() - mCopy.getMeasuredWidth(), 0);
        layoutSubView(mCopy, width - mActionGap - mCopy.getMeasuredWidth(), 0);
        layoutSubView(mClose, ((width - (this.mActionGap * 2)) - this.mCopy.getMeasuredWidth()) - this.mClose.getMeasuredHeight(), 0);

        Rect oldBounds = mBorder.getBounds();
        Rect newBounds = new Rect(0, mSearch.getMeasuredHeight() / 2, width, height);

        if (!stickHeader && !oldBounds.equals(newBounds)) {
            ObjectAnimator.ofObject(new BoundWrapper(oldBounds), "bound", new RectEvaluator(), oldBounds, newBounds).setDuration(200).start();
        }
    }
项目:AndroidStudyDemo    文件:ObjectPropertyAnimActivity.java   
public void startRectAnimation(View v) {
    Rect local = new Rect();
    mShowAnimIV.getLocalVisibleRect(local);
    Rect from = new Rect(local);
    Rect to = new Rect(local);

    from.right = from.left + local.width()/4;
    from.bottom = from.top + local.height()/2;

    to.left = to.right - local.width()/2;
    to.top = to.bottom - local.height()/4;

    if (Build.VERSION.SDK_INT >= 18) {
        ObjectAnimator objectAnimator = ObjectAnimator.ofObject(mShowAnimIV, "clipBounds", new RectEvaluator(), from, to);
        objectAnimator.setDuration(C.Int.ANIM_DURATION * 4);
        objectAnimator.start();
    }
}
项目:cogitolearning-examples    文件:PropertyAnimation06.java   
@SuppressLint("NewApi")
public void startRectAnimation(View view)
{    
  View someImage = findViewById(R.id.some_image);
  Rect local = new Rect();
  someImage.getLocalVisibleRect(local);
  Rect from = new Rect(local);
  Rect to = new Rect(local);

  from.right = from.left + local.width()/4;
  from.bottom = from.top + local.height()/2;

  to.left = to.right - local.width()/2;
  to.top = to.bottom - local.height()/4;

  if (android.os.Build.VERSION.SDK_INT >= 18)
  {
    ObjectAnimator anim = ObjectAnimator.ofObject(someImage, "clipBounds", new RectEvaluator(), from, to);
    anim.setDuration(2000);
    anim.start();
  }

}