public class ComponentHost extends Host implements DisappearingHost
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.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PARTIAL_ALPHA_TEXTURE_TOO_BIG |
static java.lang.String |
TEXTURE_TOO_BIG |
static java.lang.String |
TEXTURE_ZERO_DIM |
Constructor and Description |
---|
ComponentHost(Context context) |
ComponentHost(Context context,
AttributeSet attrs) |
Modifier and Type | Method and Description |
---|---|
void |
addView(View child)
Deprecated.
|
void |
addView(View child,
int index)
Deprecated.
|
void |
addView(View child,
int index,
ViewGroup.LayoutParams params)
Deprecated.
|
void |
addViewForTest(View view)
Manually adds a View as a child of this ComponentHost for the purposes of testing.
|
protected boolean |
addViewInLayout(View child,
int index,
ViewGroup.LayoutParams params,
boolean preventRequestLayout)
Deprecated.
|
protected void |
attachViewToParent(View child,
int index,
ViewGroup.LayoutParams params)
Deprecated.
|
void |
dispatchDraw(Canvas canvas) |
boolean |
dispatchHoverEvent(MotionEvent event) |
protected void |
drawableStateChanged() |
boolean |
finaliseDisappearingItem(MountItem disappearingItem)
In this method we finally remove the mountItem from the drawing pass.
|
protected int |
getChildDrawingOrder(int childCount,
int i) |
boolean |
getClipChildren() |
com.facebook.litho.ComponentTouchListener |
getComponentTouchListener() |
java.lang.CharSequence |
getContentDescription() |
java.util.List<java.lang.CharSequence> |
getContentDescriptions() |
java.util.List<java.lang.String> |
getContentNames() |
java.util.List<Drawable> |
getDrawables() |
ImageContent |
getImageContent() |
protected java.util.Map<java.lang.String,java.lang.Object> |
getLayoutErrorMetadata(int width,
int height) |
java.util.List<Drawable> |
getLinkedDrawablesForAnimation()
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.
|
MountItem |
getMountItemAt(int index) |
int |
getMountItemCount() |
java.lang.Object |
getTag(int key) |
TextContent |
getTextContent() |
boolean |
hasOverlappingRendering() |
void |
jumpDrawablesToCurrentState() |
void |
mount(int index,
MountItem mountItem)
Mounts the given
MountItem with unique index. |
void |
mount(int index,
MountItem mountItem,
Rect bounds)
Mounts the given
MountItem with unique index. |
void |
moveItem(MountItem item,
int oldIndex,
int newIndex)
Moves the MountItem associated to oldIndex in the newIndex position.
|
boolean |
onInterceptTouchEvent(MotionEvent ev) |
protected void |
onLayout(boolean changed,
int l,
int t,
int r,
int b) |
boolean |
onTouchEvent(MotionEvent event) |
boolean |
performAccessibilityAction(int action,
Bundle arguments) |
protected void |
refreshAccessibilityDelegatesIfNeeded(boolean isAccessibilityEnabled) |
void |
removeAllViewsInLayout()
Deprecated.
|
protected void |
removeDetachedView(View child,
boolean animate)
Deprecated.
|
void |
removeView(View view)
Deprecated.
|
void |
removeViewAt(int index)
Deprecated.
|
void |
removeViewInLayout(View view)
Deprecated.
|
void |
removeViews(int start,
int count)
Deprecated.
|
void |
removeViewsInLayout(int start,
int count)
Deprecated.
|
void |
requestLayout() |
void |
setAccessibilityDelegate(View.AccessibilityDelegate accessibilityDelegate) |
void |
setAlpha(float alpha) |
void |
setClipChildren(boolean clipChildren) |
void |
setContentDescription(java.lang.CharSequence contentDescription)
Host views implement their own content description handling instead of just delegating to the
underlying view framework for performance reasons as the framework sets/resets content
description very frequently on host views and the underlying accessibility notifications might
cause performance issues.
|
void |
setInLayout() |
void |
setTag(int key,
java.lang.Object tag) |
void |
setViewTags(<any> viewTags)
Sets view tags on this host.
|
void |
setVisibility(int visibility) |
boolean |
shouldDelayChildPressedState() |
protected boolean |
shouldRequestLayout() |
void |
startDisappearingMountItem(MountItem mountItem)
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.
|
void |
unmount(int index,
MountItem mountItem)
Unmounts the given
MountItem with unique index. |
void |
unmount(MountItem item)
Unmounts the given
MountItem |
void |
unsetInLayout() |
protected boolean |
verifyDrawable(Drawable who) |
getDescriptionOfMountedItems, safelyUnmountAll
public static final java.lang.String TEXTURE_TOO_BIG
public static final java.lang.String TEXTURE_ZERO_DIM
public static final java.lang.String PARTIAL_ALPHA_TEXTURE_TOO_BIG
public ComponentHost(Context context)
public ComponentHost(Context context, AttributeSet attrs)
public void mount(int index, MountItem mountItem)
Host
MountItem
with unique index.public void mount(int index, MountItem mountItem, Rect bounds)
MountItem
with unique index.index
- index of the MountItem
. Guaranteed to be the same index as is passed for
the corresponding unmount(index, mountItem)
call.mountItem
- item to be mounted into the host.bounds
- the bounds of the item that is to be mounted into the hostpublic void unmount(MountItem item)
Host
MountItem
public void unmount(int index, MountItem mountItem)
MountItem
with unique index.public void startDisappearingMountItem(MountItem mountItem)
startDisappearingMountItem
in interface DisappearingHost
mountItem
- public boolean finaliseDisappearingItem(MountItem disappearingItem)
DisappearingHost
finaliseDisappearingItem
in interface DisappearingHost
true
iff the item was removed from the Host.public int getMountItemCount()
getMountItemCount
in class Host
MountItem
s that are currently mounted in the host.public MountItem getMountItemAt(int index)
getMountItemAt
in class Host
MountItem
that was mounted with the given index.public java.util.List<Drawable> getDrawables()
public java.util.List<java.lang.String> getContentNames()
public TextContent getTextContent()
public ImageContent getImageContent()
public java.lang.CharSequence getContentDescription()
public void setContentDescription(java.lang.CharSequence contentDescription)
public void setTag(int key, java.lang.Object tag)
public void moveItem(MountItem item, int oldIndex, int newIndex)
unmount(int, MountItem)
or moveItem(MountItem, int, int)
.public void setViewTags(<any> viewTags)
viewTags
- the map containing the tags by id.public boolean onInterceptTouchEvent(MotionEvent ev)
public com.facebook.litho.ComponentTouchListener getComponentTouchListener()
public boolean dispatchHoverEvent(MotionEvent event)
public java.util.List<java.lang.CharSequence> getContentDescriptions()
public void dispatchDraw(Canvas canvas)
protected int getChildDrawingOrder(int childCount, int i)
public boolean shouldDelayChildPressedState()
public boolean onTouchEvent(MotionEvent event)
protected final void onLayout(boolean changed, int l, int t, int r, int b)
public void requestLayout()
protected boolean shouldRequestLayout()
protected boolean verifyDrawable(Drawable who)
protected void drawableStateChanged()
public void jumpDrawablesToCurrentState()
public void setVisibility(int visibility)
public java.lang.Object getTag(int key)
protected void refreshAccessibilityDelegatesIfNeeded(boolean isAccessibilityEnabled)
public void setAccessibilityDelegate(View.AccessibilityDelegate accessibilityDelegate)
public void setClipChildren(boolean clipChildren)
setClipChildren
in class Host
public boolean getClipChildren()
getClipChildren
in class Host
@Deprecated public void addView(View child)
@Deprecated public void addView(View child, int index)
@Deprecated public void addView(View child, int index, ViewGroup.LayoutParams params)
@Deprecated protected boolean addViewInLayout(View child, int index, ViewGroup.LayoutParams params, boolean preventRequestLayout)
@Deprecated protected void attachViewToParent(View child, int index, ViewGroup.LayoutParams params)
@Deprecated public void removeView(View view)
@Deprecated public void removeViewInLayout(View view)
@Deprecated public void removeViewsInLayout(int start, int count)
@Deprecated public void removeViewAt(int index)
@Deprecated public void removeViews(int start, int count)
@Deprecated public void removeAllViewsInLayout()
@Deprecated protected void removeDetachedView(View child, boolean animate)
public void addViewForTest(View view)
public java.util.List<Drawable> getLinkedDrawablesForAnimation()
The core purpose of exposing these drawables is so that when animating the bounds of this ComponentHost, we also properly animate the bounds of its contained Drawables at the same time.
public boolean performAccessibilityAction(int action, Bundle arguments)
public boolean hasOverlappingRendering()
protected java.util.Map<java.lang.String,java.lang.Object> getLayoutErrorMetadata(int width, int height)
public void setAlpha(float alpha)
public void setInLayout()
setInLayout
in class Host
public void unsetInLayout()
unsetInLayout
in class Host