Skip to content
This repository has been archived by the owner on Nov 13, 2019. It is now read-only.

RSchwan/com.rolandschwan.iconlabel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Icon Label Widget Titanium Alloy

Overview

This is a widget for the Alloy MVC framework of Appcelerator's Titanium platform.

The widget provides a simple FontAwesome support for labels.

Screenshot

Loading Mask

Features

  • Full support for all FontAwesome icons.
  • Refer to icons by their name.
  • Label can be mixed with icons and normal text.
  • It can be styled like a normal label.
  • Script to automatically download the font file and generate the cheatsheet.

Quick Start gitTio

  • Use gittio install com.rolandschwan.iconlabel to install via gitTio or:

    • Download the latest release of the widget.

    • Unzip the folder to your project under app/widgets/com.rolandschwan.iconlabel.

    • Add the widget as a dependency to your app/config.json file:

      ```javascript
      "dependencies": {
          "com.rolandschwan.iconlabel":"*"
      }
      ```
      
  • Run the build.py script to download the font file into the fonts folder and generate an updated cheatsheet file.

  • Create an instance of the widget in a controller and add it to a window or view:

     var iconLabel = Alloy.createWidget("com.rolandschwan.iconlabel", {
     	width: Ti.UI.SIZE,
     	height: Ti.UI.SIZE,
     	textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
     	color: "#900",
     	shadowColor: "#aaa",
     	shadowOffset: {
     		x: 2,
     		y: 2
     	},
     	shadowRadius: 3,
     	text: "fa-star Label with FontAwesome support fa-smile-o",
     	font: {
     		fontSize: 40
     	}
     });
     $.win.add(iconLabel.getView()

or add it directly to the xml file and style it with the tss file:

**index.xml**

```xml
<Alloy>
	<Window>
		<Widget id="widget" src="com.rolandschwan.iconlabel" />
	</Window>
</Alloy>
```

**index.tss**

```javascript
"#widget": {
	width: Ti.UI.SIZE,
	height: Ti.UI.SIZE,
	textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
	color: "#900",
	shadowColor: "#aaa",
	shadowOffset: {
		x:2,
		y:2
	},
	shadowRadius: 3,
	text: "fa-star Label with FontAwesome support fa-smile-o",
	font: {
		fontSize: 40
	}
}
```

Usage

Style it like a normal label. To generate a icon just write the name of the icon and it will automatically be generated.

Changelog

  • v1.1.3: Classes access fix for Android. (#3)
  • v1.1.2: Widget version update.
  • v1.1.1: Fix for android.
  • v1.1.0: Support for events.
  • v1.0.0: Initial version.

License

Copyright 2015 Roland Schwan

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.