void release() { mTestKey = null; mLayoutOutputId = -1; mHostMarker = -1; mBounds.setEmpty(); } }
void release() { mVisibleHeightRatio = 0; mVisibleWidthRatio = 0; mComponent = null; mVisibleEventHandler = null; mFocusedEventHandler = null; mUnfocusedEventHandler = null; mFullImpressionEventHandler = null; mInvisibleEventHandler = null; mVisibilityChangedEventHandler = null; mBounds.setEmpty(); } }
void release() { mTestKey = null; mBounds.setEmpty(); mHost = null; mAcquireKey = null; }
@Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { outRect.setEmpty(); }
@Implementation protected void getBoundsInScreen(Rect outBounds) { if (boundsInScreen == null) { outBounds.setEmpty(); } else { outBounds.set(boundsInScreen); } }
/** * To be called whenever the components needs to start the mount process from scratch * e.g. when the component's props or layout change or when the components * gets attached to a host. */ void setDirty() { assertMainThread(); mIsDirty = true; mPreviousLocalVisibleRect.setEmpty(); }
private static void release(Rect rect) { rect.setEmpty(); sRectPool.release(rect); } }
void setMountStateDirty() { mMountState.setDirty(); mPreviousMountVisibleRectBounds.setEmpty(); }
public void unmountAllItems() { mMountState.unmountAllItems(); mPreviousMountVisibleRectBounds.setEmpty(); }
void unmountAllItems() { assertMainThread(); if (mLayoutOutputsIds == null) { return; } for (int i = mLayoutOutputsIds.length - 1; i >= 0; i--) { unmountItem(i, mHostsByMarker); } mPreviousLocalVisibleRect.setEmpty(); mNeedsRemount = true; }
/** * Update the visibility item according the current layout. * * @param view the current {@link com.airbnb.epoxy.EpoxyViewHolder}'s itemView * @param parent the {@link androidx.recyclerview.widget.RecyclerView} * @return true if the view has been measured */ boolean update(@NonNull View view, @NonNull RecyclerView parent, boolean detachEvent) { // Clear the rect before calling getLocalVisibleRect localVisibleRect.setEmpty(); boolean viewDrawn = view.getLocalVisibleRect(localVisibleRect) && !detachEvent; height = view.getHeight(); width = view.getWidth(); viewportHeight = parent.getHeight(); viewportWidth = parent.getWidth(); visibleHeight = viewDrawn ? localVisibleRect.height() : 0; visibleWidth = viewDrawn ? localVisibleRect.width() : 0; return height > 0 && width > 0; }
@ThreadSafe(enableChecks = false) static void release(Rect rect) { if (ComponentsConfiguration.disablePools) { return; } rect.setEmpty(); sRectPool.release(rect); }
/** * The list is empty. Clear everything out. */ void resetList() { removeAllViewsInLayout(); mFirstPosition = 0; mDataChanged = false; mNeedSync = false; mOldSelectedPosition = INVALID_POSITION; mOldSelectedRowId = INVALID_ROW_ID; mSelectedTop = 0; mSelectorRect.setEmpty(); invalidate(); }
private void highlightViewOnUiThread() { final View viewToHighlight = mViewToHighlight.getAndSet(null); Rect boundsToHighlight = mBoundsToHighlight.getAndSet(null); if (boundsToHighlight == null) { boundsToHighlight = mEmptyRect; } if (viewToHighlight == mHighlightedView && mHighlightedBounds.equals(boundsToHighlight)) { return; } if (mHighlightedView != null) { mHighlightOverlays.removeHighlight(mHighlightedView); } if (viewToHighlight != null) { mHighlightOverlays.highlightView( viewToHighlight, boundsToHighlight, mContentColor.get()); } mHighlightedView = viewToHighlight; if (boundsToHighlight == null) { mHighlightedBounds.setEmpty(); } else { mHighlightedBounds.set(boundsToHighlight); } } }
@Override public void onGlobalLayout() { rect.setEmpty(); rootView.getWindowVisibleDisplayFrame(rect); int heightDiff = 0; if (orientation == ORIENTATION_VERTICAL) { heightDiff = rootView.getHeight() - (rect.bottom - rect.top); } else if (orientation == ORIENTATION_HORIZONTAL) { heightDiff = rootView.getWidth() - (rect.right - rect.left); } int navigationBarHeight = Utils.hasVirtualNavigationBar(rootView.getContext()) ? Utils.getNavigationBarHeight(rootView.getContext()) : 0; if (heightDiff >= navigationBarHeight && heightDiff < navigationBarHeight * 2) { if (!isShowNavigationBar && listener != null) { listener.onNavigationBarShow(orientation, heightDiff); } isShowNavigationBar = true; } else { if (isShowNavigationBar && listener != null) { listener.onNavigationBarHide(orientation); } isShowNavigationBar = false; } }
@Implementation protected boolean getGlobalVisibleRect(Rect rect, Point globalOffset) { if (globalVisibleRect == null) { return directly().getGlobalVisibleRect(rect, globalOffset); } if (!globalVisibleRect.isEmpty()) { rect.set(globalVisibleRect); if (globalOffset != null) { rect.offset(-globalOffset.x, -globalOffset.y); } return true; } rect.setEmpty(); return false; }
void mount(LayoutState layoutState, Rect currentVisibleArea, boolean processVisibilityOutputs) { boolean rectNeedsRelease = false; if (mTransientStateCount > 0 && mComponentTree != null && mComponentTree.isIncrementalMountEnabled()) { // If transient state is set but the MountState is dirty we want to re-mount everything. // Otherwise, we don't need to do anything as the entire LithoView was mounted when the // transient state was set. if (!mMountState.isDirty()) { return; } else { currentVisibleArea = ComponentsPools.acquireRect(); currentVisibleArea.set(0, 0, getWidth(), getHeight()); rectNeedsRelease = true; processVisibilityOutputs = false; } } if (currentVisibleArea == null) { mPreviousMountVisibleRectBounds.setEmpty(); } else { mPreviousMountVisibleRectBounds.set(currentVisibleArea); } mMountState.mount(layoutState, currentVisibleArea, processVisibilityOutputs); if (rectNeedsRelease) { ComponentsPools.release(currentVisibleArea); } }
@Override public void highlightElement(Object element, int color) { verifyThreadAccess(); final HighlightableDescriptor descriptor = getHighlightableDescriptor(element); if (descriptor == null) { mHighlighter.clearHighlight(); return; } mHighlightingBoundsRect.setEmpty(); final View highlightingView = descriptor.getViewAndBoundsForHighlighting(element, mHighlightingBoundsRect); if (highlightingView == null) { mHighlighter.clearHighlight(); return; } mHighlighter.setHighlightedView( highlightingView, mHighlightingBoundsRect, color); }