1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 22:57:29 +00:00

Merge pull request #28 from ammargitham/fix-serialization-error-for-spannablestring

change SpannableString to html to fix NotSerializableException
This commit is contained in:
Austin Huang 2020-08-05 10:59:49 -04:00 committed by GitHub
commit 0c02f6a47f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -159,6 +159,9 @@ public final class MessageItemsAdapter extends RecyclerView.Adapter<TextMessageV
DirectItemMediaModel mediaModel = directItemModel.getMediaModel(); DirectItemMediaModel mediaModel = directItemModel.getMediaModel();
switch (itemType) { switch (itemType) {
case PLACEHOLDER: case PLACEHOLDER:
holder.tvMessage.setText(HtmlCompat.fromHtml(directItemModel.getText().toString(), 63));
holder.tvMessage.setVisibility(View.VISIBLE);
break;
case TEXT: case TEXT:
text = directItemModel.getText(); text = directItemModel.getText();
text = Utils.getSpannableUrl(text.toString()); // for urls text = Utils.getSpannableUrl(text.toString()); // for urls

View File

@ -655,14 +655,10 @@ public final class Utils {
case PLACEHOLDER: { case PLACEHOLDER: {
final JSONObject placeholder = itemObject.getJSONObject("placeholder"); final JSONObject placeholder = itemObject.getJSONObject("placeholder");
final String title = placeholder.getString("title"); final String title = placeholder.getString("title");
final String message = placeholder.getString("message"); final String message = placeholder.getString("message");
final String string = title + "<br><small>" + message + "</small>";
final SpannableString spannableString = new SpannableString(title + '\n' + message); text = hasMentions(message) ? getMentionText(string) : string;
spannableString.setSpan(new RelativeSizeSpan(1.15f), 0, title.length(), 0);
text = hasMentions(message) ? getMentionText(spannableString) : spannableString;
} }
break; break;