Skip to content

Instantly share code, notes, and snippets.

@shaobin0604
Created May 9, 2020 05:03
Show Gist options
  • Save shaobin0604/16380881bb78b119d59e8e3877fc9341 to your computer and use it in GitHub Desktop.
Save shaobin0604/16380881bb78b119d59e8e3877fc9341 to your computer and use it in GitHub Desktop.
lottie text delegate
# TextDelegateHack reflect TextDelegate#stringMap TextDelegate#invalidate
-keep class com.airbnb.lottie.TextDelegate { *; }
import com.airbnb.lottie.TextDelegate;
import org.joor.Reflect;
import java.util.Map;
public class TextDelegateHack {
private Reflect mTextDelegateRef;
public TextDelegateHack(TextDelegate textDelegate) {
mTextDelegateRef = Reflect.on(textDelegate);
}
public void setText(Map<String, String> replacement) {
Map<String, String> stringMap = mTextDelegateRef.get("stringMap");
stringMap.putAll(replacement);
mTextDelegateRef.call("invalidate");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment