Skip to content

Instantly share code, notes, and snippets.

@mschmulen
Created August 7, 2012 13:48
Show Gist options
  • Save mschmulen/3285469 to your computer and use it in GitHub Desktop.
Save mschmulen/3285469 to your computer and use it in GitHub Desktop.
UIWinCheatSheetAndroid4_1
var UIWinCheatSheetAndroid4_1 = (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 = "Android 4.1";
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":"Google Cloud Messaging",
"description": "GCM (Google Cloud Messaging) Push Notification and simple stats in the Android developer console.",
"detail": "GCM (Google Cloud Messaging) this is the next version of C2DM and goes back to Froyo. Getting started is easy and has a whole bunch of new APIs than C2DM has to offer. If you sign-up for GCM, you will be able to see C2DM and GCM stats in the Android developer console. Most importantly, the service is free and there are no quotas. \n ACS provides support for Push on both iOS and Android, addittionally Appcelerator Mobile Analytics provides a full analytics on your mobile applications, and applications are 'instrumented' with basic analytics 'out of the box' no configuration required.",
"appIconURL":"/images/AndroidIcon.png",
"type":"achievements",
"weblink": "www.woot.com"
},
{
"title":"Smart app updates",
"description": "App updates do not require the full .apk binary just the part the has changed",
"detail": "For Android 2.3, Gingerbread devices and up, when there is a new version of an app in Google Play, only the parts of the app that changed are downloaded to users’ devices. On average, a smart app update is a third the size of a full apk update. This means your users save bandwidth and battery and the best part? You don’t have to do a thing. This is automatically enabled for all apps downloaded from Google Play.",
"appIconURL":"/images/AndroidIcon.png",
"type":"leaderInstall"
},
{
"title":"App encryption",
"description": "'Google Play' Market Apps are encrypted with device-specific key before delivery to the users device. ",
"detail": "From Jelly Bean and forward, paid apps in Google Play are encrypted with a device-specific key before they are delivered and stored on the device. We know you work hard building your apps. We work hard to protect your investment.",
"appIconURL":"/images/AndroidIcon.png",
"type":"leaderInstall"
},
{
"title":"Expandable notifications API:",
"description": " -",
"detail": "Android 4.1 brings a major update to the Android notifications framework. Apps can now display larger, richer notifications to users that can be expanded and collapsed with a pinch. Users can now take actions directly from the notification shade, and notifications support new types of content, including photos.",
"appIconURL":"/images/AndroidIcon.png",
"type":"leaderInstall"
},
{
"title":"Android Beam:",
"description": "Makes it easier to share images, videos, or other payloads by leveraging Bluetooth",
"detail": " In Android 4.1, Android Beam makes it easier to share images, videos, or other payloads by leveraging Bluetooth for the data transfer.",
"appIconURL":"/images/AndroidIcon.png",
"type":"leaderInstall"
},
{
"title":"Bi-directional text support",
"description": "bi-directional text in TextView and EditText elements",
"detail": "Android 4.1 helps you to reach more users through support for for bi-directional text in TextView and EditText elements.",
"appIconURL":"/images/AndroidIcon.png",
"type":"leaderInstall"
},
{
"title":"Gesture mode",
"description": "accessibility services let you handle gestures",
"detail": "New APIs for accessibility services let you handle gestures and manage accessibility focus. Now you can traverse any element on the screen using gestures, accessories, you name it",
"appIconURL":"/images/AndroidIcon.png",
"type":"leaderInstall"
},
{
"title":"Media codec access",
"description": " - ",
"detail": "Provides low-level access to platform hardware and software codecs.",
"appIconURL":"/images/AndroidIcon.png",
"type":"leaderInstall"
},
{
"title":"Wi-Fi Direct service discoverability",
"description": "pre-associated service discovery",
"detail": "New API provides pre-associated service discovery letting apps get more information from nearby devices about the services they support, before they attempt to connect.",
"appIconURL":"/images/AndroidIcon.png",
"type":"leaderInstall"
},
{
"title":"Network bandwidth management",
"description": "API provides ability to detect metered networks",
"detail": "New API provides ability to detect metered networks, including tethering to a mobile hotspot.",
"appIconURL":"/images/AndroidIcon.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 UIWinCheatSheetAndroid4_1
module.exports = UIWinCheatSheetAndroid4_1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment