Skip to content

Instantly share code, notes, and snippets.

@ricardoalcocer
Last active August 29, 2015 14:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricardoalcocer/a7258c0cb7909e86ced2 to your computer and use it in GitHub Desktop.
Save ricardoalcocer/a7258c0cb7909e86ced2 to your computer and use it in GitHub Desktop.
function doClick(e) {
alert($.label.text);
}
// load the module
var abextras = require('com.alcoapps.actionbarextras');
$.index.addEventListener('open',function(evt){
// set extras once the Activity is available
abextras.title = "ActionbarExtras";
abextras.titleFont = "Chunkfive.otf";
abextras.titleColor="#840505";
abextras.subtitle = "for some extra action";
abextras.subtitleFont = "Chunkfive.otf";
abextras.subtitleColor="#562A2A";
abextras.backgroundColor="#F49127"
// disable the App Icon
//abextras.setDisableIcon();
// now set the menus
evt.source.activity.onCreateOptionsMenu = function(e){
// aboutBtn and creditsBtn will be displayed in the menu overflow
aboutBtn = e.menu.add({
title : "About",
showAsAction : Ti.Android.SHOW_AS_ACTION_NEVER
});
aboutBtn.addEventListener("click", function(e) {
console.log('Clicked on About')
});
creditsBtn = e.menu.add({
title : "Credits",
showAsAction : Ti.Android.SHOW_AS_ACTION_NEVER
});
creditsBtn.addEventListener("click", function(e) {
console.log('Clicked on Credits')
});
// create the Share intent and add it to the ActionBar
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_SEND,
type: 'text/plain'
});
intent.putExtra(Ti.Android.EXTRA_TEXT, 'Hello world!');
abextras.addShareAction({
menu: e.menu,
intent: intent
});
};
})
$.index.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment