Top Related Projects
Quick Overview
Ticker is a lightweight Android library for creating smooth, scrolling text animations. It's designed to display changing values, such as stock prices or sports scores, with a fluid rolling effect that mimics old-school flip boards or digital counters.
Pros
- Smooth and visually appealing text animations
- Highly customizable with various animation styles and attributes
- Easy to integrate into existing Android projects
- Supports both character-by-character and section-by-section animations
Cons
- Limited to Android platform only
- May impact performance if overused or implemented incorrectly
- Requires careful consideration of text size and animation speed for optimal readability
Code Examples
- Basic usage:
val tickerView = findViewById<TickerView>(R.id.tickerView)
tickerView.text = "Hello, Ticker!"
- Customizing animation:
tickerView.apply {
animationDuration = 1500
animationInterpolator = OvershootInterpolator()
gravity = Gravity.START
textSize = 24f
textColor = Color.BLACK
}
- Using character list:
tickerView.setCharacterList("0123456789$,.")
tickerView.setText("$123.45")
- Animating text change:
tickerView.setText("$987.65", true) // true enables animation
Getting Started
- Add the dependency to your
build.gradle
file:
dependencies {
implementation 'com.robinhood.ticker:ticker:2.0.4'
}
- Add the TickerView to your layout XML:
<com.robinhood.ticker.TickerView
android:id="@+id/tickerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
- Initialize and use the TickerView in your Activity or Fragment:
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val tickerView = findViewById<TickerView>(R.id.tickerView)
tickerView.text = "Hello, Ticker!"
}
}
Competitor Comparisons
Apache Flink
Pros of Flink
- Designed for large-scale data processing and streaming analytics
- Supports both batch and stream processing with a unified API
- Offers high scalability and fault tolerance for distributed environments
Cons of Flink
- Steeper learning curve due to its complex architecture and features
- Requires more system resources and setup compared to lightweight libraries
- May be overkill for simple UI animation tasks
Code Comparison
Ticker (Java):
ticker.addCharacterList(NUMBER_LIST);
ticker.setAnimationDuration(1500);
ticker.setPreferredScrollingDirection(ScrollingDirection.DOWN);
ticker.setText("$123.45");
Flink (Java):
DataStream<String> stream = env.addSource(new FlinkKafkaConsumer<>("topic", new SimpleStringSchema(), properties));
DataStream<Tuple2<String, Integer>> counts = stream
.flatMap(new Tokenizer())
.keyBy(value -> value.f0)
.window(TumblingProcessingTimeWindows.of(Time.seconds(5)))
.sum(1);
Summary
Flink is a powerful distributed data processing framework, while Ticker is a lightweight UI component for animated text. Flink excels in complex data processing tasks but may be excessive for simple UI animations. Ticker is more suitable for basic text animations in mobile apps but lacks the advanced data processing capabilities of Flink.
Apache Spark - A unified analytics engine for large-scale data processing
Pros of Spark
- Powerful distributed computing framework for big data processing
- Supports multiple programming languages (Scala, Java, Python, R)
- Extensive ecosystem with libraries for machine learning, graph processing, and streaming
Cons of Spark
- Steeper learning curve and more complex setup compared to Ticker
- Higher resource requirements and overhead for small-scale tasks
- Less suitable for real-time, low-latency financial data processing
Code Comparison
Ticker (Java):
Ticker ticker = new Ticker.Builder()
.formats(CharacterList.ALPHANUMERIC)
.build();
ticker.addCharacterList(CharacterList.PUNCTUATION);
Spark (Scala):
import org.apache.spark.sql.SparkSession
val spark = SparkSession.builder()
.appName("SimpleApp")
.getOrCreate()
val df = spark.read.json("path/to/file.json")
Summary
Spark is a comprehensive big data processing framework suitable for large-scale data analytics, while Ticker is a specialized library for displaying scrolling text animations. Spark offers more extensive capabilities but requires more resources and setup, whereas Ticker is simpler and focused on a specific use case in financial data display.
Mirror of Apache Kafka
Pros of Kafka
- Highly scalable and distributed streaming platform
- Supports complex event processing and real-time data pipelines
- Robust ecosystem with extensive tooling and integrations
Cons of Kafka
- Steeper learning curve and more complex setup
- Higher resource requirements for deployment and maintenance
- Overkill for simpler use cases or smaller-scale applications
Code Comparison
Kafka (Java):
Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
Producer<String, String> producer = new KafkaProducer<>(props);
Ticker (Java):
Ticker ticker = new Ticker.Builder()
.formats(Format.CURRENCY)
.priceDecimalPlaces(2)
.build();
ticker.setPrice(123.45f);
Summary
Kafka is a powerful distributed streaming platform suitable for large-scale data processing, while Ticker is a lightweight library for displaying financial data. Kafka offers more extensive features but requires more resources and setup, whereas Ticker is simpler and focused on a specific use case. The choice between them depends on the project's requirements and scale.
Apache Storm
Pros of Storm
- Designed for distributed real-time computation, handling large-scale data processing
- Supports multiple programming languages (Java, Python, etc.)
- Mature project with extensive documentation and community support
Cons of Storm
- More complex setup and configuration compared to Ticker
- Higher resource requirements for deployment and operation
- Steeper learning curve for developers new to distributed systems
Code Comparison
Storm (Java):
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("spout", new RandomSentenceSpout(), 5);
builder.setBolt("split", new SplitSentence(), 8).shuffleGrouping("spout");
builder.setBolt("count", new WordCount(), 12).fieldsGrouping("split", new Fields("word"));
Ticker (Java):
Ticker ticker = new Ticker.Builder()
.setText("Some scrolling text")
.setTextColor(Color.WHITE)
.setBackgroundColor(Color.BLACK)
.build();
ticker.start();
Summary
Storm is a powerful distributed real-time computation system suitable for large-scale data processing, while Ticker is a lightweight Android library for creating scrolling text views. Storm offers more flexibility and scalability but requires more resources and setup. Ticker is simpler to implement but limited to Android UI components. The choice between them depends on the specific project requirements and scale of the application.
Build highly concurrent, distributed, and resilient message-driven applications on the JVM
Pros of Akka
- More comprehensive actor-based concurrency framework for building distributed systems
- Supports multiple programming languages (Scala and Java)
- Offers advanced features like clustering, persistence, and streams
Cons of Akka
- Steeper learning curve due to its complexity and extensive feature set
- Heavier resource footprint compared to lightweight libraries
- May be overkill for simpler applications not requiring distributed systems
Code Comparison
Akka (Scala):
import akka.actor.{Actor, ActorSystem, Props}
class MyActor extends Actor {
def receive = {
case "hello" => println("Hello, Akka!")
}
}
Ticker (Java):
Ticker ticker = new Ticker.Builder()
.setCharacterList(TickerUtils.getDefaultNumberList())
.setAnimationDuration(1500)
.build();
ticker.setText("1234");
Summary
Akka is a powerful, feature-rich framework for building distributed systems, while Ticker is a lightweight library focused on animated text display. Akka offers more extensive capabilities but comes with increased complexity, whereas Ticker provides a simpler solution for specific UI animations. The choice between them depends on the project's requirements and scale.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Migrating to version 2
There are some breaking API changes introduced in ticker 2.0. Please refer to the 2.0 migration doc.
What is Ticker?
Ticker is a simple Android UI component for displaying scrolling text. Think about how an odometer scrolls when going from one number to the next, that is similar to what Ticker does. The Ticker handles smooth animations between strings and also string resizing (e.g. animate from "9999" to "10000").
You can specify how the animations proceed by defining an array of characters in order. Each character displayed by Ticker is controlled by this array which dictates how to animate from a starting character to a target character. For example, if you just use a basic ASCII character list, when animating from 'A' to 'Z', it will go from 'A' -> 'B' -> ... 'Z'. We will perform wrap-around animation when it's faster (e.g. 'Z' to 'A' will just animate 'Z' -> 'A').
Getting started
Add the ticker dependency to your build.gradle
.
implementation 'com.robinhood.ticker:ticker:2.0.4'
Usage
Define the TickerView
in XML:
<com.robinhood.ticker.TickerView
android:id="@+id/tickerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Then add the character array to specify the animation style:
final TickerView tickerView = findViewById(R.id.tickerView);
tickerView.setCharacterLists(TickerUtils.provideNumberList());
That's it! Now you can call setText
to display your data.
Customization
We currently support a fairly limited subset of customizations at the moment so please let us know what new features / APIs you need exposed for your use-case and we'll consider it for future releases (or of course feel free to fork!).
You can customize the looks and feels of the TickerView
via XML:
android:gravity="center"
android:textColor="@color/colorPrimary"
android:textSize="16sp"
app:ticker_animationDuration="1500"
app:ticker_preferredScrollingDirection="any"
Or Java:
tickerView.setTextColor(textColor);
tickerView.setTextSize(textSize);
tickerView.setTypeface(myCustomTypeface);
tickerView.setAnimationDuration(500);
tickerView.setAnimationInterpolator(new OvershootInterpolator());
tickerView.setGravity(Gravity.START);
tickerView.setPreferredScrollingDirection(TickerView.ScrollingDirection.ANY);
For the full list of XML attributes that we support, please refer to the attrs file.
Performance
We decided to extend from the base View
class and achieve everything by drawing directly
onto the canvas. The primary benefit from this is having full flexibility and control over
memory allocations and minimize performance impact by using native draw operations. We
pre-allocate and pre-compute as much as possible for each transition so that the only thing
we need to do in the draw path is perform the actual drawing operations. The performance test
UI included in the ticker-sample
is a bit over-zealous but animates smoothly with a screen full of tickers.
License
Copyright 2016 Robinhood Markets, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Top Related Projects
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot