Skip to content

Instantly share code, notes, and snippets.

@zashishz
Last active February 22, 2017 10:50
Show Gist options
  • Save zashishz/39b1a8f45d8f6f85101aebfb14ef2da8 to your computer and use it in GitHub Desktop.
Save zashishz/39b1a8f45d8f6f85101aebfb14ef2da8 to your computer and use it in GitHub Desktop.
skype - dipak.consona
email: dipakhimmatramka@yahoo.co.in
// Call / SMS code
Titanium.UI.EmailDialog see examples
------CODE------
/**
* Create a new `Ti.UI.TabGroup`.
*/
var myMap = require('ti.map');
var tabGroup = Ti.UI.createTabGroup();
/**
* Add the two created tabs to the tabGroup object.
*/
tabGroup.addTab(createTab("Tab 1", "I am Window 1", "assets/images/tab1.png"));
tabGroup.addTab(createTab("Tab 2", "I am Window 2", "assets/images/tab2.png"));
/**
* Open the tabGroup
*/
tabGroup.open();
/**
* Creates a new Tab and configures it.
*
* @param {String} title The title used in the `Ti.UI.Tab` and it's included `Ti.UI.Window`
* @param {String} message The title displayed in the `Ti.UI.Label`
* @return {String} icon The icon used in the `Ti.UI.Tab`
*/
function createTab(title, message, icon, map) {
var win = Ti.UI.createWindow({
title: title,
backgroundColor: '#fff'
});
var label = Ti.UI.createLabel({
text: message,
color: "#333",
font: {
fontSize: 20
}
});
win.add(label);
if(map) {
win.add(map);
}
var tab = Ti.UI.createTab({
title: title,
icon: icon,
window: win
});
return tab;
}
//create annotated
var opera = myMap.createAnnotation({
latitude: -33.8569,
longitude: 151.2153,
centerOffset: {
x: 80,
y :25
},
title:'Ha Ha Land!',
leftButton: Ti.UI.iPhone.SystemButton.CONTACT_ADD,
draggable: true
});
//create a map view
var map = myMap.createView({
userLocation: true,
mapType: myMap.NORMAL_TYPE,
animate: true,
region: {latitude: -33.87365, longitude: 151.20689, latitudeDelta: 0.1, longitudeDelta: 0.1},
height: '33%',
top:0,
width: Ti.UI.FILL,
annotations: [opera]
});
tabGroup.addTab(createTab("Tab 3", "I am Window 3", "assets/images/tab2.png", map));
// added during app creation. this will automatically login to
// ACS for your application and then fire an event (see below)
// when connected or errored. if you do not use ACS in your
// application as a client, you should remove this block
(function(){
var ACS = require('ti.cloud'),
env = Ti.App.deployType.toLowerCase() === 'production' ? 'production' : 'development',
username = Ti.App.Properties.getString('acs-username-'+env),
password = Ti.App.Properties.getString('acs-password-'+env);
// if not configured, just return
if (!env || !username || !password) { return; }
/**
* Appcelerator Cloud (ACS) Admin User Login Logic
*
* fires login.success with the user as argument on success
* fires login.failed with the result as argument on error
*/
ACS.Users.login({
login:username,
password:password,
}, function(result){
if (env==='development') {
Ti.API.info('ACS Login Results for environment `'+env+'`:');
Ti.API.info(result);
}
if (result && result.success && result.users && result.users.length){
Ti.App.fireEvent('login.success',result.users[0],env);
} else {
Ti.App.fireEvent('login.failed',result,env);
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment