Splitflap, the Android Library
Splitflap is a configurable Android library designed to create vintage split-flap displays commonly found in train stations and airports of the bygone era. It provides a unique user interface (UI) component for developers to leverage and offers customization options for color, size, and animation of flaps.
Setting up Splitflap
Splitflap is easy to incorporate into an Android project. Here is a step-by-step guide to hooking it up:
- Add the JitPack repository to your build file (build.gradle at the end of repositories):
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency:
dependencies {
implementation 'com.github.yanex:splitflap:1.0.0'
}
Using Splitflap
Adding a Splitflap to your layout is as simple as adding any other view. A brief example of usage is given below:
Splitflap flap = new Splitflap(context);
flap.setAdapter(SplitflapAdapter.createFromCharacters(context, "ABCDEFGHIJKLMNO"));
flap.setCharAnimation(SplitflapAnimationBuilder.defaultAnim());
viewGroup.addView(flap);
Customizing Splitflap
Modifying the default configuration of Splitflap could not be easier. Here is an example of how you might customize a basic Splitflap object:
flap.setFlapSize(5); // Set the size of each flap
flap.setTextColor(Color.RED); // Set the text color
flap.setBackgroundColor(Color.BLACK); // Set the background color
flap.setCharAnimation(SplitflapAnimationBuilder.defaultAnim());
Contributions & Support
Splitflap is maintained by Yan Lechuga and contributions are always welcome. Please make sure to read the guidelines thoroughly before making a pull request. If you have any questions or issues, they should be reported on the GitHub issues page.