本文整理汇总了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);
}
}
示例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);
}
}
示例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));
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
});
}
示例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);
}
}
}
示例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();
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}