android.graphics.Rect.setEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(155)

本文整理了Java中android.graphics.Rect.setEmpty方法的一些代码示例,展示了Rect.setEmpty的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rect.setEmpty方法的具体详情如下:
包路径:android.graphics.Rect
类名称:Rect
方法名:setEmpty

Rect.setEmpty介绍

[英]Set the rectangle to (0,0,0,0)
[中]将矩形设置为(0,0,0,0)

代码示例

代码示例来源:origin: facebook/litho

void release() {
  mTestKey = null;
  mLayoutOutputId = -1;
  mHostMarker = -1;
  mBounds.setEmpty();
 }
}

代码示例来源:origin: facebook/litho

void release() {
  mVisibleHeightRatio = 0;
  mVisibleWidthRatio = 0;
  mComponent = null;
  mVisibleEventHandler = null;
  mFocusedEventHandler = null;
  mUnfocusedEventHandler = null;
  mFullImpressionEventHandler = null;
  mInvisibleEventHandler = null;
  mVisibilityChangedEventHandler = null;

  mBounds.setEmpty();
 }
}

代码示例来源:origin: facebook/litho

void release() {
 mTestKey = null;
 mBounds.setEmpty();
 mHost = null;
 mAcquireKey = null;
}

代码示例来源:origin: ZieIony/Carbon

@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
              RecyclerView.State state) {
  outRect.setEmpty();
}

代码示例来源:origin: facebook/litho

void release() {
  mDelegateView = null;
  mDelegateBounds.setEmpty();
  mDelegateSlopBounds.setEmpty();
  mIsHandlingTouch = false;
  mSlop = 0;
  sPool.release(this);
 }
}

代码示例来源:origin: alexvasilkov/GestureViews

void clear() {
  if (view != null) {
    view.getViewTreeObserver().removeOnPreDrawListener(this);
  }
  pos.view.setEmpty();
  pos.viewport.setEmpty();
  pos.image.setEmpty();
  view = null;
  listener = null;
  isPaused = false;
}

代码示例来源:origin: robolectric/robolectric

@Implementation
protected void getBoundsInScreen(Rect outBounds) {
 if (boundsInScreen == null) {
  outBounds.setEmpty();
 } else {
  outBounds.set(boundsInScreen);
 }
}

代码示例来源:origin: facebook/litho

/**
 * 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();
}

代码示例来源:origin: facebook/litho

private static void release(Rect rect) {
  rect.setEmpty();
  sRectPool.release(rect);
 }
}

代码示例来源:origin: facebook/litho

void setMountStateDirty() {
 mMountState.setDirty();
 mPreviousMountVisibleRectBounds.setEmpty();
}

代码示例来源:origin: facebook/litho

public void unmountAllItems() {
 mMountState.unmountAllItems();
 mPreviousMountVisibleRectBounds.setEmpty();
}

代码示例来源:origin: facebook/litho

void unmountAllItems() {
 assertMainThread();
 if (mLayoutOutputsIds == null) {
  return;
 }
 for (int i = mLayoutOutputsIds.length - 1; i >= 0; i--) {
  unmountItem(i, mHostsByMarker);
 }
 mPreviousLocalVisibleRect.setEmpty();
 mNeedsRemount = true;
}

代码示例来源:origin: airbnb/epoxy

/**
 * 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;
}

代码示例来源:origin: facebook/litho

@ThreadSafe(enableChecks = false)
static void release(Rect rect) {
 if (ComponentsConfiguration.disablePools) {
  return;
 }
 rect.setEmpty();
 sRectPool.release(rect);
}

代码示例来源:origin: chentao0707/SimplifyReader

/**
 * 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();
}

代码示例来源:origin: facebook/stetho

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);
  }
 }
}

代码示例来源:origin: jeasonlzy/ImagePicker

@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;
  }
}

代码示例来源:origin: robolectric/robolectric

@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;
}

代码示例来源:origin: facebook/litho

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);
 }
}

代码示例来源:origin: facebook/stetho

@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);
}

相关文章