LithoView

A ViewGroup that can host the mounted state of a Component.

Constructors

Link copied to clipboard
constructor(context: Context)
constructor(context: Context, @Nullable attrs: AttributeSet)
constructor(context: ComponentContext)
constructor(context: ComponentContext, @Nullable attrs: AttributeSet)

Types

Link copied to clipboard

Properties

Link copied to clipboard
val AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE: String = "creditCardExpirationDate"
Link copied to clipboard
val AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY: String = "creditCardExpirationDay"
val AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH: String = "creditCardExpirationMonth"
val AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR: String = "creditCardExpirationYear"
Link copied to clipboard
val AUTOFILL_HINT_CREDIT_CARD_NUMBER: String = "creditCardNumber"
Link copied to clipboard
val AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE: String = "creditCardSecurityCode"
Link copied to clipboard
val AUTOFILL_HINT_EMAIL_ADDRESS: String = "emailAddress"
Link copied to clipboard
Link copied to clipboard
val AUTOFILL_HINT_PASSWORD: String = "password"
Link copied to clipboard
Link copied to clipboard
val AUTOFILL_HINT_POSTAL_ADDRESS: String = "postalAddress"
Link copied to clipboard
val AUTOFILL_HINT_POSTAL_CODE: String = "postalCode"
Link copied to clipboard
val AUTOFILL_HINT_USERNAME: String = "username"
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val BadPivotClassErrorMessage: String = "Setting transform pivot is only supported on Views that implement SupportsPivotTransform. If it isn't possible to add this interface to the View in question, wrap this Component in a Row or Column and apply the transform and pivot there instead."
Link copied to clipboard
Link copied to clipboard

Sets a focus change listener on this host.

Link copied to clipboard

Sets a touch listener on this host.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val FOCUS_DOWN: Int = 130
Link copied to clipboard
Link copied to clipboard
val FOCUS_LEFT: Int = 17
Link copied to clipboard
val FOCUS_RIGHT: Int = 66
Link copied to clipboard
val FOCUS_UP: Int = 33
Link copied to clipboard
val FOCUSABLE: Int = 1
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val GONE: Int = 8
Link copied to clipboard
val HAPTIC_FEEDBACK_ENABLED: Int = 268435456
Link copied to clipboard
private open var hasTransientState: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val INVISIBLE: Int = 4
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val KEEP_SCREEN_ON: Int = 67108864
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val MEASURED_SIZE_MASK: Int = 16777215
Link copied to clipboard
val MEASURED_STATE_MASK: Int = -16777216
Link copied to clipboard
Link copied to clipboard
val NO_ID: Int = -1
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val PARTIAL_ALPHA_TEXTURE_TOO_BIG: String = "PartialAlphaTextureTooBig"
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val SIZE_UNSET: Int = -1
Link copied to clipboard
val SOUND_EFFECTS_ENABLED: Int = 134217728
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val VISIBLE: Int = 0
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
open fun addExtraDataToAccessibilityNodeInfo(info: AccessibilityNodeInfo, extraDataKey: String, arguments: Bundle)
Link copied to clipboard
open fun addFocusables(views: ArrayList<View>, direction: Int, focusableMode: Int)
Link copied to clipboard
open fun addKeyboardNavigationClusters(views: Collection<View>, direction: Int)
Link copied to clipboard
Link copied to clipboard
open fun addTouchables(views: ArrayList<View>)
Link copied to clipboard
open fun addView(child: View)

open fun addView(child: View)

Litho handles adding/removing views automatically using mount/unmount calls. Manually adding/ removing views will mess up Litho's bookkeeping of added views and cause weird crashes down the line.

Link copied to clipboard
fun addViewForTest(view: View)

Manually adds a View as a child of this ComponentHost for the purposes of testing. This should only be used for tests as this is not safe and will likely cause weird crashes if used in a production environment.

Link copied to clipboard
fun addViewTags(viewTags: SparseArray<Any>)

