Created
January 23, 2012 20:43
-
-
Save aaronksaunders/1665444 to your computer and use it in GitHub Desktop.
pattern for Appcelerator MVC, Work in Progress
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
| // All windows needed by controller | |
| var MessageWindow, app = require('/common/globals'); | |
| /** | |
| * constructor | |
| */ | |
| exports.MessageController = function(messageWindow) { | |
| MessageWindow = messageWindow; | |
| app.GlobalUpdate("messageController", this); | |
| return this; | |
| } | |
| // | |
| // ACTIONS | |
| // | |
| MessageController.prototype.showCamera = function() { | |
| } | |
| MessageController.prototype.saveMessage = function() { | |
| } | |
| MessageController.prototype.cancelMessage = function() { | |
| } | |
| exports.MessageController = MessageController; |
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 app, sendButton, photoButton, controller; | |
| exports.MessageWindow = function() { | |
| // Globals | |
| app = require('/common/globals'); | |
| var self = Ti.UI.createWindow({ | |
| title : L('message'), | |
| backgroundColor : '#ffffff', | |
| exitOnClose : true, | |
| navBarHidden : false, | |
| modal : true, | |
| windowSoftInputMode : Titanium.UI.Android.SOFT_INPUT_ADJUST_RESIZE | |
| }); | |
| textArea = Titanium.UI.createTextArea({ | |
| width : app.globals.pW, | |
| height : app.globals.pH / 3, | |
| top : '60dp' | |
| }) | |
| self.add(textArea); | |
| var btop = 10; | |
| //((app.globals.pH / 3) + 5); | |
| sendButton = Titanium.UI.createButton({ | |
| title : 'Send', | |
| width : '70dp', | |
| height : '40dp', | |
| right : '5dp', | |
| top : btop + 'dp' | |
| }); | |
| self.add(sendButton); | |
| photoButton = Titanium.UI.createButton({ | |
| title : 'Photo', | |
| width : '70dp', | |
| height : '40dp', | |
| left : '5dp', | |
| top : btop + 'dp' | |
| }); | |
| self.add(photoButton); | |
| self.addEventListener('open', function() { | |
| textArea.focus(); | |
| }) | |
| var MessageController = require('/ui/controllers/MessageController').MessageController; | |
| controller = new MessageController(self); | |
| photoButton.addEventListener('click', controller.photoButtonClick); | |
| sendButton.addEventListener('click', controller.sendButtonClick); | |
| return self; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment