-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback
,android.view.KeyEvent.Callback
,android.view.ViewManager
,android.view.ViewParent
,android.view.accessibility.AccessibilityEventSource
,com.facebook.react.touch.ReactHitSlopView
,com.facebook.react.touch.ReactInterceptingViewGroup
,com.facebook.react.uimanager.ReactClippingViewGroup
,com.facebook.react.uimanager.ReactOverflowView
,com.facebook.react.uimanager.ReactOverflowViewWithInset
,com.facebook.react.uimanager.ReactPointerEventsView
,com.facebook.react.uimanager.ReactZIndexedViewGroup
public class ReactViewGroup extends ViewGroup implements ReactInterceptingViewGroup, ReactClippingViewGroup, ReactPointerEventsView, ReactHitSlopView, ReactZIndexedViewGroup, ReactOverflowViewWithInset
Backing for a React View. Has support for borders, but since borders aren't common, lazy initializes most of the storage needed for them.
-
-
Constructor Summary
Constructors Constructor Description ReactViewGroup(Context context)
-
Method Summary
Modifier and Type Method Description void
onRtlPropertiesChanged(int layoutDirection)
void
requestLayout()
void
dispatchProvideStructure(ViewStructure structure)
void
setBackgroundColor(int color)
void
setBackground(Drawable drawable)
void
setTranslucentBackgroundDrawable(@Nullable() Drawable background)
void
setOnInterceptTouchEventListener(OnInterceptTouchEventListener listener)
A ViewGroup instance that implement this interface is responsible for storing thelistener passed as an argument and then calling from and returning the result. boolean
onInterceptTouchEvent(MotionEvent ev)
boolean
onTouchEvent(MotionEvent ev)
boolean
hasOverlappingRendering()
We override this to allow developers to determine whether they need offscreen alpha compositingor not. void
setNeedsOffscreenAlphaCompositing(boolean needsOffscreenAlphaCompositing)
See the documentation of needsOffscreenAlphaCompositing in View.js. void
setBorderWidth(int position, float width)
void
setBorderColor(int position, float rgb, float alpha)
void
setBorderRadius(float borderRadius)
void
setBorderRadius(float borderRadius, int position)
void
setBorderStyle(@Nullable() String style)
void
setRemoveClippedSubviews(boolean removeClippedSubviews)
Sets property {@code removeClippedSubviews}
as a result of property update in JS.boolean
getRemoveClippedSubviews()
Get the current value of {@code removeClippedSubviews}
property.void
getClippingRect(Rect outClippingRect)
Get rectangular bounds to which view is currently clipped to. void
updateClippingRect()
Notify view that clipping area may have changed and it should recalculate the list of childrenthat should be attached/detached. boolean
getChildVisibleRect(View child, Rect r, Point offset)
void
addView(View child, int index, ViewGroup.LayoutParams params)
void
removeView(View view)
void
removeViewAt(int index)
int
getZIndexMappedChildIndex(int index)
Determine the index of a child view at {@param index} considering z-index. void
updateDrawingOrder()
Redraw the view based on updated child z-index. PointerEvents
getPointerEvents()
Return the PointerEvents of the View. int
getBackgroundColor()
Rect
getHitSlopRect()
Called when determining the touch area of a view. void
setHitSlopRect(@Nullable() Rect rect)
void
setOverflow(String overflow)
String
getOverflow()
Gets the overflow state of a view. void
setOverflowInset(int left, int top, int right, int bottom)
Set the overflow inset rect values which indicate the extensions to the boundaries of currentview that wraps all of its children views Rect
getOverflowInset()
Get the overflow inset rect values which indicate the extensions to the boundaries of currentview that wraps all of its children views void
setOpacityIfPossible(float opacity)
void
setBackfaceVisibility(String backfaceVisibility)
void
setBackfaceVisibilityDependantOpacity()
-
Methods inherited from class android.view.ViewGroup
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addKeyboardNavigationClusters, addStatesFromChildren, addTouchables, addView, bringChildToFront, childDrawableStateChanged, childHasTransientStateChanged, clearChildFocus, clearDisappearingChildren, clearFocus, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPointerCaptureChanged, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchScrollCaptureSearch, dispatchSetActivated, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, endViewTransition, findFocus, findViewsWithText, focusSearch, focusableViewAvailable, gatherTransparentRegion, generateLayoutParams, getAccessibilityClassName, getChildAt, getChildCount, getChildMeasureSpec, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isLayoutSuppressed, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onDescendantInvalidated, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestSendAccessibilityEvent, onResolvePointerIcon, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, restoreDefaultFocus, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setTouchscreenBlocksFocus, setTransitionGroup, setWindowInsetsAnimationCallback, shouldDelayChildPressedState, showContextMenuForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, suppressLayout, updateViewLayout
-
Methods inherited from class android.view.View
addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, animate, announceForAccessibility, autofill, bringToFront, buildDrawingCache, buildLayer, callOnClick, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, checkInputConnectionProxy, clearAnimation, clearViewTranslationCallback, combineMeasuredStates, computeScroll, computeSystemWindowInsets, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, drawableHotspotChanged, findViewById, findViewWithTag, forceHasOverlappingRendering, forceLayout, generateDisplayHash, generateViewId, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContext, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getOverlay, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getReceiveContentMimeTypes, getResources, getRevealOnFocusHint, getRight, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTouchDelegate, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasPointerCapture, hasWindowFocus, inflate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingRelative, isPivotSet, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollContainer, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, measure, offsetLeftAndRight, offsetTopAndBottom, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDragEvent, onDrawForeground, onFilterTouchEventForSecurity, onFinishTemporaryDetach, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onRtlPropertiesChanged, onScreenStateChanged, onScrollCaptureSearch, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onVisibilityAggregated, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, performAccessibilityAction, performClick, performContextClick, performHapticFeedback, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidateDelayed, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestUnbufferedDispatch, requireViewById, resetPivot, resolveSize, resolveSizeAndState, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAlpha, setAnimation, setAnimationMatrix, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnReceiveContentListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPressed, setRenderEffect, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollX, setScrollY, setScrollbarFadingEnabled, setSelected, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setViewTranslationCallback, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, updateDragShadow, willNotCacheDrawing, willNotDraw
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
ReactViewGroup
ReactViewGroup(Context context)
-
-
Method Detail
-
onRtlPropertiesChanged
void onRtlPropertiesChanged(int layoutDirection)
-
requestLayout
void requestLayout()
-
dispatchProvideStructure
void dispatchProvideStructure(ViewStructure structure)
-
setBackgroundColor
void setBackgroundColor(int color)
-
setBackground
void setBackground(Drawable drawable)
-
setTranslucentBackgroundDrawable
void setTranslucentBackgroundDrawable(@Nullable() Drawable background)
-
setOnInterceptTouchEventListener
void setOnInterceptTouchEventListener(OnInterceptTouchEventListener listener)
A ViewGroup instance that implement this interface is responsible for storing thelistener passed as an argument and then calling from and returning the result. If some custom handling of thismethod apply for the view, it should be called after the listener returns and only in a casewhen it returns false.
- Parameters:
listener
- A callback that ViewGroup should delegate calls for to
-
onInterceptTouchEvent
boolean onInterceptTouchEvent(MotionEvent ev)
-
onTouchEvent
boolean onTouchEvent(MotionEvent ev)
-
hasOverlappingRendering
boolean hasOverlappingRendering()
We override this to allow developers to determine whether they need offscreen alpha compositingor not. See the documentation of needsOffscreenAlphaCompositing in View.js.
-
setNeedsOffscreenAlphaCompositing
void setNeedsOffscreenAlphaCompositing(boolean needsOffscreenAlphaCompositing)
See the documentation of needsOffscreenAlphaCompositing in View.js.
-
setBorderWidth
void setBorderWidth(int position, float width)
-
setBorderColor
void setBorderColor(int position, float rgb, float alpha)
-
setBorderRadius
void setBorderRadius(float borderRadius)
-
setBorderRadius
void setBorderRadius(float borderRadius, int position)
-
setBorderStyle
void setBorderStyle(@Nullable() String style)
-
setRemoveClippedSubviews
void setRemoveClippedSubviews(boolean removeClippedSubviews)
Sets property
{@code removeClippedSubviews}
as a result of property update in JS. Should becalled only from @{link ViewManager#updateView} method.Helper method applyRemoveClippedSubviewsProperty may beused by ViewManager subclass to apply this property based on property update map .
-
getRemoveClippedSubviews
boolean getRemoveClippedSubviews()
Get the current value of
{@code removeClippedSubviews}
property.
-
getClippingRect
void getClippingRect(Rect outClippingRect)
Get rectangular bounds to which view is currently clipped to. Called only on views that has set
{@code removeCLippedSubviews}
property value to{@code true}
.- Parameters:
outClippingRect
- output clipping rect should be written to this object.
-
updateClippingRect
void updateClippingRect()
Notify view that clipping area may have changed and it should recalculate the list of childrenthat should be attached/detached. This method should be called only when property
{@code * removeClippedSubviews}
is set to{@code true}
on a view.CAUTION: Views are responsible for calling updateClippingRect on it's children.This should happen if child implement ReactClippingViewGroup, return true from and clipping rect change of the current view may affect clippingrect of this child.
-
getChildVisibleRect
boolean getChildVisibleRect(View child, Rect r, Point offset)
-
addView
void addView(View child, int index, ViewGroup.LayoutParams params)
-
removeView
void removeView(View view)
-
removeViewAt
void removeViewAt(int index)
-
getZIndexMappedChildIndex
int getZIndexMappedChildIndex(int index)
Determine the index of a child view at {@param index} considering z-index.
- Parameters:
index
- The child view index
-
updateDrawingOrder
void updateDrawingOrder()
Redraw the view based on updated child z-index. This should be called after updating one of itschild z-index.
-
getPointerEvents
PointerEvents getPointerEvents()
Return the PointerEvents of the View.
-
getBackgroundColor
int getBackgroundColor()
-
getHitSlopRect
@Nullable() Rect getHitSlopRect()
Called when determining the touch area of a view.
-
setHitSlopRect
void setHitSlopRect(@Nullable() Rect rect)
-
setOverflow
void setOverflow(String overflow)
-
getOverflow
@Nullable() String getOverflow()
-
setOverflowInset
void setOverflowInset(int left, int top, int right, int bottom)
Set the overflow inset rect values which indicate the extensions to the boundaries of currentview that wraps all of its children views
-
getOverflowInset
Rect getOverflowInset()
Get the overflow inset rect values which indicate the extensions to the boundaries of currentview that wraps all of its children views
-
setOpacityIfPossible
void setOpacityIfPossible(float opacity)
-
setBackfaceVisibility
void setBackfaceVisibility(String backfaceVisibility)
-
setBackfaceVisibilityDependantOpacity
void setBackfaceVisibilityDependantOpacity()
-
-
-
-