@Override public void updateExtraData(ReactEditText view, Object extraData) { if (extraData instanceof ReactTextUpdate) { ReactTextUpdate update = (ReactTextUpdate) extraData; view.setPadding( (int) update.getPaddingLeft(), (int) update.getPaddingTop(), (int) update.getPaddingRight(), (int) update.getPaddingBottom()); if (update.containsImages()) { Spannable spannable = update.getText(); TextInlineImageSpan.possiblyUpdateInlineImageSpans(spannable, view); } view.maybeSetText(update); } }
@Override public void updateExtraData(ReactEditText view, Object extraData) { if (extraData instanceof float[]) { float[] padding = (float[]) extraData; view.setPadding( (int) Math.ceil(padding[0]), (int) Math.ceil(padding[1]), (int) Math.ceil(padding[2]), (int) Math.ceil(padding[3])); } else if (extraData instanceof ReactTextUpdate) { ReactTextUpdate update = (ReactTextUpdate) extraData; if (update.containsImages()) { Spannable spannable = update.getText(); TextInlineImageSpan.possiblyUpdateInlineImageSpans(spannable, view); } view.maybeSetText(update); } }
@Override protected boolean verifyDrawable(Drawable drawable) { if (mContainsImages && getText() instanceof Spanned) { Spanned text = (Spanned) getText(); TextInlineImageSpan[] spans = text.getSpans(0, text.length(), TextInlineImageSpan.class); for (TextInlineImageSpan span : spans) { if (span.getDrawable() == drawable) { return true; } } } return super.verifyDrawable(drawable); }
@Override public void invalidateDrawable(Drawable drawable) { if (mContainsImages && getText() instanceof Spanned) { Spanned text = (Spanned) getText(); TextInlineImageSpan[] spans = text.getSpans(0, text.length(), TextInlineImageSpan.class); for (TextInlineImageSpan span : spans) { if (span.getDrawable() == drawable) { invalidate(); } } } super.invalidateDrawable(drawable); }
@Override public void onDetachedFromWindow() { super.onDetachedFromWindow(); if (mContainsImages && getText() instanceof Spanned) { Spanned text = (Spanned) getText(); TextInlineImageSpan[] spans = text.getSpans(0, text.length(), TextInlineImageSpan.class); for (TextInlineImageSpan span : spans) { span.onDetachedFromWindow(); } } }
@Override public void onStartTemporaryDetach() { super.onStartTemporaryDetach(); if (mContainsImages && getText() instanceof Spanned) { Spanned text = (Spanned) getText(); TextInlineImageSpan[] spans = text.getSpans(0, text.length(), TextInlineImageSpan.class); for (TextInlineImageSpan span : spans) { span.onStartTemporaryDetach(); } } }
@Override public void onAttachedToWindow() { super.onAttachedToWindow(); if (mContainsImages && getText() instanceof Spanned) { Spanned text = (Spanned) getText(); TextInlineImageSpan[] spans = text.getSpans(0, text.length(), TextInlineImageSpan.class); for (TextInlineImageSpan span : spans) { span.onAttachedToWindow(); } } }
@Override public void onFinishTemporaryDetach() { super.onFinishTemporaryDetach(); if (mContainsImages && getText() instanceof Spanned) { Spanned text = (Spanned) getText(); TextInlineImageSpan[] spans = text.getSpans(0, text.length(), TextInlineImageSpan.class); for (TextInlineImageSpan span : spans) { span.onFinishTemporaryDetach(); } } }
@Override public TextInlineImageSpan buildInlineImageSpan() { Resources resources = getThemedContext().getResources(); int width = (int) Math.ceil(mWidth); int height = (int) Math.ceil(mHeight); return new FrescoBasedReactTextInlineImageSpan( resources, height, width, getUri(), getHeaders(), getDraweeControllerBuilder(), getCallerContext()); }
@Override public TextInlineImageSpan buildInlineImageSpan() { Resources resources = getThemedContext().getResources(); int height = (int) Math.ceil(getStyleHeight()); int width = (int) Math.ceil(getStyleWidth()); return new FrescoBasedReactTextInlineImageSpan( resources, height, width, getUri(), getDraweeControllerBuilder(), getCallerContext()); }