ComponentHost
A ViewGroup that can host the mounted state of a Component. This is used by MountState to wrap mounted drawables to handle click events and update drawable states accordingly.
Inheritors
Constructors
Types
This exception is to allow us to identify potential wrong modifications of a ComponentHost. This can happen if clients get access to them (e.g. onVisibility callbacks) and then perform modifications such as setting click listeners/modifying alpha. It is important to identify these situations since it can break other behaviors such as host recycling.
This determines what is the actions to take if we detected an invalid modification of a ComponentHost.
Properties
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.
Sets a focus change listener on this host.
Sets a long click listener on this host.
Sets a touch listener on this host.
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.
An EventHandler that will be invoked when ComponentHost.onInterceptTouchEvent is called.
This is a helper method to get all the text (as CharSequence) that is contained inside this ComponentHost.
Functions
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.
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.
Add view tags to this host.
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.
Invalidates the accessibility tree of this host if an AccessibilityDelegate is set and any children implement virtual views.
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.
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.
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.
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.
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.
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.
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.
Sets the transform pivot of a View - used for scale and rotation transforms - to be centered at the given point, expressed as a percentage of the View's width and height. The default pivot point is (50f, 50f).
This method is needed because if the disappearing item ended up being remounted to the root, then the index can be different than the one it was created with.