Changes mention and tag highlighting in the composer to use Mastodon's regex. Closes #145 Also, does some haphazard cleanup.
This commit is contained in:
parent
6b0ae5be95
commit
5d621cecda
7 changed files with 83 additions and 60 deletions
|
|
@ -16,6 +16,7 @@
|
|||
package com.keylesspalace.tusky.json;
|
||||
|
||||
import android.text.Spanned;
|
||||
import android.text.SpannedString;
|
||||
|
||||
import com.emojione.Emojione;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
|
|
@ -28,7 +29,13 @@ import java.lang.reflect.Type;
|
|||
|
||||
public class SpannedTypeAdapter implements JsonDeserializer<Spanned> {
|
||||
@Override
|
||||
public Spanned deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
return HtmlUtils.fromHtml(Emojione.shortnameToUnicode(json.getAsString(), false));
|
||||
public Spanned deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
|
||||
throws JsonParseException {
|
||||
String string = json.getAsString();
|
||||
if (string != null) {
|
||||
return HtmlUtils.fromHtml(Emojione.shortnameToUnicode(string, false));
|
||||
} else {
|
||||
return new SpannedString("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue