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
| // I was unhappy about there was close to no control over the "pageControl" | |
| // in scrollableViews, so I hacked my own | |
| // ----- | |
| var pages = []; | |
| var page; | |
| var numberOfPages = 0; | |
| // Configuration | |
| var pageColor = "#c99ed5"; |
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
| // | |
| // blog.clearlyinnovative.com | |
| // Aaron K. Saunders | |
| // Clearly Innovative Inc | |
| // | |
| var database_url = "http://greenlyyt.iriscouch.com/movie_store/"; | |
| var user_name, password; | |
| /** ---------------------------------------------------------------------------- |
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
| /** | |
| * Loads the Login tab | |
| * @param {Object} instance of the core module | |
| * @param {Object} params Additional parameters | |
| */ | |
| exports.load = function(app, params) { | |
| var tab = Ti.UI.createTab({ | |
| title: 'Title' | |
| }); | |
| app.activeTabGroup().add(tab); |
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
| // relevant dropbox threads: | |
| // - http://forums.dropbox.com/topic.php?id=28728&replies=12#post- | |
| // - http://forums.dropbox.com/topic.php?id=31832 | |
| // code depends on spazcore.titanium.js (found in Tweetanium) | |
| // SIMPLE WORKING EXAMPLE | |
| var oa = new SpazOAuth("https://api.dropbox.com/", {"consumerKey": DROPBOX_KEY, "consumerSecret": DROPBOX_SECRET}); | |
| oa.setAccessToken(ACCESS_TOKEN, ACCESS_SECRET); |
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
| // create our web view | |
| var win = Ti.UI.createWindow({ backgroundColor: "#fff" }); | |
| var web = Ti.UI.createWebView({ url: "http://chicago.craigslist.org/" }); | |
| // inject our css when the web view finishes loading (because we need to inject into the head element) | |
| web.addEventListener('load', function () { | |
| // first, specify the CSS file that we should load | |
| var cssFileName = 'styles.css'; | |
| // read in the contents | |
| var cssFromFile = Ti.Filesystem.getFile(cssFileName); |
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
| /* updating functionality */ | |
| // 1. install all databases | |
| var eventsDB = Ti.Database.install('dbEvents.sql','events'); | |
| eventsDB.close(); | |
| var imagesDB = Ti.Database.install('dbImages.sql','events_images'); | |
| imagesDB.close(); | |
| var venuesDB = Ti.Database.install('dbVenues.sql','venues'); | |
| venuesDB.close(); | |
| var videosDB = Ti.Database.install('dbVideos.sql','events_videos'); | |
| videosDB.close(); |
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
| /* UPDATING DATA */ | |
| // 1. compare dates in two update files (if OK internet connection) | |
| var update = Titanium.App.Properties.getString('update'); | |
| if (Titanium.Network.online && update == 'YES') { | |
| var newUpdatesFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'newUpdates.txt'); | |
| var savedFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory+Titanium.Filesystem.separator,'lastUpdated.txt'); | |
| var lastUpdatedDate = savedFile.read(); | |
| var newUpdatesDate = newUpdatesFile.read(); | |
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
| Titanium.UI.setBackgroundColor('#000'); | |
| // Create a window | |
| var win = Titanium.UI.createWindow({ | |
| title:'Web Test', | |
| backgroundColor:'#fff' | |
| }); | |
| // and now a webView | |
| var webview1 = Titanium.UI.createWebView({url:'somePage.html'}); |
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 dataToWrite = {"en_us":{"foo":"bar"}}; | |
| //NOTE: remember to use applicationDataDirectory for writes | |
| var newDir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'mydir'); | |
| newDir.createDirectory(); | |
| Ti.API.info('Path to newdir: ' + newDir.nativePath); | |
| var newFile = Titanium.Filesystem.getFile(newDir.nativePath,'newfile.json'); | |
| //Stringify the JavaScript object we created earlier and write it out to the new file |
NewerOlder