[* Deprecated *] - Provides cross-platform Badges for Titanium applications.
JavaScript
Switch branches/tags
Nothing to show
Permalink
Failed to load latest commit information.
Resources
.gitignore
.project
CHANGELOG.txt
LICENSE
LICENSE.txt
README.md
manifest
tiapp.xml

README.md

Badge

A CommonJS module for Titanium mobile applications.

This module provides the ability to create application badges for use across iOS, Android, and MobileWeb. The default configuration visually mimics the iOS badge, but the styling can be configured further if desired.

Application Usage

This module is a CommonJS file, so we load it with require().

// Load the module.
var Badge = require('Badge');

Create a new badge and attach it to the View for which it is associated.
(By default, it will visually resemble the standard red iOS tab-sized badge.)

// Create a badge and attach it to a fake Tab View.
var badge1 = new Badge.Badge();
badge1.attachToView(fakeTab1);

To interact with the badge, simply call applyValue() and clear().

// Give the badge a number to show. The width will automatically resize as needed for larger numbers.
badge1.applyValue(8);

// Clear the badge, thus hiding it.
badge1.clear();

Application Usage - A more stylized example

// Create a larger rectangular badge that is green with no border or gradient.
// Place it at the upper right corner of the associated view.
var badge2 = new Badge.Badge({
	top : 5,
	right : 5,
	size : Badge.size.APP,
	shape : Badge.shape.SQUARE,
	color : Badge.color.GREEN,
	useBorder : false,
	useShading : false
});
badge2.attachToView(fakeTab2);

// Set a badge value.
badge2.applyValue(23); 

Please NOTE:

Your application should be using Titanium 2.1.0 or newer to take advantage of gradient shading for Android applications.