private static View getLaidOutItemView(@Nullable RecyclerView.ViewHolder holder) { if (holder == null) { return null; } final View itemView = holder.itemView; if (!ViewCompat.isLaidOut(itemView)) { return null; } return itemView; }
/** Returns whether or not the view has been laid out **/ private static boolean isLaidOut(View view) { return ViewCompat.isLaidOut(view) && view.getWidth() > 0 && view.getHeight() > 0; }
assert tabContainer != null; if (ViewCompat.isLaidOut(tabContainer)) { this.layout.onGlobalLayout(); } else {
View view = item.getView(); if (!ViewCompat.isLaidOut(view)) { view.getViewTreeObserver().addOnGlobalLayoutListener( new LayoutListenerWrapper(view,
protected void replaceInternal(View outView, View inView, boolean animate) { if (animate && mFlipperAnimator != null && ViewCompat.isLaidOut(outView)) { mFlipperAnimator.animateFlip(outView, inView); } else { if (mFlipperAnimator != null && mFlipperAnimator.isAnimating()) { outView.animate().cancel(); inView.animate().cancel(); } outView.setVisibility(View.GONE); inView.setVisibility(View.VISIBLE); } } }
protected void adjustTabMode(int prevScrollX) { if (mAdjustTabModeRunnable != null) { return; } if (prevScrollX < 0) { prevScrollX = mTabLayout.getScrollX(); } if (ViewCompat.isLaidOut(mTabLayout)) { adjustTabModeInternal(mTabLayout, prevScrollX); } else { final int prevScrollX1 = prevScrollX; mAdjustTabModeRunnable = new Runnable() { @Override public void run() { mAdjustTabModeRunnable = null; adjustTabModeInternal(mTabLayout, prevScrollX1); } }; mTabLayout.post(mAdjustTabModeRunnable); } }
@Override public final void onScrolled(final RecyclerView recyclerView, final int dx, final int dy) { if (ViewCompat.isLaidOut(animatedView)) { boolean isScrollingUp = dy < 0; if (this.scrollingUp == null || this.scrollingUp != isScrollingUp) { this.scrollingUp = isScrollingUp; if (scrollingUp) { onScrollingUp(); notifyOnScrollingUp(animatedView, dy); } else { onScrollingDown(); notifyOnScrollingDown(animatedView, dy); } } } }