private boolean toolbarJoinsTabs() { return (mHeader.toolbar.getBottom() == mHeader.mPagerSlidingTabStrip.getTop() + ViewCompat.getTranslationY(mHeader.mPagerSlidingTabStrip)); }
public View findHeaderViewUnder(float x, float y) { for (RecyclerView.ViewHolder holder : mHeaderCache.values()) { final View child = holder.itemView; final float translationX = ViewCompat.getTranslationX(child); final float translationY = ViewCompat.getTranslationY(child); if (x >= child.getLeft() + translationX && x <= child.getRight() + translationX && y >= child.getTop() + translationY && y <= child.getBottom() + translationY) { return child; } } return null; }
public View findSubHeaderViewUnder(float x, float y) { for (RecyclerView.ViewHolder holder : mSubHeaderCache.values()) { final View child = holder.itemView; final float translationX = ViewCompat.getTranslationX(child); final float translationY = ViewCompat.getTranslationY(child); if (x >= child.getLeft() + translationX && x <= child.getRight() + translationX && y >= child.getTop() + translationY && y <= child.getBottom() + translationY) { return child; } } return null; }
public View findHeaderViewUnder(float x, float y) { for (RecyclerView.ViewHolder holder : mHeaderCache.values()) { final View child = holder.itemView; final float translationX = ViewCompat.getTranslationX(child); final float translationY = ViewCompat.getTranslationY(child); if (x >= child.getLeft() + translationX && x <= child.getRight() + translationX && y >= child.getTop() + translationY && y <= child.getBottom() + translationY) { return child; } } return null; }
private float getFabTranslationYForSnackbar(CoordinatorLayout parent, View fab) { float minOffset = 0; final List<View> dependencies = parent.getDependencies(fab); for (int i = 0, z = dependencies.size(); i < z; i++) { final View view = dependencies.get(i); if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(fab, view)) { minOffset = Math.min(minOffset, ViewCompat.getTranslationY(view) - view.getHeight()); } } return minOffset; }
private float getChildTranslationYForSnackbar(CoordinatorLayout parent, EhDrawerLayout child) { float minOffset = 0; final List<View> dependencies = parent.getDependencies(child); for (int i = 0, z = dependencies.size(); i < z; i++) { final View view = dependencies.get(i); if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(child, view)) { minOffset = Math.min(minOffset, ViewCompat.getTranslationY(view) - view.getHeight()); } } return minOffset; } }
@Override public void onAnimationUpdate(View view) { float height = ViewCompat.getTranslationY(v); fl.getLayoutParams().height = (int) height; fl.requestLayout(); } });
final float currentTransY = ViewCompat.getTranslationY(child);
Rect bounds = new Rect(0, 0, 0, 0); int transitionX = (int) ViewCompat.getTranslationX(child); int transitionY = (int) ViewCompat.getTranslationY(child); RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams(); bounds.left = parent.getPaddingLeft() +
Rect bounds = new Rect(0, 0, 0, 0); int transitionX = (int) ViewCompat.getTranslationX(child); int transitionY = (int) ViewCompat.getTranslationY(child); RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams(); bounds.top = parent.getPaddingTop() +
@Override public boolean animateMove(final RecyclerView.ViewHolder holder, int fromX, int fromY, int toX, int toY) { final View view = holder.itemView; fromX += ViewCompat.getTranslationX(holder.itemView); fromY += ViewCompat.getTranslationY(holder.itemView); resetAnimation(holder); int deltaX = toX - fromX; int deltaY = toY - fromY; if (deltaX == 0 && deltaY == 0) { dispatchMoveFinished(holder); return false; } if (deltaX != 0) { ViewCompat.setTranslationX(view, -deltaX); } if (deltaY != 0) { ViewCompat.setTranslationY(view, -deltaY); } mPendingMoves.add(new MoveInfo(holder, fromX, fromY, toX, toY)); return true; }
final float currentTransY = ViewCompat.getTranslationY(child); final float dy = currentTransY - targetTransY;
public void finishRefreshing() { if (mChildView != null) { ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView); viewPropertyAnimatorCompat.setDuration(200); viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView)); viewPropertyAnimatorCompat.translationY(0); viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator()); viewPropertyAnimatorCompat.start(); if (mMaterialHeaderView != null) { mMaterialHeaderView.onComlete(MaterialRefreshLayout.this); } else if (mSunLayout != null) { mSunLayout.onComlete(MaterialRefreshLayout.this); } if (refreshListener != null) { refreshListener.onfinish(); } } isRefreshing = false; progressValue = 0; }
@Override public boolean animateChange(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder, int fromX, int fromY, int toX, int toY) { if (oldHolder == newHolder) { // Don't know how to run change animations when the same view holder is re-used. // run a move animation to handle position changes. return animateMove(oldHolder, fromX, fromY, toX, toY); } final float prevTranslationX = ViewCompat.getTranslationX(oldHolder.itemView); final float prevTranslationY = ViewCompat.getTranslationY(oldHolder.itemView); final float prevAlpha = ViewCompat.getAlpha(oldHolder.itemView); resetAnimation(oldHolder); int deltaX = (int) (toX - fromX - prevTranslationX); int deltaY = (int) (toY - fromY - prevTranslationY); // recover prev translation state after ending animation ViewCompat.setTranslationX(oldHolder.itemView, prevTranslationX); ViewCompat.setTranslationY(oldHolder.itemView, prevTranslationY); ViewCompat.setAlpha(oldHolder.itemView, prevAlpha); if (newHolder != null) { // carry over translation values resetAnimation(newHolder); ViewCompat.setTranslationX(newHolder.itemView, -deltaX); ViewCompat.setTranslationY(newHolder.itemView, -deltaY); ViewCompat.setAlpha(newHolder.itemView, 0); } mPendingChanges.add(new ChangeInfo(oldHolder, newHolder, fromX, fromY, toX, toY)); return true; }
if (ViewCompat.getTranslationY(mChildView) >= mHeadHeight) { createAnimatorTranslationY(mChildView, mHeadHeight, mMaterialHeaderView); updateListener(); if (ViewCompat.getTranslationY(mChildView) >= mHeadHeight) { createAnimatorTranslationY(mChildView, mHeadHeight, mSunLayout); updateListener();
public static boolean hitTest(View v, int x, int y) { final int tx = (int) (ViewCompat.getTranslationX(v) + 0.5f); final int ty = (int) (ViewCompat.getTranslationY(v) + 0.5f); final int left = v.getLeft() + tx; final int right = v.getRight() + tx; final int top = v.getTop() + ty; final int bottom = v.getBottom() + ty; return (x >= left) && (x <= right) && (y >= top) && (y <= bottom); }
.getLayoutParams(); final int top = child.getBottom() + params.bottomMargin + Math.round(ViewCompat.getTranslationY(child)); final int bottom = top + mSpace; c.drawRect(left, top, right, bottom, mDividerPaint);
@Override public boolean onCheckCanStartDrag(TopicViewHolder holder, int position, int x, int y) { // x, y --- relative from the itemView's top-left final View containerView = holder.getSwipeableContainerView(); final int offsetX = containerView.getLeft() + (int) (ViewCompat.getTranslationX(containerView) + 0.5f); final int offsetY = containerView.getTop() + (int) (ViewCompat.getTranslationY(containerView) + 0.5f); return !topicFilter.isFilter() && ViewTools.hitTest(containerView, x - offsetX, y - offsetY); }
public void scrollToOpen(int duration) { float curTranslationY = ViewCompat.getTranslationY(mLayout); mOverScroller.startScroll(0, (int) curTranslationY, 0, (int) -curTranslationY, duration); start(); }
} else { translationX = ViewCompat.getTranslationX(popupView); translationY = ViewCompat.getTranslationY(popupView) - getStatusBarHeight();