TextCounter


Source link: https://github.com/premnirmal/TextCounter

TextCounter

A simple subclass of android's TextView that counts up or down. Customize the counting using the attributes below.

See the demo project for more implementation details.

Download

Gradle

compile 'com.github.premnirmal:TextCounter:1.1.0'

Maven Central

<dependency>
<groupId>com.github.premnirmal</groupId>
<artifactId>TextCounter</artifactId>
<version>1.1.0</version>
<type>aar</type> </dependency>

Usage

Xml

  <com.github.premnirmal.textcounter.CounterView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginBottom="20dp"

android:textSize="30dp"

android:textColor="@color/orange"

counter:autoStart="true"

counter:startValue="100"

counter:endValue="5000"

counter:incrementValue="100"

counter:timeInterval="2"

counter:prefix="$"

counter:suffix=" moneys"

counter:type="integer | decimal | both"

/>

Java

final CounterView counterView = new CounterView(context);
 counterView.setFormatter(new Formatter() {

  @Override
  public String format(String prefix, String suffix, float value) {

  return prefix

 + NumberFormat.getNumberInstance(Locale.US).format(value)

 + suffix;
  
}
 
}
);
 counterView.setAutoStart(false);
 counterView.setStartValue(200f);
 counterView.setEndValue(1000f);
 counterView.setIncrement(5f);
 // the amount the number increments at each time interval counterView.setTimeInterval(2);
 // the time interval (ms) at which the text changes counterView.setPrefix("You have ");
 counterView.setSuffix(" points!");
 counterView.start();
 // you can start anytime if autostart is set to false

Formatter

You can control the text formatting by providing a Formatter. Simply implement the interface com.github.premnirmal.textcounter.Formatter or use one of the formatters under the com.github.premnirmal.textcounter.formatters package.

API Requirements

  • The minimum supported Android version is Android 4.0.0 IceCreamSandwich (API Level 14)

Contributing

Please fork this repository and contribute back using pull requests.

License

MIT

Author

Prem Nirmal

Resources

Snake library is a simple and animation line chart for Android.

Content Provider ORM for android. This ORM uses an android sqlite database as a backing store, but interactes with it using content providers. You use it like a normal ORM, by creating java objects, and then do all of you interations through the objects. And you get the added benefits of using it like normal content providers, so integration with list views and other components are simple.

SimpleUI is an Android library which helps you creating the activity UI more easier. You just have to configure the main things instead of coding them yourself.

Login Basics is an implementation of an Android app that support Login with Facebook, Google Plus (G+) and your own login logic. The aim of this project is to serve as basis to build apps that require login as a feature.

A fully open source music player for Android.

Gradle plugin that provides convenience closure for configuring common dependencies.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes