Skip to content

Instantly share code, notes, and snippets.

@cloudmanic
Created January 11, 2013 00:38
Show Gist options
  • Save cloudmanic/4507034 to your computer and use it in GitHub Desktop.
Save cloudmanic/4507034 to your computer and use it in GitHub Desktop.
var ui = require('/libraries/ui');
// Default screen.
exports.screen_init = function (body, callbacks)
{
// Clear from other screens.
win.rightNavButton = null;
// Container for holding this page.
var wrapper = ui.view({
layout: 'vertical',
top: '8dp',
//bottom: '115dp',
left: '15dp',
right: '15dp'
});
body.add(wrapper);
// Title
var title = ui.label({
top: '3dp',
text: 'Save to Evernote',
color: '#444444',
font: { fontWeight: 'bold', fontSize: '20dp', fontStyle: 'Myriad Pro' }
});
wrapper.add(title);
// Button bar.
var bb = ui.view({
layout: 'horizontal',
top: '8dp'
});
wrapper.add(bb);
// Text button.
var text_btn = ui.button({
backgroundImage: '/images/button-text.png',
backgroundSelectedImage: '/images/button-text-selected.png',
width: '94dp',
height: '125dp'
}, callbacks.text_note);
bb.add(text_btn);
// Audio button.
var audio_btn = ui.button({
backgroundImage: '/images/button-audio.png',
backgroundSelectedImage: '/images/button-audio-selected.png',
width: '94dp',
height: '125dp'
}, callbacks.audio_note);
bb.add(audio_btn);
// Photo button.
var photo_btn = ui.button({
backgroundImage: '/images/button-photo.png',
backgroundSelectedImage: '/images/button-photo-selected.png',
width: '94dp',
height: '125dp'
}, callbacks.photo_camera);
bb.add(photo_btn);
photo_btn.addEventListener('longpress', callbacks.photo_gallery);
// Add syncing bar.
var sync_msg = ui.view({
left: '45dp',
top: '170dp',
layout: 'horizontal',
visible: false
});
body.add(sync_msg);
// Spinner
if(Ti.Platform.name === 'iPhone OS')
{
var actInd = Ti.UI.createActivityIndicator({
top: '5dp',
height: '15dp',
width: '15dp',
left: '10dp',
style: Ti.UI.iPhone.ActivityIndicatorStyle.DARK,
visible: true
});
sync_msg.add(actInd);
}
// Label
var sync_lb = ui.label({
left: '10dp',
top: '5dp',
text: 'Synchronization in progress.',
color: '#444444',
font: { fontWeight: 'normal', fontSize: '14dp', fontStyle: 'Myriad Pro' }
});
sync_msg.add(sync_lb);
// Add picker.
var picker = Ti.UI.createPicker({ bottom: 0 });
picker.selectionIndicator = true;
body.add(picker);
picker.addEventListener('change', callbacks.picker);
callbacks.set_picker_data(picker);
return { sync_msg: sync_msg }
}
// Setup evernote screen.
exports.evernote_setup = function (body, callbacks)
{
// Clear from other screens.
win.rightNavButton = null;
// Container for holding this page.
var wrapper = ui.view({
layout: 'vertical',
top: '5dp',
height: '375.5dp',
width: '288.5dp',
backgroundImage: '/images/background-point-top.png'
});
body.add(wrapper);
// Title.
var title = ui.label({
text: 'Welcome to Evermanic',
color: '#444444',
font: { fontWeight: 'normal', fontSize: '18dp', fontStyle: 'Museo Slab' },
top: '50dp'
});
wrapper.add(title);
// Add connection image.
var cnt = ui.image({
top: '20dp',
image: '/images/evermanic-evernote-link.png',
width: '230.5dp',
height: '110.5dp'
});
wrapper.add(cnt);
// Description label.
var desc = ui.label({
text: 'Before we can go any further we need to link your Evernote account. If you do not have an Evernote account there will be an option to create one.',
textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
left: '20dp',
right: '20dp',
top: '20dp',
color: '#444444',
font: { fontWeight: 'normal', fontSize: '14dp', fontStyle: 'Museo Slab' }
});
wrapper.add(desc);
// Link Button
var link_btn = ui.button({
top: '15dp',
backgroundImage: '/images/button-setup-evernote.png',
//backgroundSelectedImage: '/images/button-audio-selected.png',
width: '235dp',
height: '40dp'
}, callbacks.ev_link);
wrapper.add(link_btn);
}
// Setup profiles screen.
exports.profiles_setup = function (body, callbacks)
{
// Clear from other screens.
win.rightNavButton = null;
// Container for holding this page.
var wrapper = ui.view({
layout: 'vertical',
top: '5dp',
height: '228.5dp',
width: '288dp',
backgroundImage: '/images/background-point-top-small.png'
});
body.add(wrapper);
// Title.
var title = ui.label({
text: "Let's Get Started",
color: '#444444',
font: { fontWeight: 'normal', fontSize: '18dp', fontStyle: 'Museo Slab' },
top: '50dp'
});
wrapper.add(title);
// Description label.
var desc = ui.label({
text: 'To start save your notes to Evernote, you need to set up a profile.',
textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
left: '20dp',
right: '20dp',
top: '20dp',
color: '#444444',
font: { fontWeight: 'normal', fontSize: '14dp', fontStyle: 'Museo Slab' }
});
wrapper.add(desc);
// Link Button
var link_btn = ui.button({
top: '25dp',
backgroundImage: '/images/button-create-new-profile.png',
//backgroundSelectedImage: '/images/button-audio-selected.png',
width: '234.5dp',
height: '40.5dp'
}, callbacks.profile_link);
wrapper.add(link_btn);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment