Skip to content

Commit

Permalink
Add example
Browse files Browse the repository at this point in the history
  • Loading branch information
bongole committed Feb 20, 2013
1 parent 74bde28 commit a336efe
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 51 deletions.
38 changes: 12 additions & 26 deletions android/example/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,20 @@

// open a single window
var win = Ti.UI.createWindow({
backgroundColor:'white'
backgroundColor:'white'
});
var label = Ti.UI.createLabel();
win.add(label);
win.open();

// TODO: write your module tests here
var android = require('com.bongole.ti.alabel');
Ti.API.info("module is => " + android);

label.text = android.example();
var TiAttributedLabelModule = require('com.bongole.ti.alabel');
l = TiAttributedLabelModule.createALabel({
width: '200dp'
})

Ti.API.info("module exampleProp is => " + android.exampleProp);
android.exampleProp = "This is a test value";
var html_text = "a"
+ '<font fontFamily="TestFont" fontSize="30dp" fontWeight="bonld" color="red">b</font>'
+ '<a href="http://www.example.com">c</a>'
+ '<font fontSize="30dp"><a href="http://www.example.com">d</a></font>'
+ 'e';

if (Ti.Platform.name == "android") {
var proxy = android.createExample({
message: "Creating an example Proxy",
backgroundColor: "red",
width: 100,
height: 100,
top: 100,
left: 150
});

proxy.printMessage("Hello world!");
proxy.message = "Hi world!. It's me again.";
proxy.printMessage("Hello world!");
win.add(proxy);
}
l.setHTMLText(html_text);

win.open();
36 changes: 11 additions & 25 deletions iphone/example/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,18 @@
var win = Ti.UI.createWindow({
backgroundColor:'white'
});
var label = Ti.UI.createLabel();
win.add(label);
win.open();

// TODO: write your module tests here
var TiAttributedLabel = require('com.bongole.ti.alabel');
Ti.API.info("module is => " + TiAttributedLabel);

label.text = TiAttributedLabel.example();
var TiAttributedLabelModule = require('com.bongole.ti.alabel');
l = TiAttributedLabelModule.createALabel({
width: '200dp'
})

Ti.API.info("module exampleProp is => " + TiAttributedLabel.exampleProp);
TiAttributedLabel.exampleProp = "This is a test value";
var html_text = "a"
+ '<font fontFamily="TestFont" fontSize="30dp" fontWeight="bonld" color="red">b</font>'
+ '<a href="http://www.example.com">c</a>'
+ '<font fontSize="30dp"><a href="http://www.example.com">d</a></font>'
+ 'e';

if (Ti.Platform.name == "android") {
var proxy = TiAttributedLabel.createExample({
message: "Creating an example Proxy",
backgroundColor: "red",
width: 100,
height: 100,
top: 100,
left: 150
});

proxy.printMessage("Hello world!");
proxy.message = "Hi world!. It's me again.";
proxy.printMessage("Hello world!");
win.add(proxy);
}
l.setHTMLText(html_text);

win.open();

0 comments on commit a336efe

Please sign in to comment.