getting to know alloy
part 1
by
Clearly Innovative, Inc.
what is alloy?
- Alloy is a framework developed for the Titanium SDK
- It was designed to speed up the development process
- It's based on the MVC architecture which divides a Titanium project into more easily managed components
exercise
- Open Appcelerator Titanium.
- Create an alloy project.
-
Make your project cloud enabled
- Create a user account using the appcelerator console
MVC
(Model-view-controller)
Architecture
WHAT IS mvc?
- Models
- Views
- Controllers
MVC - Model
mvc - view
- Windows
- Buttons
- Text Fields
- Checkboxes
mvc - controller
HOW do they communicate?

what's the benefit of MVC?
- code can be reused more easily
- separation of concern
exercise
- Create a classic titanium project.
COde Comparison


Code comparison




alloy project composition
how alloy works
- The alloy.js file is processed.
- The selected view is loaded (fileName.xml).
- The styles are applied (app.tss then fileName.tss).
- The controller is executed (fileName.js).
exercise
- Open or create a new alloy project.
- Open index.xml.
- Set the layout for the window tag to "vertical"
- Add four buttons to the window.
- Run the app.
- Give the four buttons a backgroundGradient of your choosing.
Sample output

exercise
- Remove the layout property from the window.
- Style the four buttons to be labeled and repositioned as followed:

-
Add a view to the top or bottom of the window.
-
Draw a red circle or create a rounded view in the center of that view.
exercise
Objective:
Add an event listener to each button such that when a user clicks on the button, the message "going " + DIRECTION is outputted in an alert box. Make sure to use the same event listener for this process. Also, DIRECTION should be replaced with the applicable direction on the button label.
Optional:
If you've created the red ball or rounded view from the previous exercise, make it move up, down, left, or right 10dp or 10px based on the button the user taps.
acs
(appcelerator cloud services)
WHAT IS ACS?
benefits (just a few)
- You don't have to build a database every time you create an app.
- You don't have to worry about hosting the database.
- Titanium provides it's own API for communicating with the cloud.
-
The cloud can be accessed through mobile devices, Macs, and PCs.
exercise
- Make an alloy app in Titanium.
- Make the app Cloud-enabled.
- Log into your appcelerator account.
- Go to the ACS console of the alloy app you created.
- Create a user account.
- Upload a photo for your user account.
- Create an administrative account.
ACS CONSOLE
- create, update, delete, view content
- register for and test push notifications
- check the usage statistics for your app
- check the activity logs
- export ACS content
- edit user permissions (Access Control List)
exercise

ExercisE
summary
- Alloy is a framework that uses the MVC architecture to make project development more manageable and organized
- ACS is a free back-end service provided by Appcelerator to power your apps data-wise
resources
(http://balsamiq.com/)
homework
Required
Download balsamiq if you don't already have it. Review the 411 Eats app. Create the wireframes for the app in balsamiq. It can be exported as a PNG file. Email the PNG file to me (david@clearlyinnovative.com) with the following subject : homework1
Optional
See if you can figure out how to push your ACS exercise code to bitbucket and then share it with me. I should be able to download your project and run it it in Titanium Make sure to send me an email invitation. Name your bitbucket project homework1_#YOUR_FIRST_NAME#
;
getting to know alloy part 1
By David Plummer
getting to know alloy part 1
- 892