Class TextDelegate


  • public class TextDelegate
    extends Object
    To replace static text in an animation at runtime, create an instance of this class and call setText(String, String) to replace the hard coded animation text (input) with the text of your choosing (output).

    Alternatively, extend this class and override getText(String) and if the text hasn't already been set by setText(String, String) then it will call getText(String).

    • Method Detail

      • getText

        public String getText​(String layerName,
                              String input)
        Override this to replace the animation text with something dynamic. This can be used for translations or custom data.
        Parameters:
        layerName - the name of the layer with text
        input - the string at the layer with text
        Returns:
        a String to use for the specific data, by default this is the same as getText(input)
      • getText

        public String getText​(String input)
        Override this to replace the animation text with something dynamic. This can be used for translations or custom data.
      • setText

        public void setText​(String input,
                            String output)
        Update the text that will be rendered for the given input text.
      • setCacheText

        public void setCacheText​(boolean cacheText)
        Sets whether or not TextDelegate will cache (memoize) the results of getText. If this isn't necessary then set it to false.
      • invalidateText

        public void invalidateText​(String input)
        Invalidates a cached string with the given input.
      • invalidateAllText

        public void invalidateAllText()
        Invalidates all cached strings.
      • getTextInternal

        public final String getTextInternal​(String layerName,
                                            String input)