當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。