Animated TextView effects for Android
- Modular TextEffects (on-going)
- TypeWriterEffect
- Customizable
- Lightweight (Low Memory Usage)
- Thread safe
- Supports character and word animation
- Option for custom delay
- Option for custom string to best animated for a specific view
- Option for callback after the animation
- Supports loop configuration
- Passing of custom delimiter using Regex pattern
- Added removal of callbacks
- Optimized method invocations
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
// Replace version with release version, e.g. 1.0.0-alpha, -SNAPSHOT
implementation 'io.jmdg:typedkt:[VERSION]'
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
bt_animate.setOnClickListener {
// Animate view with XML configuration
tkv_animate_xml.animateText()
// Animate by characters
tkv_character.setLooped(true)
// Setup options before calling this method for it to take effect
tkv_character.animateText()
// Animate by word
tkv_words.setAnimationByWord()
tkv_words.setEndAnimationListener {
callSomeMethod()
}
tkv_words.setLooped(true)
// Setup options before calling this method for it to take effect
tkv_words.animateText()
}
bt_skip.setOnClickListener {
tkv_character.skipAnimation()
tkv_words.skipAnimation()
}
bt_stop.setOnClickListener {
tkv_character.stopAnimation()
tkv_words.stopAnimation()
}
}
tkv_character.setLooped(true) // default false
tkv_character.setDelay(100) // default 150
tkv_character.setAnimationByCharacter() // default animation
tkv_character.setAnimationByWord() // default by character
tkv_character.setAnimationByWord("regex pattern") // default delimiter is "\\s+" which denotes space
tkv_character.setEndAnimationListener { // default null
callSomeMethod()
}
<io.jmdg.typedkt.TypedKtView
...
app:animateOnLoad="false"
app:delay="150"
app:isAnimatedByWord="false"
app:isLooped="false"/>
override fun onResume() {
super.onResume()
// Resume animation
if(tkv_animate_xml.isAnimating()){
tkv_animate_xml.animateText()
}
if(tkv_character.isAnimating()){
tkv_character.animateText()
}
if(tkv_words.isAnimating()){
tkv_words.animateText()
}
}
override fun onPause() {
super.onPause()
// Pause animation
tkv_animate_xml.skipAnimation()
tkv_character.skipAnimation()
tkv_words.skipAnimation()
}
override fun onDestroy() {
super.onDestroy()
// Remove callbacks
tkv_animate_xml.removeAnimation()
tkv_character.removeAnimation()
tkv_words.removeAnimation()
}
Joshua de Guzman | code@jmdg.io
Distributed under the MIT license.
- Fork it (https://github.com/joshuadeguzman/ButtonsKt/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request