Skip to content

Instantly share code, notes, and snippets.

@mschmulen
Created August 7, 2012 13:48
Show Gist options
  • Save mschmulen/3285463 to your computer and use it in GitHub Desktop.
Save mschmulen/3285463 to your computer and use it in GitHub Desktop.
UIWinCheatSheetIOS6
var UIWinCheatSheetIOS6 = (function() {
var STYLE = require('ui/STYLE');
var UTILS = require('utils/utils');
var MODEL = require('model/inventory');
var CLOUD = require('ti.cloud');
CLOUD.debug = true;
var API = {};
API.APP = null;
API.name = "iOS 6";
API.icon = "/KS_nav_ui.png";
API.parentNav = null;
API.win = null;
API.defaultColorBlue = '#035385';
API.defaultColorRed = '#9a0707';
API.rowColor = '#EBEBEB';
API.defaultColor = API.defaultColorRed;
API.table = null;
API.apps = [
{
"title":"Maps",
"description": "Replacing google maps with new in-house apple map",
"detail": " vector-based 3D maps ",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"achievements",
"weblink": "www.woot.com"
},
{
"title":"Siri",
"description": " ",
"detail": " Supported on: iPhone 4S, iPad (2012)",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"leaderInstall"
},
{
"title":"Facebook integration",
"description": " ",
"detail": " Supported on: iPhone 3GS iPod touch iPhone 4 iPhone 4S iPad 2 iPad (2012)",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"leaderInstall"
},
{
"title":"Shared Photo Streams",
"description": " ",
"detail": " Supported on iPhone 4 iPhone 4S iPad 2 iPad (2012)",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"leaderInstall"
},
{
"title":"Chinese service integration",
"description": " ",
"detail": " Supported on: iPhone 3GS iPod touch iPhone 4 iPhone 4S iPad 2 iPad (2012)",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"leaderInstall"
},
{
"title":"FaceTime over 3G/4G",
"description": " ",
"detail": " Supported on: iPhone 4S, iPad (2012)",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"leaderInstall"
},
{
"title":"Flyover and turn-by-turn GPS",
"description": " ",
"detail": " Supported on: iPhone 4S iPad 2 iPad (2012)",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"leaderInstall"
},
{
"title":"Guided Access",
"description": " ",
"detail": " Supported on: iPhone 3GS iPod touch iPhone 4 iPhone 4S iPad 2 iPad (2012)",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"leaderInstall"
},
{
"title":"Made for iPhone hearing aids",
"description": " ",
"detail": " Supported on: iPhone 4S",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"leaderInstall"
},
{
"title":"New content stores",
"description": " ",
"detail": " ",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"leaderInstall"
},
{
"title":"Offline Reading List",
"description": " ",
"detail": " Supported on: iPhone 4 iPhone 4S iPad 2 iPad (2012)",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"leaderInstall"
},
{
"title":"Passbook",
"description": " ",
"detail": " Supported on: iPhone 3GS iPod touch iPhone 4 iPhone 4S",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"leaderInstall"
},
{
"title":"Phone replies and reminders",
"description": " ",
"detail": " Supported on: iPhone 3GS, iPhone 4, iPhone 4S",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"leaderInstall"
},
{
"title":"Safari tab syncing",
"description": " ",
"detail": " Supported on: iPhone 3GS, iPod touch,iPhone 4 ,iPhone 4S, iPad 2, iPad (2012)",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"leaderInstall"
},
{
"title":"VIP list, flagged/VIP mailboxes",
"description": " ",
"detail": " Supported on: iPhone 4, iPhone 4S, iPad 2, iPad (2012)",
"appIconURL":"/images/iPhoneAppleIcon.png",
"type":"leaderInstall"
}
];//end apps
API.data = [];
API.factoryView = function(args) {
var topView = Ti.UI.createView(UTILS.combine(STYLE.TopView, { })); //end topView
var footerLabel = Ti.UI.createLabel({
backgroundColor:STYLE.defaultColor,
color:"white",
font: {fontSize:10},
text:"[data supplied by Appcelerator]",
textAlign:"center",
height:25,
width:320
});
var search = Titanium.UI.createSearchBar({
barColor:'#385292',
showCancel:false,
hintText:'travel,language'
});//end search
search.addEventListener('change', function(e)
{
e.value; // search string as user types
});//end change
search.addEventListener('return', function(e)
{
search.blur();
});//end return
search.addEventListener('cancel', function(e)
{
search.blur();
});//end cancel
API.table = Ti.UI.createTableView({
//search:search,
//searchHidden:false,
footerView: footerLabel,
backgroundColor: API.defaultColorRed
}); //end table
topView.add(API.table);
//add behavior
API.table.addEventListener('click', function(e) {
var DETAIL = require('ui/UIWinCheatDetail'); DETAIL.APP = API.APP;
DETAIL.RECORD = e.rowData.payload;
//DETAIL.showDetailWindow({});
var detailWin = DETAIL.factoryWindow({});
API.win.parentNav.open( detailWin );
});//end table
API.updateTableView({});
return topView;
};//end factoryView
API.updateTableView = function(args){
API.data = [];
var apps = API.apps;
for (var i=0; i<apps.length; i++) {
var row = Ti.UI.createTableViewRow(UTILS.combine(STYLE.TableViewRow, {
appDetails: apps[i],
payload: apps[i],
rowType:apps[i].type,
hasChild: true,
height: 100
//indentionLevel: 10
})); //end row
var post_view = Ti.UI.createView({
//layout:'vertical',
//backgroundColor:'green',
left:5,
top:5,
bottom:5,
right:5
});//end post_view
var icon = Ti.UI.createImageView({
borderRadius: 17,
borderWidth: 0,
borderColor: STYLE.rowColor,
image: apps[i].appIconURL,
left: 5,
top: 10,
width: 70,
height: 70
});//end icon
post_view.add(icon);
var topLabel = Ti.UI.createLabel({
text: apps[i].title || "?",
top: -45,
left: 83,
//bottom:2,
height:'fill',
//width:236,
textAlign:'left',
color:'#000',
font:{fontFamily:'Trebuchet MS',fontSize:16,fontWeight:'bold'}
});
// Add the username to the view
post_view.add(topLabel);
var bodyLabel = Ti.UI.createLabel({
text:apps[i].description || "?",
left:83,
top:20,
//bottom:2,
height:'fill',
width:236,
textAlign:'left',
color:'#000',
font:{fontSize:14,fontWeight:'normal'}
});
post_view.add( bodyLabel);
row.add(post_view);
API.data.push(row);
}//end for
API.table.setData(API.data);
};//end updateTableView
API.factoryWindow = function(args) {
API.win = Ti.UI.createWindow(UTILS.combine(STYLE.Win, {
title : API.name
}));
var osname = Ti.Platform.osname;
if ( osname === 'android' ){}
else if ( osname === 'mobileweb' ){}
else
{
/*
var RefreshButton = Ti.UI.createButton({
systemButton: Ti.UI.iPhone.SystemButton.REFRESH
});
RefreshButton.addEventListener('click', function(e) {
API.updateTableView();
});
API.win.rightNavButton = RefreshButton;
*/
}//end if iOS iphone/ipad
API.win.add(API.factoryView({ }));
API.win.addEventListener('focus', function(e){ Titanium.Analytics.userEvent('Focus.Win.' + API.name ); });
return API.win;
};//end factoryWindow
return API;
})();//end UIWinCheatSheetIOS6
module.exports = UIWinCheatSheetIOS6;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment