-
- All Implemented Interfaces:
-
android.text.style.UpdateAppearance
,android.text.style.UpdateLayout
,com.facebook.react.views.text.ReactSpan
public class FrescoBasedReactTextInlineImageSpan extends TextInlineImageSpan
FrescoBasedTextInlineImageSpan is a span for Images that are inside . It computes its size based on the input size. When it is time to draw, it will use the Fresco framework to get the right Drawable and let that draw.
Since Fresco needs to callback to the TextView that contains this, in the ViewManager, you must tell the Span about the TextView
Note: It borrows code from DynamicDrawableSpan and if that code updates how it computes size or draws, we need to update this as well.
-
-
Constructor Summary
Constructors Constructor Description FrescoBasedReactTextInlineImageSpan(Resources resources, int height, int width, int tintColor, Uri uri, ReadableMap headers, AbstractDraweeControllerBuilder draweeControllerBuilder, Object callerContext, String resizeMode)
-
Method Summary
Modifier and Type Method Description void
onDetachedFromWindow()
The ReactTextView that holds this ImageSpan is responsible for passing these methods on so thatwe can do proper lifetime management for Fresco void
onStartTemporaryDetach()
Called by the text view from onStartTemporaryDetach. void
onAttachedToWindow()
Called by the text view from onAttachedToWindow. void
onFinishTemporaryDetach()
Called by the text view from onFinishTemporaryDetach. Drawable
getDrawable()
Get the drawable that is span represents. int
getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm)
void
setTextView(TextView textView)
Set the textview that will contain this span. void
draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint)
int
getWidth()
Get the width of the span. int
getHeight()
Get the height of the span. -
Methods inherited from class com.facebook.react.views.text.TextInlineImageSpan
possiblyUpdateInlineImageSpans
-
Methods inherited from class android.text.style.ReplacementSpan
draw, getContentDescription, getSize, setContentDescription, updateDrawState, updateMeasureState
-
Methods inherited from class android.text.style.MetricAffectingSpan
getUnderlying
-
Methods inherited from class android.text.style.CharacterStyle
getUnderlying, wrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
FrescoBasedReactTextInlineImageSpan
FrescoBasedReactTextInlineImageSpan(Resources resources, int height, int width, int tintColor, Uri uri, ReadableMap headers, AbstractDraweeControllerBuilder draweeControllerBuilder, Object callerContext, String resizeMode)
-
-
Method Detail
-
onDetachedFromWindow
void onDetachedFromWindow()
The ReactTextView that holds this ImageSpan is responsible for passing these methods on so thatwe can do proper lifetime management for Fresco
-
onStartTemporaryDetach
void onStartTemporaryDetach()
Called by the text view from onStartTemporaryDetach.
-
onAttachedToWindow
void onAttachedToWindow()
Called by the text view from onAttachedToWindow.
-
onFinishTemporaryDetach
void onFinishTemporaryDetach()
Called by the text view from onFinishTemporaryDetach.
-
getDrawable
@Nullable() Drawable getDrawable()
Get the drawable that is span represents.
-
getSize
int getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm)
-
setTextView
void setTextView(TextView textView)
Set the textview that will contain this span.
-
draw
void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint)
-
getWidth
int getWidth()
Get the width of the span.
-
getHeight
int getHeight()
Get the height of the span.
-
-
-
-