mirror of
				https://codeberg.org/tom79/Fedilab.git
				synced 2025-10-20 11:20:16 +03:00 
			
		
		
		
	Fix issue #830 - Poll having html
This commit is contained in:
		
							parent
							
								
									7743de24d2
								
							
						
					
					
						commit
						75139a8523
					
				
					 2 changed files with 16 additions and 6 deletions
				
			
		|  | @ -61,7 +61,7 @@ public class Poll implements Serializable { | ||||||
|         public transient Spannable span_title; |         public transient Spannable span_title; | ||||||
| 
 | 
 | ||||||
|         public Spannable getSpanTitle(Context context, Status status, WeakReference<View> viewWeakReference) { |         public Spannable getSpanTitle(Context context, Status status, WeakReference<View> viewWeakReference) { | ||||||
|             span_title = SpannableHelper.convert(context, title, status, null, null, viewWeakReference); |             span_title = SpannableHelper.convert(context, title, status, null, null, viewWeakReference, null, false); | ||||||
|             return span_title; |             return span_title; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -95,12 +95,18 @@ public class SpannableHelper { | ||||||
| 
 | 
 | ||||||
|     public static Spannable convert(Context context, String text, |     public static Spannable convert(Context context, String text, | ||||||
|                                     Status status, Account account, Announcement announcement, WeakReference<View> viewWeakReference) { |                                     Status status, Account account, Announcement announcement, WeakReference<View> viewWeakReference) { | ||||||
|         return convert(context, text, status, account, announcement, viewWeakReference, null); |         return convert(context, text, status, account, announcement, viewWeakReference, null, true); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public static Spannable convert(Context context, String text, |     public static Spannable convert(Context context, String text, | ||||||
|                                     Status status, Account account, Announcement announcement, |                                     Status status, Account account, Announcement announcement, | ||||||
|                                     WeakReference<View> viewWeakReference, Status.Callback callback) { |                                     WeakReference<View> viewWeakReference, Status.Callback callback) { | ||||||
|  |         return convert(context, text, status, account, announcement, viewWeakReference, callback, true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public static Spannable convert(Context context, String text, | ||||||
|  |                                     Status status, Account account, Announcement announcement, | ||||||
|  |                                     WeakReference<View> viewWeakReference, Status.Callback callback, boolean convertHtml) { | ||||||
|         if (text == null) { |         if (text == null) { | ||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|  | @ -133,10 +139,14 @@ public class SpannableHelper { | ||||||
|         text = text.trim().replaceAll("\\s{3}", "   "); |         text = text.trim().replaceAll("\\s{3}", "   "); | ||||||
|         text = text.trim().replaceAll("\\s{2}", "  "); |         text = text.trim().replaceAll("\\s{2}", "  "); | ||||||
|         SpannableString initialContent; |         SpannableString initialContent; | ||||||
|  |         if (convertHtml) { | ||||||
|             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) |             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) | ||||||
|                 initialContent = new SpannableString(Html.fromHtml(text, Html.FROM_HTML_MODE_LEGACY)); |                 initialContent = new SpannableString(Html.fromHtml(text, Html.FROM_HTML_MODE_LEGACY)); | ||||||
|             else |             else | ||||||
|                 initialContent = new SpannableString(Html.fromHtml(text)); |                 initialContent = new SpannableString(Html.fromHtml(text)); | ||||||
|  |         } else { | ||||||
|  |             initialContent = new SpannableString(text); | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         //Get all links |         //Get all links | ||||||
|         SpannableStringBuilder content = new SpannableStringBuilder(initialContent); |         SpannableStringBuilder content = new SpannableStringBuilder(initialContent); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue