Created
December 31, 2016 16:20
-
-
Save AppWerft/93055c892cee4ed62cac6bd7f57766ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var activity = $.getActivity(); | |
if (activity) { | |
activity.onCreateOptionsMenu = function(e) { | |
activity.actionBar.displayHomeAsUp = true; | |
e.menu.clear(); | |
e.menu | |
.add( | |
{ | |
title : 'Weg damit!', | |
showAsAction : Ti.Android.SHOW_AS_ACTION_ALWAYS, | |
icon : "/assets/trash.png" | |
}) | |
.addEventListener( | |
"click", | |
function() { | |
var dialog = Ti.UI | |
.createAlertDialog({ | |
cancel : 1, | |
buttonNames : [ 'Ja', | |
'Nein' ], | |
message : 'Wollen Sie den Beleg tatsächlich löschen?', | |
title : 'Belegverwurf' | |
}); | |
dialog | |
.addEventListener( | |
'click', | |
function(e) { | |
if (e.index === e.source.cancel) { | |
Ti.API | |
.info('The cancel button was clicked'); | |
} else { | |
Adapter.deleteReceipt(id); | |
$.close(); | |
} | |
}); | |
dialog.show(); | |
}); | |
e.menu | |
.add( | |
{ | |
title : 'Hoch damit!', | |
showAsAction : Ti.Android.SHOW_AS_ACTION_ALWAYS, | |
icon : "/assets/upload.png" | |
}) | |
.addEventListener( | |
"click", | |
function() { | |
alert("Der Endpunkt ist leider noch nicht eingerichtet."); | |
}); | |
}; | |
activity.invalidateOptionsMenu(); | |
} | |
activity.actionBar.onHomeIconItemSelected = function() { | |
$.close(); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment