2017-03-09 09:19:03 +11:00
|
|
|
package com.keylesspalace.tusky;
|
|
|
|
|
|
|
|
import android.text.Spanned;
|
|
|
|
|
2017-03-10 02:59:18 +11:00
|
|
|
import com.emojione.Emojione;
|
2017-03-09 09:19:03 +11:00
|
|
|
import com.google.gson.JsonDeserializationContext;
|
|
|
|
import com.google.gson.JsonDeserializer;
|
|
|
|
import com.google.gson.JsonElement;
|
|
|
|
import com.google.gson.JsonParseException;
|
|
|
|
|
|
|
|
import java.lang.reflect.Type;
|
|
|
|
|
|
|
|
class SpannedTypeAdapter implements JsonDeserializer<Spanned> {
|
|
|
|
@Override
|
|
|
|
public Spanned deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
2017-03-10 02:59:18 +11:00
|
|
|
return HtmlUtils.fromHtml(Emojione.shortnameToUnicode(json.getAsString(), false));
|
2017-03-09 09:19:03 +11:00
|
|
|
}
|
|
|
|
}
|