当前位置: 首页>>代码示例>>Java>>正文


Java ViewCompat.postOnAnimation方法代码示例

本文整理汇总了Java中android.support.v4.view.ViewCompat.postOnAnimation方法的典型用法代码示例。如果您正苦于以下问题:Java ViewCompat.postOnAnimation方法的具体用法?Java ViewCompat.postOnAnimation怎么用?Java ViewCompat.postOnAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.view.ViewCompat的用法示例。


在下文中一共展示了ViewCompat.postOnAnimation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dimChildView

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void dimChildView(View v, float mag, int fadeColor) {
    LayoutParams lp = (LayoutParams) v.getLayoutParams();
    if (mag > 0.0f && fadeColor != 0) {
        int color = (((int) (((float) ((-16777216 & fadeColor) >>> 24)) * mag)) << 24) | (ViewCompat.MEASURED_SIZE_MASK & fadeColor);
        if (lp.dimPaint == null) {
            lp.dimPaint = new Paint();
        }
        lp.dimPaint.setColorFilter(new PorterDuffColorFilter(color, Mode.SRC_OVER));
        if (ViewCompat.getLayerType(v) != 2) {
            ViewCompat.setLayerType(v, 2, lp.dimPaint);
        }
        invalidateChildRegion(v);
    } else if (ViewCompat.getLayerType(v) != 0) {
        if (lp.dimPaint != null) {
            lp.dimPaint.setColorFilter(null);
        }
        DisableLayerRunnable dlr = new DisableLayerRunnable(v);
        this.mPostedRunnables.add(dlr);
        ViewCompat.postOnAnimation(this, dlr);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:22,代码来源:SlidingPaneLayout.java

示例2: onViewReleased

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void onViewReleased(View releasedChild, float xvel, float yvel) {
    int top;
    @State int targetState;
    if (mHideable && shouldHide(releasedChild, yvel)) {
        top = mParentHeight;
        targetState = STATE_HIDDEN;
    } else if (yvel <= 0.f) {
        int currentTop = releasedChild.getTop();
        if (Math.abs(currentTop - mAnchorOffset) < Math.abs(currentTop - mMinOffset)) {
            top = mAnchorOffset;
            targetState = STATE_ANCHOR;
        } else if (Math.abs(currentTop - mMinOffset) < Math.abs(currentTop - mMaxOffset)) {
            top = mMinOffset;
            targetState = STATE_EXPANDED;
        } else {
            top = mMaxOffset;
            targetState = STATE_COLLAPSED;
        }
    } else {
        top = mMaxOffset;
        targetState = STATE_COLLAPSED;
    }
    if (mViewDragHelper.settleCapturedViewAt(releasedChild.getLeft(), top)) {
        setStateInternal(STATE_SETTLING);
        ViewCompat.postOnAnimation(releasedChild, new SettleRunnable(releasedChild, targetState));
    } else {
        setStateInternal(targetState);
    }
}
 
开发者ID:alphater,项目名称:garras,代码行数:31,代码来源:AnchorSheetBehavior.java

示例3: startSettlingAnimation

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
void startSettlingAnimation(View child, int state) {
    int top;
    if (state == STATE_COLLAPSED) {
        top = mMaxOffset;
    } else if (state == STATE_EXPANDED) {
        top = mMinOffset;
    } else if (mHideable && state == STATE_HIDDEN) {
        top = mParentHeight;
    } else {
        throw new IllegalArgumentException("Illegal state argument: " + state);
    }
    setStateInternal(STATE_SETTLING);
    if (mViewDragHelper.smoothSlideViewTo(child, child.getLeft(), top)) {
        ViewCompat.postOnAnimation(child, new SettleRunnable(child, state));
    }
}
 
开发者ID:Krupen,项目名称:FabulousFilter,代码行数:17,代码来源:ViewPagerBottomSheetBehavior.java

示例4: onViewReleased

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void onViewReleased(View child, float xvel, float yvel) {
  // Reset the active pointer ID
  mActivePointerId = INVALID_POINTER_ID;

  final int childWidth = child.getWidth();
  int targetLeft;
  boolean dismiss = false;

  if (shouldDismiss(child, xvel)) {
        targetLeft = child.getLeft() < mOriginalCapturedViewLeft
            ? mOriginalCapturedViewLeft - childWidth
            : mOriginalCapturedViewLeft + childWidth;
    dismiss = true;
  } else {
    // Else, reset back to the original left
    targetLeft = mOriginalCapturedViewLeft;
  }

  if (mViewDragHelper.settleCapturedViewAt(targetLeft, child.getTop())) {
    ViewCompat.postOnAnimation(child, new SettleRunnable(child, dismiss));
  } else if (dismiss && mListener != null) {
    mListener.onDismiss(child);
  }
}
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:26,代码来源:SwipeDismissBehavior.java

示例5: dimChildView

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void dimChildView(View v, float mag, int fadeColor) {
    final LayoutParams lp = (LayoutParams) v.getLayoutParams();

    if (mag > 0 && fadeColor != 0) {
        final int baseAlpha = (fadeColor & 0xff000000) >>> 24;
        int imag = (int) (baseAlpha * mag);
        int color = imag << 24 | (fadeColor & 0xffffff);
        if (lp.dimPaint == null) {
            lp.dimPaint = new Paint();
        }
        lp.dimPaint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_OVER));
        if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_HARDWARE) {
            ViewCompat.setLayerType(v, ViewCompat.LAYER_TYPE_HARDWARE, lp.dimPaint);
        }
        invalidateChildRegion(v);
    } else if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_NONE) {
        if (lp.dimPaint != null) {
            lp.dimPaint.setColorFilter(null);
        }
        final DisableLayerRunnable dlr = new DisableLayerRunnable(v);
        mPostedRunnables.add(dlr);
        ViewCompat.postOnAnimation(this, dlr);
    }
}
 
开发者ID:Jusenr,项目名称:RX_Demo,代码行数:25,代码来源:ResideLayout.java

示例6: onViewReleased

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void onViewReleased(View releasedChild, float xvel, float yvel) {
    int top;
    @State int targetState;
    if (yvel < 0) { // Moving up
        top = mMinOffset;
        targetState = STATE_EXPANDED;
    } else if (mHideable && shouldHide(releasedChild, yvel)) {
        top = mParentHeight;
        targetState = STATE_HIDDEN;
    } else if (yvel == 0.f) {
        int currentTop = releasedChild.getTop();
        if (Math.abs(currentTop - mMinOffset) < Math.abs(currentTop - mMaxOffset)) {
            top = mMinOffset;
            targetState = STATE_EXPANDED;
        } else {
            top = mMaxOffset;
            targetState = STATE_COLLAPSED;
        }
    } else {
        top = mMaxOffset;
        targetState = STATE_COLLAPSED;
    }
    if (mViewDragHelper.settleCapturedViewAt(releasedChild.getLeft(), top)) {
        setStateInternal(STATE_SETTLING);
        ViewCompat.postOnAnimation(releasedChild,
                new SettleRunnable(releasedChild, targetState));
    } else {
        setStateInternal(targetState);
    }
}
 
开发者ID:OhMyLob,项目名称:Paper-Launcher,代码行数:32,代码来源:BottomSheetBehaviorV2.java

