mirror of
				https://codeberg.org/tom79/Fedilab.git
				synced 2025-10-20 11:20:16 +03:00 
			
		
		
		
	Fix mentions
This commit is contained in:
		
							parent
							
								
									865cf0686d
								
							
						
					
					
						commit
						3f9e221025
					
				
					 2 changed files with 9 additions and 2 deletions
				
			
		|  | @ -315,8 +315,8 @@ public class Helper { | |||
| 
 | ||||
|     public static final Pattern hashtagPattern = Pattern.compile("(#[\\w_A-zÀ-ÿ]+)"); | ||||
|     public static final Pattern groupPattern = Pattern.compile("(![\\w_]+)"); | ||||
|     public static final Pattern mentionPattern = Pattern.compile("^(@[\\w_]+)|\\s+(@[\\w_]+)"); | ||||
|     public static final Pattern mentionLongPattern = Pattern.compile("(@[\\w_-]+@[a-zA-Z0-9][a-zA-Z0-9.-]{1,61}[a-zA-Z0-9](?:\\.[a-zA-Z]{2,})+)"); | ||||
|     public static final Pattern mentionPattern = Pattern.compile("(@[\\w_.-]+)"); | ||||
|     public static final Pattern mentionLongPattern = Pattern.compile("(@[\\w_.-]+@[a-zA-Z0-9][a-zA-Z0-9.-]{1,61}[a-zA-Z0-9](?:\\.[a-zA-Z]{2,})+)"); | ||||
| 
 | ||||
|     public static final Pattern twitterPattern = Pattern.compile("((@[\\w]+)@twitter\\.com)"); | ||||
|     public static final Pattern youtubePattern = Pattern.compile("(www\\.|m\\.)?(youtube\\.com|youtu\\.be|youtube-nocookie\\.com)/(((?!([\"'<])).)*)"); | ||||
|  |  | |||
|  | @ -675,6 +675,13 @@ public class SpannableHelper { | |||
|             int matchEnd = matcher.end(); | ||||
|             String email = content.toString().substring(matchStart, matchEnd); | ||||
|             if (matchStart >= 0 && matchEnd <= content.toString().length() && matchEnd >= matchStart) { | ||||
|                 ClickableSpan[] clickableSpans = content.getSpans(matchStart, matchEnd, ClickableSpan.class); | ||||
|                 if (clickableSpans != null) { | ||||
|                     for (ClickableSpan clickableSpan : clickableSpans) { | ||||
|                         content.removeSpan(clickableSpan); | ||||
|                     } | ||||
|                 } | ||||
|                 content.removeSpan(clickableSpans); | ||||
|                 content.setSpan(new ClickableSpan() { | ||||
|                     @Override | ||||
|                     public void onClick(@NonNull View textView) { | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue