Browse Source
Merge pull request #28 from ammargitham/fix-serialization-error-for-spannablestring
change SpannableString to html to fix NotSerializableException
legacy
Austin Huang
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
5 additions and
6 deletions
-
app/src/main/java/awais/instagrabber/adapters/MessageItemsAdapter.java
-
app/src/main/java/awais/instagrabber/utils/Utils.java
|
|
@ -159,6 +159,9 @@ public final class MessageItemsAdapter extends RecyclerView.Adapter<TextMessageV |
|
|
|
DirectItemMediaModel mediaModel = directItemModel.getMediaModel(); |
|
|
|
switch (itemType) { |
|
|
|
case PLACEHOLDER: |
|
|
|
holder.tvMessage.setText(HtmlCompat.fromHtml(directItemModel.getText().toString(), 63)); |
|
|
|
holder.tvMessage.setVisibility(View.VISIBLE); |
|
|
|
break; |
|
|
|
case TEXT: |
|
|
|
text = directItemModel.getText(); |
|
|
|
text = Utils.getSpannableUrl(text.toString()); // for urls |
|
|
|
|
|
@ -655,14 +655,10 @@ public final class Utils { |
|
|
|
|
|
|
|
case PLACEHOLDER: { |
|
|
|
final JSONObject placeholder = itemObject.getJSONObject("placeholder"); |
|
|
|
|
|
|
|
final String title = placeholder.getString("title"); |
|
|
|
final String message = placeholder.getString("message"); |
|
|
|
|
|
|
|
final SpannableString spannableString = new SpannableString(title + '\n' + message); |
|
|
|
spannableString.setSpan(new RelativeSizeSpan(1.15f), 0, title.length(), 0); |
|
|
|
|
|
|
|
text = hasMentions(message) ? getMentionText(spannableString) : spannableString; |
|
|
|
final String string = title + "<br><small>" + message + "</small>"; |
|
|
|
text = hasMentions(message) ? getMentionText(string) : string; |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|