示例7: afterLayout

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void afterLayout(RecyclerView.Recycler recycler, RecyclerView.State state, int startPosition, int endPosition, int scrolled, LayoutManagerHelper helper) {
    super.afterLayout(recycler, state, startPosition, endPosition, scrolled, helper);

    if (startPosition > getRange().getUpper() || endPosition < getRange().getLower()) {
        return;
    }

    if (!state.isPreLayout() && helper.getChildCount() > 0) {
        // call after doing layout, to check whether there is a gap between staggered layout and other layouts
        ViewCompat.postOnAnimation(helper.getChildAt(0), checkForGapsRunnable);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:StaggeredGridLayoutHelper.java

示例8: afterLayout

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void afterLayout(RecyclerView.Recycler recycler, RecyclerView.State state, int startPosition, int endPosition, int scrolled, LayoutManagerHelper helper) {
    super.afterLayout(recycler, state, startPosition, endPosition, scrolled, helper);
    if (startPosition > getRange().getUpper() || endPosition < getRange().getLower()) {
        //do not in visible screen, skip
        return;
    }
    if (!state.isPreLayout() && helper.getChildCount() > 0) {
        // call after doing layout, to check whether there is a gap between staggered layout and other layouts
        ViewCompat.postOnAnimation(helper.getChildAt(0), checkForGapsRunnable);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:StaggeredGridLayoutHelper.java

示例9: startRotating

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void startRotating() {
    ViewCompat.postOnAnimation(this, new Runnable() {
        @Override
        public void run() {
            mCurrentDegree += 10;
            if (mCurrentDegree > 360) {
                mCurrentDegree = 0;
            }
            if (mIsRefreshing) {
                startRotating();
            }
            postInvalidate();
        }
    });
}
 
开发者ID:chengkun123,项目名称:ReadMark,代码行数:16,代码来源:StickyRefreshView.java

示例10: run

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void run() {
    if (mLayout != null && mOverScroller != null) {
        if (mOverScroller.computeScrollOffset()) {
            mLayout.setTranslationY(mOverScroller.getCurrY());
            ViewCompat.postOnAnimation(mLayout, this);
        } else {
            onFlingFinished(mLayout);
        }
    }
}
 
开发者ID:Othershe,项目名称:BehaviorDemo,代码行数:12,代码来源:MainHeaderBehavior.java

示例11: triggerUpdateProcessor

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
void triggerUpdateProcessor() {
    if (RecyclerView.this.mPostUpdatesOnAnimation && RecyclerView.this.mHasFixedSize && RecyclerView.this.mIsAttached) {
        ViewCompat.postOnAnimation(RecyclerView.this, RecyclerView.this.mUpdateChildViewsRunnable);
        return;
    }
    RecyclerView.this.mAdapterUpdateDuringMeasure = true;
    RecyclerView.this.requestLayout();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:RecyclerView.java

示例12: onStopNestedScroll

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, V child, View target) {
  if (child.getTop() == mMinOffset) {
    setStateInternal(STATE_EXPANDED);
    return;
  }
      if (mNestedScrollingChildRef == null || target != mNestedScrollingChildRef.get()
              || !mNestedScrolled) {
    return;
  }
  int top;
  int targetState;
  if (mLastNestedScrollDy > 0) {
    top = mMinOffset;
    targetState = STATE_EXPANDED;
  } else if (mHideable && shouldHide(child, getYVelocity())) {
    top = mParentHeight;
    targetState = STATE_HIDDEN;
  } else if (mLastNestedScrollDy == 0) {
    int currentTop = child.getTop();
    if (Math.abs(currentTop - mMinOffset) < Math.abs(currentTop - mMaxOffset)) {
      top = mMinOffset;
      targetState = STATE_EXPANDED;
    } else {
      top = mMaxOffset;
      targetState = STATE_COLLAPSED;
    }
  } else {
    top = mMaxOffset;
    targetState = STATE_COLLAPSED;
  }
  if (mViewDragHelper.smoothSlideViewTo(child, child.getLeft(), top)) {
    setStateInternal(STATE_SETTLING);
    ViewCompat.postOnAnimation(child, new SettleRunnable(child, targetState));
  } else {
    setStateInternal(targetState);
  }
  mNestedScrolled = false;
}
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:40,代码来源:BottomSheetBehavior.java

示例13: onViewReleased

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void onViewReleased(View releasedChild, float xvel, float yvel) {
    int top;
     int targetState;
    if (yvel < 0) { // Moving up
        top = mMinOffset;
        targetState = STATE_EXPANDED;
    } else if (mHideable && shouldHide(releasedChild, yvel)) {
        top = mParentHeight;
        targetState = STATE_HIDDEN;
    } else if (yvel == 0.f) {
        int currentTop = releasedChild.getTop();
        if (Math.abs(currentTop - mMinOffset) < Math.abs(currentTop - mMaxOffset)) {
            top = mMinOffset;
            targetState = STATE_EXPANDED;
        } else {
            top = mMaxOffset;
            targetState = STATE_COLLAPSED;
        }
    } else {
        top = mMaxOffset;
        targetState = STATE_COLLAPSED;
    }
    if (mViewDragHelper.settleCapturedViewAt(releasedChild.getLeft(), top)) {
        setStateInternal(STATE_SETTLING);
        ViewCompat.postOnAnimation(releasedChild,
                new SettleRunnable(releasedChild, targetState));
    } else {
        setStateInternal(targetState);
    }
}
 
开发者ID:Krupen,项目名称:FabulousFilter,代码行数:32,代码来源:ViewPagerBottomSheetBehavior.java

示例14: postOnAnimation

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
void postOnAnimation() {
    if (this.mEatRunOnAnimationRequest) {
        this.mReSchedulePostAnimationCallback = true;
        return;
    }
    RecyclerView.this.removeCallbacks(this);
    ViewCompat.postOnAnimation(RecyclerView.this, this);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:RecyclerView.java

示例15: onStopNestedScroll

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, V child, View target) {
    if (child.getTop() == mMinOffset) {
        setStateInternal(STATE_EXPANDED);
        return;
    }
    if (target != mNestedScrollingChildRef.get() || !mNestedScrolled) {
        return;
    }
    int top;
    int targetState;
    if (mHideable && shouldHide(child, getYVelocity())) {
        top = mParentHeight;
        targetState = STATE_HIDDEN;
    } else if (mLastNestedScrollDy >= 0) {
        int currentTop = child.getTop();
        if (Math.abs(currentTop - mAnchorOffset) < Math.abs(currentTop - mMinOffset)) {
            top = mAnchorOffset;
            targetState = STATE_ANCHOR;
        } else if (Math.abs(currentTop - mMinOffset) < Math.abs(currentTop - mMaxOffset)) {
            top = mMinOffset;
            targetState = STATE_EXPANDED;
        } else {
            top = mMaxOffset;
            targetState = STATE_COLLAPSED;
        }
    } else {
        top = mMaxOffset;
        targetState = STATE_COLLAPSED;
    }
    if (mViewDragHelper.smoothSlideViewTo(child, child.getLeft(), top)) {
        setStateInternal(STATE_SETTLING);
        ViewCompat.postOnAnimation(child, new SettleRunnable(child, targetState));
    } else {
        setStateInternal(targetState);
    }
    mNestedScrolled = false;
}
 
开发者ID:alphater,项目名称:garras,代码行数:39,代码来源:AnchorSheetBehavior.java


注:本文中的android.support.v4.view.ViewCompat.postOnAnimation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。