Add view tags to this host.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun autofill(value: AutofillValue)
Link copied to clipboard
open fun bringChildToFront(child: View)
Link copied to clipboard
open fun bringToFront()
Link copied to clipboard
Link copied to clipboard
open fun buildLayer()
Link copied to clipboard
open fun callOnClick(): Boolean
Link copied to clipboard
Link copied to clipboard
open fun cancelLongPress()
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun canScrollHorizontally(direction: Int): Boolean
Link copied to clipboard
open fun canScrollVertically(direction: Int): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun childHasTransientStateChanged(child: View, childHasTransientState: Boolean)
Link copied to clipboard
fun cleanup()

Clean up all fields to avoid being reused with an incorrect state.

Link copied to clipboard
open fun clearAnimation()
Link copied to clipboard
open fun clearChildFocus(child: View)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun clearFocus()
Link copied to clipboard
Link copied to clipboard
open fun combineMeasuredStates(curState: Int, newState: Int): Int
Link copied to clipboard
open fun computeScroll()
Link copied to clipboard
Link copied to clipboard
open fun create(context: Context, component: Component): LithoView
open fun create(context: ComponentContext, component: Component): LithoView
Create a new LithoView instance and initialize it with the given Component root.
open fun create(context: Context, componentTree: ComponentTree): LithoView
open fun create(context: ComponentContext, componentTree: ComponentTree): LithoView
Create a new LithoView instance and initialize it with a custom ComponentTree.
open fun create(context: Context, component: Component, controller: LithoVisibilityEventsController): LithoView

open fun create(context: ComponentContext, component: Component, controller: LithoVisibilityEventsController): LithoView
Creates a new LithoView and sets a new ComponentTree on it.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun dispatchCreateViewTranslationRequest(viewIds: Map<AutofillId, Array<Long>>, supportedFormats: Array<Int>, capability: TranslationCapability, requests: List<ViewTranslationRequest>)
Link copied to clipboard
open fun dispatchDisplayHint(hint: Int)
Link copied to clipboard
Link copied to clipboard
open fun dispatchDraw(canvas: Canvas)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun dispatchNestedFling(velocityX: Float, velocityY: Float, consumed: Boolean): Boolean
Link copied to clipboard
open fun dispatchNestedPreFling(velocityX: Float, velocityY: Float): Boolean
Link copied to clipboard
open fun dispatchNestedPreScroll(dx: Int, dy: Int, consumed: Array<Int>, offsetInWindow: Array<Int>): Boolean
Link copied to clipboard
open fun dispatchNestedScroll(dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, offsetInWindow: Array<Int>): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun dispatchScrollCaptureSearch(localVisibleRect: Rect, windowOffset: Point, targets: Consumer<ScrollCaptureTarget>)
Link copied to clipboard
open fun dispatchSetActivated(activated: Boolean)
Link copied to clipboard
open fun dispatchSetSelected(selected: Boolean)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun dispatchUnhandledMove(focused: View, direction: Int): Boolean
Link copied to clipboard
fun dispatchVisibilityEvent(visibilityEventType: Class<out Any>)

Dispatch a visibility events to all the components hosted in this BaseMountingView.

Link copied to clipboard
Link copied to clipboard
open fun dispatchWindowVisibilityChanged(visibility: Int)
Link copied to clipboard
open fun draw(canvas: Canvas)
Link copied to clipboard
Link copied to clipboard
open fun endViewTransition(view: View)
Link copied to clipboard
open fun finaliseDisappearingItem(mountItem: MountItem): Boolean
abstract fun finaliseDisappearingItem(p: MountItem): Boolean
Link copied to clipboard
open fun findFocus(): View
Link copied to clipboard
fun <T : View?> findViewById(id: Int): T
Link copied to clipboard
open fun findViewsWithText(outViews: ArrayList<View>, text: CharSequence, flags: Int)
Link copied to clipboard
fun <T : View?> findViewWithTag(tag: Any): T
Link copied to clipboard
Link copied to clipboard
open fun focusSearch(focused: View, direction: Int): View
Link copied to clipboard
open fun forceHasOverlappingRendering(hasOverlappingRendering: Boolean)
Link copied to clipboard
open fun forceLayout()
Link copied to clipboard
Link copied to clipboard
open fun generateDisplayHash(hashAlgorithm: String, bounds: Rect, executor: Executor, callback: DisplayHashResultCallback)
Link copied to clipboard
open fun generateViewId(): Int
Link copied to clipboard
Link copied to clipboard
fun getAccessibleMountItem(): MountItem

