Created
May 9, 2020 05:03
-
-
Save shaobin0604/16380881bb78b119d59e8e3877fc9341 to your computer and use it in GitHub Desktop.
lottie text delegate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TextDelegateHack reflect TextDelegate#stringMap TextDelegate#invalidate | |
-keep class com.airbnb.lottie.TextDelegate { *; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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