Created
August 31, 2012 15:23
Revisions
-
jaraen revised this gist
Aug 31, 2012 . 7 changed files with 14 additions and 11 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ var Mods = require('/ModulePaths'); var $$ = require(Mods.STYLES), 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ var ui = '/app/ui/'; module.exports = { 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ var Mods = require('/ModulePaths'); var $$ = require(Mods.STYLES); @@ -37,11 +36,6 @@ module.exports = function(item){ } return win; } 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ var Mods = require('/ModulePaths'); var $$ = require(Mods.STYLES), 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ module.exports = function(item){ var row = Ti.UI.createTableViewRow({ 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ var osname = Ti.Platform.osname; module.exports = { iOS: (osname === 'iphone' || osname === 'ipad'), android: osname === 'android', mainBackgroundColor: '#fefefe', appWindow:{ backgroundColor:'#fefefe' } } 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ (function(){ var Mods = require('/ModulePaths') -
jaraen created this gist
Aug 31, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ var Mods = require('/ModulePaths'); var $$ = require(Mods.STYLES), PhotosView = require(Mods.PHOTOS_TABLEVIEW); module.exports = function(){ var args = args || {}; var win = Ti.UI.createWindow($$.appWindow); var view = new PhotosView(); win.add(view); return win; } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ var ui = '/app/ui/'; module.exports = { APP_WINDOW: ui + 'AppWindow', PHOTOS_TABLEVIEW: ui + 'PhotosTableView', PHOTOS_ROW: ui + 'PhotosTableRowView', STYLES: ui + 'Styles', PHOTO_VIEWER: ui + 'PhotoViewer', FLICKR_FEED: '/app/model/flickrFeed' } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ var Mods = require('/ModulePaths'); var $$ = require(Mods.STYLES); module.exports = function(item){ var win = Ti.UI.createWindow({ backgroundColor:'#000', title:item.title }); var img = Ti.UI.createImageView({ image: item.media.m }); win.add(img); if($$.iOS){ var btnClose = Ti.UI.createButton({ title:'Cerrar' }); win.rightNavButton = btnClose; btnClose.addEventListener('click', function(){ win.close(); }); } win.showImage = function (){ win.open({ modal : true }); } win.GetPhoto = function(){ return img.image; } return win; } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ var Mods = require('/ModulePaths'); var $$ = require(Mods.STYLES), PhotoViewer = require(Mods.PHOTO_VIEWER), PhotoRow = require(Mods.PHOTOS_ROW) Feed = require(Mods.FLICKR_FEED); module.exports = function(){ var tableview = Ti.UI.createTableView(); function callbackTableView(data){ var rows = []; if(data.error){ alert(data.error); return; } for(var i = 0, j = data.length; i < j; i++){ rows[i] = new PhotoRow(data[i]); } tableview.data = rows; } tableview.addEventListener('click', function(e){ if(e.row){ var item = e.row.data; var viewer = new PhotoViewer(item); viewer.showImage(); } }); Feed.getData(callbackTableView); return tableview; } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ module.exports = function(item){ var row = Ti.UI.createTableViewRow({ height:100, backgroundColor:'#333', //custom fields data: item, }); var img = Ti.UI.createImageView({ image:item.media.m, width:80, height:80, left:10, top:10, borderColor:'black', borderWidth:1 }); var lblTitle = Ti.UI.createLabel({ text:item.title, left:100, color:'#fff', font:{fontSize:16, fontFamily:'HelveticaNeue-Bold'} }); row.add(img); row.add(lblTitle); return row; } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ (function(){ var Mods = require('/ModulePaths') var MyWindow = require(Mods.APP_WINDOW); var win = new MyWindow(); 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ exports.getData = function(callback) { //note that some flickr tags returns invalid json data :S var url = "http://api.flickr.com/services/feeds/photos_public.gne?format=json&nojsoncallback=1&tags=appcelerator"; var client = Ti.Network.createHTTPClient({ onload : function(e) { Ti.API.info("Received text: " + this.responseText); try { var data = JSON.parse(this.responseText); data = data.items; } catch(err) { Ti.API.info(JSON.stringify(err)) var data = { error : 'Not valid JSON data' }; } if (callback) { callback(data); } }, onerror : function(e) { Ti.API.debug(e.error); alert('error'); }, timeout : 5000 // in milliseconds }); // Prepare the connection. client.open("GET", url); // Send the request. client.send(); }