Hosts are guaranteed to have only one accessible component in them due to the way the view hierarchy is constructed in LayoutState. There might be other non-accessible components in the same hosts such as a background/foreground component though. This is why this method iterates over all mount items in order to find the accessible one.

Link copied to clipboard
open fun getAlpha(): Float
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getAttributeResolutionStack(attribute: Int): Array<Int>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getAutofillType(): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getBaseline(): Int
Link copied to clipboard
fun getBottom(): Int
Link copied to clipboard
Link copied to clipboard
open fun getChildAt(index: Int): View
Link copied to clipboard
open fun getChildCount(): Int
Link copied to clipboard
open fun getChildDrawingOrder(childCount: Int, i: Int): Int
Link copied to clipboard
open fun getChildMeasureSpec(spec: Int, padding: Int, childDimension: Int): Int
Link copied to clipboard
open fun getChildVisibleRect(child: View, r: Rect, offset: Point): Boolean
Link copied to clipboard
open fun getClipBounds(): Rect
open fun getClipBounds(outRect: Rect): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Sets a long click listener on this host.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getDefaultSize(size: Int, measureSpec: Int): Int
Link copied to clipboard
Link copied to clipboard
open fun getDisplay(): Display
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getDrawingRect(outRect: Rect)
Link copied to clipboard
open fun getDrawingTime(): Long
Link copied to clipboard
open fun getElevation(): Float
Link copied to clipboard
open fun getExplicitStyle(): Int
Link copied to clipboard
Link copied to clipboard
open fun getFocusable(): Int
Link copied to clipboard
open fun getFocusables(direction: Int): ArrayList<View>
Link copied to clipboard
open fun getFocusedChild(): View
Link copied to clipboard
open fun getFocusedRect(r: Rect)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getGlobalVisibleRect(r: Rect, globalOffset: Point): Boolean
Link copied to clipboard
open fun getHandler(): Handler
Link copied to clipboard
fun getHeight(): Int
Link copied to clipboard
open fun getHitRect(outRect: Rect)
Link copied to clipboard
Link copied to clipboard
For Litho we will use the root as hint for which is the hierarchy backed by the .
Link copied to clipboard
open fun getId(): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun getInitialAnimatedMountingViewHeight(currentAnimatedHeight: Int, hasNewComponentTree: Boolean): Int
Link copied to clipboard
fun getInitialAnimatedMountingViewWidth(currentAnimatedWidth: Int, hasNewComponentTree: Boolean): Int
Link copied to clipboard
Link copied to clipboard
open fun getLabelFor(): Int
Link copied to clipboard
open fun getLayerType(): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getLayoutMode(): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun getLeft(): Int
Link copied to clipboard

Returns the Drawables associated with this ComponentHost for animations, for example the background Drawable and/or the drawable that otherwise has a transitionKey on it that has caused it to be hosted in this ComponentHost.

Link copied to clipboard
Link copied to clipboard
open fun getLocationInSurface(location: Array<Int>)
Link copied to clipboard
open fun getLocationInWindow(outLocation: Array<Int>)
Link copied to clipboard
open fun getLocationOnScreen(outLocation: Array<Int>)
Link copied to clipboard
open fun getMatrix(): Matrix
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getMinimumHeight(): Int
Link copied to clipboard
open fun getMinimumWidth(): Int
Link copied to clipboard
fun getMountDelegateTarget(): MountDelegateTarget
Link copied to clipboard
open fun getMountItemAt(index: Int): MountItem
abstract fun getMountItemAt(p: Int): MountItem
Link copied to clipboard
abstract fun getMountItemCount(): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getNextFocusUpId(): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getPaddingBottom(): Int
Link copied to clipboard
open fun getPaddingEnd(): Int
Link copied to clipboard
open fun getPaddingLeft(): Int
Link copied to clipboard
open fun getPaddingRight(): Int
Link copied to clipboard
open fun getPaddingStart(): Int
Link copied to clipboard
open fun getPaddingTop(): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getPivotX(): Float
Link copied to clipboard
open fun getPivotY(): Float
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun getRight(): Int
Link copied to clipboard
open fun getRootView(): View
Link copied to clipboard
Link copied to clipboard
open fun getRotation(): Float
Link copied to clipboard
open fun getRotationX(): Float
Link copied to clipboard
open fun getRotationY(): Float
Link copied to clipboard
open fun getScaleX(): Float
Link copied to clipboard
open fun getScaleY(): Float
Link copied to clipboard
Link copied to clipboard
open fun getScrollBarSize(): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getSolidColor(): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getTag(): Any
open fun getTag(key: Int): Any
Link copied to clipboard
open fun getTextAlignment(): Int
Link copied to clipboard
Link copied to clipboard

