To get a Git project into your build:
Step 1. Add the JitPack repository to your build file
Add it in your project level build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency to app level build.gradle file
dependencies {
implementation 'com.github.NitishGadangi:TypeWriter-TextView:v1.3'
}
Step 1. Add TypeWriterView to your XML file
<com.nitish.typewriterview.TypeWriterView
android:id="@+id/typeWriterView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
Step 2. Start animation in Activity or Fragment
TypeWriterView typeWriterView = findViewById(R.id.typeWriterView);
typeWriterView.animateText("Insert your text here");
Callback for OnAnimation End
typeWriterView.setOnAnimationChangeListener(new TypeWriterView.OnAnimationChangeListener() {
@Override
public void onAnimationEnd() {
//Do something
}
});
Other Functions
typeWriterView.isAnimationRunning(); //returns true if animation is still running
typeWriterView.stopAnimation(); //Stop the ongoing animation
typeWriterView.isTextInitialised(); //returns false if animation is not started
By default
avoidTextOverflowAtEdge = true;
characterDelay = 40; //in ms
You can modify the following values
//set characterDelay in ms
typeWriterView.setCharacterDelay(long millis);
//making this false will turnoff adding new line when the view hits the end of the view
typeWriterView.avoidTextOverflowAtEdge(boolean avoidTextOverflowAtEdge);
Pull requests are welcome, if you have any questions feel free to ping me.
Made with ❤️ by Nitish