This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fontList == s:List | |
// arrList == s:ArrayList for enumerated fonts | |
fontList.selectedIndex = -1; | |
for (var i:uint = 0; i < arrList.length; i++) { | |
if (arrList.getItemAt(i).fontName == FONT_NAME_TO_MATCH) { | |
fontList.selectedIndex = i; | |
fontList.layout.verticalScrollPosition = fontList.dataGroup.contentHeight * (i/(arrList.length-1)) - (fontList.height/2) + 8; | |
break; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isAndroidValue = undefined; | |
function isAndroid() { | |
if (isAndroidValue === undefined) { | |
isAndroidValue = Ti.Platform.osname; | |
} | |
return isAndroidValue; | |
} | |
// The trick here is that `left` and `right` would constantly give me the wrong height and truncate the Label text | |
// when using padded Labels in a TableViewRow on Android. They work fine on iOS though. To get around this I just use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ti.UI.setBackgroundColor('#222'); | |
var win = Ti.UI.createWindow({ | |
navBarHidden: true, | |
exitOnClose: true | |
}); | |
var button = Ti.UI.createButton({ | |
title: 'open pdf', | |
height: '60dp', | |
width: '120dp', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ti.UI.setBackgroundColor('#222'); | |
var win = Ti.UI.createWindow({ | |
navBarHidden: true, | |
exitOnClose: true | |
}); | |
var button = Ti.UI.createButton({ | |
title: 'open pdf', | |
height: '60dp', | |
width: '120dp', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var appFilePath = Ti.Filesystem.resourcesDirectory + 'w4.pdf'; | |
var appFile = Ti.Filesystem.getFile(appFilePath); | |
var tmpFile = undefined, | |
newPath = undefined; | |
if (Ti.Filesystem.isExternalStoragePresent()) { | |
tmpFile = Ti.Filesystem.createTempFile(); | |
newPath = tmpFile.nativePath + '.pdf'; | |
tmpFile.move(newPath); | |
tmpFile = Ti.Filesystem.getFile(newPath); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
button.addEventListener('click', function(e) { | |
if (tmpFile) { | |
var intent = Ti.Android.createIntent({ | |
action: Ti.Android.ACTION_VIEW, | |
type: "application/pdf", | |
data: tmpFile.nativePath | |
}); | |
try { | |
Ti.Android.currentActivity.startActivity(intent); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
win.addEventListener('close', function(e) { | |
tmpFile.deleteFile(); | |
}); | |
win.add(button); | |
win.open(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tmp | |
.DS_Store | |
build/iphone/* | |
!build/iphone/.gitignore | |
build/android/* | |
!build/android/.gitignore | |
.settings | |
build.log | |
.fastdev.lock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<resources> | |
<string name="appname">Cat</string> | |
</resources> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- ... --> | |
<!-- TI_MANIFEST --> | |
<application android:icon="@drawable/appicon" | |
android:label="@string/app_name" android:name="TestlocApplication" | |
android:debuggable="false"> | |
<!-- TI_APPLICATION --> | |
<activity android:name=".TestlocActivity" | |
android:label="@string/app_name" android:theme="@style/Theme.Titanium" |
OlderNewer