This is a helper method to get all the text (as CharSequence) that is contained inside this ComponentHost.

Link copied to clipboard
open fun getTextDirection(): Int
Link copied to clipboard
Link copied to clipboard
fun getTop(): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getVisibility(): Int
Link copied to clipboard
fun getVisibilityExtensionState(): VisibilityMountExtension.VisibilityMountExtensionState
Link copied to clipboard
fun getWidth(): Int
Link copied to clipboard
open fun getWindowId(): WindowId
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getX(): Float
Link copied to clipboard
open fun getY(): Float
Link copied to clipboard
open fun getZ(): Float
Link copied to clipboard

When a ViewGroup gets a child with duplicateParentState=true added to it, it forever sets a flag (FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE) which makes the View crash if it ever has addStatesFromChildren set to true. We track this so we know not to recycle ComponentHosts that have had this flag set.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun hasFocus(): Boolean
Link copied to clipboard
open fun hasFocusable(): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun indexOfChild(child: View): Int
Link copied to clipboard
open fun inflate(context: Context, resource: Int, root: ViewGroup): View
Link copied to clipboard
open fun invalidate(dirty: Rect)
Link copied to clipboard
fun invalidateChild(child: View, dirty: Rect)
Link copied to clipboard
open fun invalidateChildInParent(location: Array<Int>, dirty: Rect): ViewParent
Link copied to clipboard
open fun invalidateDrawable(drawable: Drawable)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun isActivated(): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun isClickable(): Boolean
Link copied to clipboard
Link copied to clipboard
open fun isCredential(): Boolean
Link copied to clipboard
open fun isDirty(): Boolean
Link copied to clipboard
Link copied to clipboard
open fun isEnabled(): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun isFocused(): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun isHovered(): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun isInEditMode(): Boolean
Link copied to clipboard
open fun isInLayout(): Boolean
Link copied to clipboard
Link copied to clipboard
open fun isLaidOut(): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun isOpaque(): Boolean
Link copied to clipboard
Link copied to clipboard
open fun isPivotSet(): Boolean
Link copied to clipboard
Link copied to clipboard
open fun isPressed(): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun isSelected(): Boolean
Link copied to clipboard
Link copied to clipboard
open fun isShown(): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun isVisibleToUserForAutofill(virtualId: Int): Boolean
Link copied to clipboard
open fun keyboardNavigationClusterSearch(currentCluster: View, direction: Int): View
Link copied to clipboard
fun layout(l: Int, t: Int, r: Int, b: Int)
Link copied to clipboard

Invalidates the accessibility tree of this host if an AccessibilityDelegate is set and any children implement virtual views.

Link copied to clipboard
fun measure(widthMeasureSpec: Int, heightMeasureSpec: Int)
Link copied to clipboard
open fun mount(index: Int, mountItem: MountItem)
abstract fun mount(p: Int, p1: MountItem)
Link copied to clipboard
fun mountComponent(currentVisibleArea: Rect, processVisibilityOutputs: Boolean)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun moveItem(item: MountItem, oldIndex: Int, newIndex: Int)

Moves the MountItem associated to oldIndex in the newIndex position. This happens when a LithoView needs to re-arrange the internal order of its items. If an item is already present in newIndex the item is guaranteed to be either unmounted or moved to a different index by subsequent calls to either ComponentHost.unmount or ComponentHost.moveItem.

abstract fun moveItem(p: MountItem, p1: Int, p2: Int)
Link copied to clipboard
open fun notifySubtreeAccessibilityStateChanged(child: View, source: View, changeType: Int)
Link copied to clipboard
open fun notifyVisibleBoundsChanged(visibleRect: Rect, processVisibilityOutputs: