Stop JumpingBeans animations to prevent leaks
masterstopJumping() on your JumpingBeans instance when the TextView is detached from the view tree or when the containing Activity/Fragment is paused. This ensures proper resource cleanup.repository·master·Indexed 22 days ago
https://github.com/frakbot/jumpingbeansAn Android library for adding animated 'jumping' text effects to TextViews, such as Hangouts-style typing indicators. It supports appending jumping dots or animating specific character ranges as blocks or waves. Includes a builder for customizing loop duration, wave patterns, and duty cycles.
stopJumping() on your JumpingBeans instance when the TextView is detached from the view tree or when the containing Activity/Fragment is paused. This ensures proper resource cleanup.To use JumpingBeans in your Android project, ensure jcenter() is included in your root build.gradle file, then add the dependency to your module's build.gradle.
// In root build.gradle
allprojects {
repositories {
jcenter()
}
}
// In module build.gradle
dependencies {
compile 'net.frakbot:jumpingbeans:1.3.0'
}To avoid resource waste and unexpected behavior, follow these rules:
TextView before calling stopJumping(); this causes unnecessary invalidation and wasted resources.JumpingBeans instance for every view.TextView; calling cleanup on one will affect all others on that view.textAllCaps.You can emulate the Hangouts-style typing indicator by appending three jumping dots to a TextView. This method automatically handles the trailing ... (either by using existing dots or appending them).
final TextView textView1 = (TextView) findViewById(R.id.jumping_text_1);
jumpingBeans1 = JumpingBeans.with(textView1)
.appendJumpingDots()
.build();You can animate a specific range of characters within a TextView. You can choose to animate them as a single block or as a wave.
final TextView textView2 = (TextView) findViewById(R.id.jumping_text_2);
jumpingBeans2 = JumpingBeans.with(textView2)
.makeTextJump(0, textView2.getText().toString().indexOf(' '))
.setIsWave(false)
.setLoopDuration(1000) // ms
.build();Use the JumpingBeans.Builder to fine-tune the animation behavior:
setIsWave(boolean): Set whether the animation follows a wave pattern.setLoopDuration(int): Set the duration of the animation loop in milliseconds.setWavePerCharDelay(int): Set the delay between characters in a wave animation.setAnimatedDutyCycle(float): Adjust the pause duration between jumping cycles.