SlideShare a Scribd company logo
1 of 32
Download to read offline
Learning Appcelerator® Alloy™
      Silicon Valley Titanium User Group Meetup
                   December 11, 2012

                      Ricardo Alcocer
           Platform Evangelist @ Appcelerator, Inc.

                      @ricardoalcocer
                 ralcocer@appcelerator.com
Presentation format
•  Highly technical - We’ll be writing and
   analyzing code!
•  Less lecture/more step-by-step, hands-on
   guide
•  Slides and code will be made available for
   future reference
•  We will be testing on iOS, everything run on
   Android with some minor adjustments to the
   TSS
What is Alloy
•  MVC Framework
•  Declarative UI
•  Free and Open Source
•  Beta Stage and under heavy
   development
•  Makes writing Titanium Apps Super Easy
   (it actually feels like building a website)
•  Widgets and themes
Installing is easy
1.  Install Titanium Studio
2.  Install Node.js and NPM
3.  Go to Terminal and type:
       $sudo npm install alloy –g

More details at http://bit.ly/alloyqs
Start using it
1.  Create a Titanium Mobile Project
2.  Go to Terminal and type
       $ alloy new
         (future versions of Studio will allow you to create Alloy projects)

3.  A new directory structure will be created
The MVC Pattern

                                       Business logic, data
                           Model	
     manipulation, etc




What the user                                           Routing, decision
sees
                View	
                 Controller	
     making




                            User	
  
Why is MVC important
•  Clear separation of roles
•  Better code organization
•  Easier to maintain and expand
Example 1




Click
The Vocabulary
•  Visit the API reference:
http://docs.appcelerator.com/titanium/latest/
Example 1
   VIEWS/INDEX.XML	
                                                                                                     VIEW	
  
<Alloy>	
  
     	
  <Window	
  class="container">         	
  	
  
     	
       	
  <Label	
  id="label"	
  onClick="showWin2">I'm	
  Window	
  1</Label>	
  
     	
  </Window> 	
  	
  
</Alloy>	
  



                                                                                 STYLES/INDEX.TSS	
  
                                                                             ".container":	
  {	
  
                                                                                       	
  backgroundColor:"white"	
  
                                                                             },	
  
                                                                             "#label":	
  {	
  
                                                                                       	
  width:	
  Ti.UI.SIZE,	
  
                                                                                       	
  height:	
  Ti.UI.SIZE,	
  
                                                                                       	
  color:	
  "#000"	
  
                                                                             }	
  	
  



CONTROLLERS/INDEX.JS	
                         CONTROLLER	
  
function	
  showWin2(e)	
  {	
  	
  	
  
	
  	
  	
  	
  var	
  w=Alloy.createController('win2').getView();	
  
	
  	
  	
  	
  w.open();	
  
}	
  
	
  
$.index.open();	
  
Example 1
   VIEWS/INDEX.XML	
                                                                                                     VIEW	
  
<Alloy>	
  
     	
  <Window	
  class="container">         	
  	
  
     	
       	
  <Label	
  id="label"	
  onClick="showWin2">I'm	
  Window	
  1</Label>	
  
     	
  </Window>	
  
</Alloy>	
  



                                                                                 STYLES/INDEX.TSS	
  
                                                                             ".container":	
  {	
  
                                                                                       	
  backgroundColor:"white"	
  
                                                                             },	
  
                                                                             "#label":	
  {	
  
                                                                                       	
  width:	
  Ti.UI.SIZE,	
  
                                                                                       	
  height:	
  Ti.UI.SIZE,	
  
                                                                                       	
  color:	
  "#000"	
  
                                                                             }	
  	
  



CONTROLLERS/INDEX.JS	
                         CONTROLLER	
  
function	
  showWin2(e)	
  {	
  	
  	
  
	
  	
  	
  	
  var	
  w=Alloy.createController('win2').getView();	
  
	
  	
  	
  	
  w.open();	
  
}	
  
	
  
$.index.open();	
  
Example 1
CONTROLLERS/INDEX.JS	
  
function	
  showWin2(e)	
  {	
  	
  	
  
	
  	
  	
  	
  var	
  w=Alloy.createController('win2').getView();	
  
	
  	
  	
  	
  w.open();	
  
}	
  
	
  
$.index.open();	
  




   VIEWS/WIN2.XML	
                                         STYLES/WIN2.TSS	
                       CONTROLLERS/WIN2.JS	
  
<Alloy>	
                                               "#container":{	
                            function	
  closeme(){	
  
     	
  <Window	
  id="container">	
                          	
  backgroundColor:	
  "#000"	
           	
  $.container.close();	
  
     	
       	
  <Label	
  id="thelabel"	
             },	
                                        }	
  
onClick="closeme">I'm	
  Window	
  2</Label>	
          "#thelabel":{	
  
     	
  </Window>	
                                           	
  height:	
  Ti.UI.SIZE,	
  
</Alloy>	
                                                     	
  width:	
  Ti.UI.SIZE,	
  
                                                               	
  color:	
  "#fff"	
  
                                                        }	
  
Example 1
CONTROLLERS/INDEX.JS	
  
function	
  showWin2(e)	
  {	
  	
  	
  
	
  	
  	
  	
  var	
  w=Alloy.createController('win2').getView();	
  
	
  	
  	
  	
  w.open();	
  
}	
  
	
  
$.index.open();	
  




   VIEWS/WIN2.XML	
                                         STYLES/WIN2.TSS	
                       CONTROLLERS/WIN2.JS	
  
<Alloy>	
                                               "#container":{	
                            function	
  closeme(){	
  
     	
  <Window	
  id="container">	
                          	
  backgroundColor:	
  "#000"	
           	
  $.container.close();	
  
     	
       	
  <Label	
  id="thelabel"	
             },	
                                        }	
  
onClick="closeme">I'm	
  Window	
  2</Label>	
          "#thelabel":{	
  
     	
  </Window>	
                                           	
  height:	
  Ti.UI.SIZE,	
  
</Alloy>	
                                                     	
  width:	
  Ti.UI.SIZE,	
  
                                                               	
  color:	
  "#fff"	
  
                                                        }	
  
Example 1
CONTROLLERS/INDEX.JS	
  
function	
  showWin2(e)	
  {	
  	
  	
  
	
  	
  	
  	
  var	
  w=Alloy.createController('win2').getView();	
  
	
  	
  	
  	
  w.open();	
  
}	
  
	
  
$.index.open();	
  


                                                               At this point, w is a Titanium Window Object




   VIEWS/WIN2.XML	
                                         STYLES/WIN2.TSS	
                       CONTROLLERS/WIN2.JS	
  
<Alloy>	
                                               "#container":{	
                            function	
  closeme(){	
  
     	
  <Window	
  id="container">	
                          	
  backgroundColor:	
  "#000"	
           	
  $.container.close();	
  
     	
       	
  <Label	
  id="thelabel"	
             },	
                                        }	
  
onClick="closeme">I'm	
  Window	
  2</Label>	
          "#thelabel":{	
  
     	
  </Window>	
                                           	
  height:	
  Ti.UI.SIZE,	
  
</Alloy>	
                                                     	
  width:	
  Ti.UI.SIZE,	
  
                                                               	
  color:	
  "#fff"	
  
                                                        }	
  
Example 2



Click
Example 2
     VIEWS/INDEX.XML	
  
<Alloy>	
  
     	
  <Window	
  class="container"	
  id="win">	
  
     	
       	
  <TableView	
  id="itemsList"	
  onClick="showItems"></TableView>	
  
     	
  </Window>	
  
</Alloy>	
  

                                                          CONTROLLERS/INDEX.JS	
  
                                                          function	
  showItems(e)	
  {	
  	
  	
  
                                                                           	
  var	
  payload={	
  
                                                          	
  	
  	
  	
   	
          	
  rowId:e.rowData.rowId,	
  
     STYLES/INDEX.TSS	
                                                    	
          	
  itemName:e.rowData.itemName	
  
“.container":	
  {	
                                      	
  	
  	
  	
   	
  }	
  
      	
  backgroundColor:"white"	
                       	
  	
  	
  	
   	
  var	
  w=Alloy.createController('detailwin',payload).getView();	
  
}	
                                                       	
  	
  	
  	
   	
  w.open();	
  
                                                          }	
  
                                                          	
  
                                                          var	
  rowData=[];	
  
                                                          for(var	
  i=1;i<=10;i++){	
  
                                                                           	
  var	
  payload={	
  
                                                                           	
          	
  rowId:i,	
  
                                                                           	
          	
  itemName:'Test'	
  +	
  i	
  
                                                                           	
  }	
  
                                                                           	
  var	
  row=Alloy.createController('row',payload).getView();	
  
                                                                           	
  rowData.push(row);	
  
                                                          }	
  
                                                          $.itemsList.data=rowData;	
  
                                                          	
  
                                                          	
  
                                                          $.win.open();	
  
                                                          	
  
Example 2
CONTROLLERS/INDEX.JS	
  
...	
  
...	
  
          	
  var	
  payload={	
  
          	
          	
  rowId:i,	
  
          	
          	
  itemName:'Test'	
  +	
  i	
  
          	
  }	
  
          	
  var	
  row=Alloy.createController('row',payload).getView();	
  
          	
  rowData.push(row);	
  
...	
  
...	
  
	
  
	
  

               VIEWS/ROW.XML	
                                                         STYLES/ROW.TSS	
  
     <Alloy>	
                                                                  "#row":{	
  
          	
  <TableViewRow	
  id="row"	
  rowId="1"	
  itemName="Test1">	
            	
  height:	
  "40dp",	
  
          	
       	
  <Label	
  id="itemName">Test	
  1</Label>	
                     	
  hasChild:	
  true	
  
          	
  </TableViewRow>	
                                                 },	
  
     </Alloy>	
                                                                 "#itemName":	
  {	
  
                                                                                       	
  width:	
  Ti.UI.SIZE,	
  
                                                                                       	
  height:	
  Ti.UI.SIZE,	
  
                                                                                       	
  color:	
  "#000",	
  
            CONTROLLERS/ROW.JS	
                                                       	
  left:	
  0	
  
                                                                                }	
  
          var	
  args	
  =	
  arguments[0]	
  ||	
  {};	
  
          	
  
          $.row.rowId=args.rowId;	
  
          $.row.itemName=args.itemName;	
  
          $.itemName.text=args.itemName;	
  
Example 2
CONTROLLERS/INDEX.JS	
  
                                                                                                                STYLES/DETAILWIN.TSS	
  
function	
  showItems(e)	
  {	
  	
  	
  
                 	
  var	
  payload={	
                                                                    ".container":	
  {	
  
	
  	
  	
  	
   	
          	
  rowId:e.rowData.rowId,	
                                                         	
  backgroundColor:	
  "yellow",	
  
                 	
          	
  itemName:e.rowData.itemName	
                                                    	
  layout:"vertical"	
  
	
  	
  	
  	
   	
  }	
                                                                                   },	
  
	
  	
  	
  	
   	
  var	
  w=Alloy.createController('detailwin',payload).getView();	
                     "#itemName":{	
  
	
  	
  	
  	
   	
  w.open();	
                                                                                  	
  height:	
  Ti.UI.SIZE,	
  
}	
                                                                                                               	
  left:	
  0	
  
                                                                                                           },	
  
                                                                                                           "#rowId":{	
  
   VIEWS/DETAILWIN.XML	
                                                                                          	
  height:	
  Ti.UI.SIZE,	
  
                                                                                                                  	
  left:	
  0	
  
<Alloy>	
                                                                                                  },	
  
     	
  <Window	
  id="win"	
  class="container">	
                                                       "#closebtn":{	
  
     	
       	
  <Label	
  id="itemName"></Label>	
                                                              	
  height:	
  Ti.UI.SIZE,	
  
     	
       	
  <Label	
  id="rowId"></Label>	
                                                                 	
  width:	
  Ti.UI.SIZE	
  
     	
       	
  <Button	
  id="closebtn"	
  onClick="closeme">Close	
  Me</Button>	
                     }	
  
     	
  </Window>	
  
</Alloy>	
  

                                                                  CONTROLLERS/DETAILWIN.JS	
  
                                                                  var	
  args	
  =	
  arguments[0]	
  ||	
  {};	
  
                                                                  	
  
                                                                  $.rowId.text=args.rowId;	
  
                                                                  $.itemName.text=args.itemName;	
  
                                                                  	
  
                                                                  function	
  closeme(){	
  
                                                                          	
  $.win.close();	
  
                                                                  }	
  
Let’s build some Alloy XML
Let’s build this with 57 lines of XML
               Markup
Start
 CONTROLLERS/INDEX.XML	
  
<Alloy>	
  
     	
  <Window	
  class="container">	
  
     	
       	
  <View	
  id="main">	
  
     	
       	
  	
  
     	
       	
  </View>	
  
     	
  </Window>	
  
</Alloy>	
  



 CONTROLLERS/INDEX.TSS	
  
".container":	
  {	
  
       	
  backgroundColor:"white",	
  
       	
  orientationModes:	
  [Ti.UI.PORTRAIT,Ti.UI.LANDSCAPE_LEFT,Ti.UI.LANDSCAPE_RIGHT,Ti.UI.UPSIDE_PORTRAIT]	
  
},	
  
"#main":{	
  
       	
  height:	
  Ti.UI.FILL,	
  
       	
  width:	
  Ti.UI.FILL,	
  
       	
  backgroundColor:	
  "#c4cde0",	
  
       	
  left:	
  0,	
  
       	
  layout:	
  "vertical"	
  
}	
  
Cutting the assets
Cutting the assets
                 Sec/on	
  1	
  
                 Sec/on	
  2	
  




                     Sec/on	
  3	
  
STYLES/INDEX.TSS	
  
                                                                                                        "#iconBar":{	
  
                                                                                                               	
  backgroundImage:	
  "iconBarBG.png",	
  
                                                                                                               	
  width:	
  Ti.UI.FILL,	
  
                                                                                                               	
  height:	
  "54"	
  
                                                                                                        },	
  
                                                                                                        "#topActions":{	
  
                                                                                                               	
  width:"150",	
  
                                                                                                               	
  height:"50",	
  
                                                                                                               	
  layout:"horizontal"	
  
                                                                                                        },	
  
                                                                                                        ".topActionButton":{	
  
      VIEWS/INDEX.XML	
                                                                                        	
  	
  height:"50",	
  
                                                                                                               	
  	
  width:"50"	
  
<View	
  id="iconBar">	
  
                                                                                                        },	
  
       	
  <View	
  id="topActions">	
  
       	
         	
  <ImageView	
  class="topActionButton"	
  id="friendsBtn"></ImageView>	
           "#friendsBtn":{	
  
       	
         	
  <ImageView	
  class="topActionButton"	
  id="messagesBtn"></ImageView>	
                 	
  image:"friendsbtn.png"	
  	
  
       	
         	
  <ImageView	
  class="topActionButton"	
  id="notificationsBtn"></ImageView>	
     },	
  
       	
  </View>	
                                                                                    "#messagesBtn":{	
  
       	
  <ImageView	
  id="menubtn"></ImageView>	
                                                           	
  image:"messagesbtn.png"	
  	
  
       	
  <ImageView	
  id="chatbtn"></ImageView>	
                                                    },	
  
</View>	
                                                                                               "#notificationsBtn":{	
  
                                                                                                               	
  image:"notificationsbtn.png"	
  	
  
                                                                                                        },	
  
                                                                                                        "#menubtn":{	
  
                                                                                                               	
  left:	
  0,	
  
                                                                                                               	
  width:	
  "55",	
  
                                                                                                               	
  height:	
  "54",	
  
                                                                                                               	
  image:"menubtn.png"	
  
                                                                                                        },	
  
                                                                                                        "#chatbtn":{	
  
                                                                                                               	
  width:	
  "55",	
  
                                                                                                               	
  height:	
  "54",	
  
                                                                                                               	
  right:	
  0,	
  
                                                                                                               	
  image:"chatbtn.png"	
  
                                                                                                        }	
  
VIEWS/INDEX.XML	
                                                    STYLES/INDEX.TSS	
  
<View	
  id="menuBar">	
                                           "#menuBar":{	
  
     	
  <View	
  class="tbButton">	
                                         	
  backgroundColor:	
  "#f5f6f9",	
  
     	
       	
  <ImageView	
  id="statusBtn"></ImageView>	
                 	
  width:	
  Ti.UI.FILL,	
  
     	
  </View>	
                                                            	
  height:	
  "50",	
  
     	
  <View	
  	
  class="tbButton">	
                                     	
  layout:	
  "horizontal"	
  
     	
       	
  <ImageView	
  id="photoBtn"></ImageView>	
       },	
  	
  
     	
  </View>	
                                                 ".tbButton":{	
  
     	
  <View	
  	
  class="tbButton">	
                                     	
  width:	
  "33%",	
  
     	
       	
  <ImageView	
  id="checkinBtn"></ImageView>	
                	
  height:	
  "50"	
  
     	
  </View>	
                                                 },	
  	
  
</View>	
                                                          "#statusBtn":{	
  
                                                                              	
  width:	
  "73",	
  
                                                                              	
  height:	
  "19",	
  
                                                                              	
  image:	
  "statusbtn.png"	
  
                                                                   },	
  
                                                                   "#photoBtn":{	
  
                                                                              	
  width:	
  "73",	
  
                                                                              	
  height:	
  "19",	
  
                                                                              	
  image:	
  "photobtn.png"	
  
                                                                   },	
  
                                                                   "#checkinBtn":{	
  
                                                                              	
  width:	
  "73",	
  
                                                                              	
  height:	
  "19",	
  
                                                                              	
  image:	
  "checkinbtn.png"	
  
                                                                   }	
  
STYLES/INDEX.TSS	
  
                                                                                                     "#mainList":{	
  
                                                                                                            	
  backgroundColor:	
  "#c4cde0",	
  
                                                                                                            	
  separatorStyle:	
  "NONE"	
  
                                                                                                     },	
  
                                                                                                     "#listRow":{	
  
                                                                                                            	
  height:	
  "200",	
  
                                                                                                            	
  selectionStyle:	
  "NONE"	
  
                                                                                                     },	
  
                                                                                                     "#rowContainer":{	
  
                                                                                                            	
  borderColor:	
  "#cacdd8",	
  
                                                                                                            	
  borderRadius:	
  5,	
  
                                                                                                            	
  borderWidth:	
  1,	
  
      VIEWS/INDEX.XML	
  
                                                                                                            	
  left:	
  "5",	
  
<TableView	
  id="mainList">	
                                                                              	
  right:	
  "5",	
  
     	
  <TableViewRow	
  id="listRow">	
                                                                   	
  top:	
  "5",	
  
     	
       	
  <View	
  id="rowContainer">	
                                                             	
  bottom:	
  "5",	
  
              	
       	
  <ImageView	
  id="profilePic"></ImageView>	
                                     	
  height:	
  Ti.UI.FILL,	
  
              	
       	
  <Label	
  id="profileName">Ricardo	
  Alcocer</Label>	
                          	
  width:	
  Ti.UI.FILL,	
  
              	
       	
  <Label	
  id="timeAgo">10	
  minutes	
  ago</Label>	
                            	
  backgroundColor:	
  "#fff"	
  
              	
       	
  <Label	
  id="status">This	
  is	
  my	
  status	
  update.</Label>	
     },	
  
              	
       	
  <View	
  id="grayLine"	
  bottom="51"></View>	
                           "#profilePic":{	
  
              	
       	
  <View	
  id="bottomActions">	
                                                   	
  	
  width:"66",	
  
              	
       	
       	
  <View	
  class="itemActionButton">	
                                    	
  	
  height:"66",	
  
              	
       	
       	
       	
  <ImageView	
  id="likeBtn"></ImageView>	
                      	
  	
  image:"profilepic.png",	
  
              	
       	
       	
  </View>	
                                                               	
  	
  top:"5",	
  
              	
       	
       	
  <View	
  	
  class="itemActionButton">	
                                	
  	
  left:"5"	
  
              	
       	
       	
       	
  <ImageView	
  id="commentBtn"></ImageView>	
            },	
  
              	
       	
       	
  </View>	
                                                        "#profileName":{	
  
              	
       	
  </View>	
                                                                        	
  top:	
  "5",	
  
              	
  </View>	
                                                                                 	
  left:	
  "80",	
  
     	
  </TableViewRow>	
                                                                                  	
  color:	
  "#576b95",	
  
</TableView>	
                                                                                              	
  font:	
  {	
  
                                                                                                            	
          	
  fontSize	
  :	
  "16",	
  
                                                                                                            	
          	
  fontWeight:	
  "bold"	
  
                                                                                                            	
  }	
  
                                                                                                     }	
  
STYLES/INDEX.TSS	
  
                                                                                                     "#timeAgo":{	
  
                                                                                                            	
  top:	
  "25",	
  
                                                                                                            	
  left:	
  "80",	
  
                                                                                                            	
  color:	
  "#bbbbbb",	
  
                                                                                                            	
  font:	
  {	
  
                                                                                                            	
          	
  fontSize	
  :	
  "16"	
  
                                                                                                            	
  }	
  
                                                                                                     },	
  
                                                                                                     "#status":{	
  
                                                                                                            	
  width:	
  Ti.UI.SIZE,	
  
                                                                                                            	
  left:	
  5,	
  
                                                                                                            	
  right:	
  5,	
  
      VIEWS/INDEX.XML	
                                                                                     	
  font:	
  {	
  
<TableView	
  id="mainList">	
                                                                              	
          	
  fontSize	
  :	
  "16"	
  
     	
  <TableViewRow	
  id="listRow">	
                                                                   	
  }	
  
     	
       	
  <View	
  id="rowContainer">	
                                                      },	
  
              	
       	
  <ImageView	
  id="profilePic"></ImageView>	
                              "#bottomActions":{	
  
              	
       	
  <Label	
  id="profileName">Ricardo	
  Alcocer</Label>	
                          	
  bottom:	
  0,	
  
              	
       	
  <Label	
  id="timeAgo">10	
  minutes	
  ago</Label>	
                            	
  height:	
  "50",	
  
              	
       	
  <Label	
  id="status">This	
  is	
  my	
  status	
  update.</Label>	
            	
  width:	
  Ti.UI.FILL,	
  
              	
       	
  <View	
  id="grayLine"	
  bottom="51"></View>	
                                  	
  backgroundColor:	
  "#eff2f5",	
  
              	
       	
  <View	
  id="bottomActions">	
                                                   	
  layout:	
  "horizontal"	
  
              	
       	
       	
  <View	
  class="itemActionButton">	
                             },	
  
              	
       	
       	
       	
  <ImageView	
  id="likeBtn"></ImageView>	
               ".itemActionButton":{	
  
              	
       	
       	
  </View>	
                                                               	
  width:	
  "50%",	
  
              	
       	
       	
  <View	
  	
  class="itemActionButton">	
                                	
  height:	
  "50"	
  
              	
       	
       	
       	
  <ImageView	
  id="commentBtn"></ImageView>	
            },	
  
              	
       	
       	
  </View>	
                                                        "#likeBtn":{	
  
              	
       	
  </View>	
                                                                        	
  width:	
  "76",	
  
              	
  </View>	
                                                                                 	
  height:	
  "20",	
  
     	
  </TableViewRow>	
                                                                                  	
  image:	
  "likebtn.png"	
  
</TableView>	
                                                                                       },	
  
                                                                                                     "#commentBtn":{	
  
                                                                                                            	
  width:	
  "76",	
  
                                                                                                            	
  height:	
  "20",	
  
                                                                                                            	
  image:	
  "commentbtn.png"	
  
                                                                                                     }	
  
The Controller
  CONTROLLERS/INDEX.JS	
  

 $.index.open();	
  
Putting it all together

      Live Demo
Adding the “Menu” View
      VIEWS/INDEX.XML	
  
<Window	
  class="container">	
  
      	
      	
  <View	
  id="menu"	
  onClick="hidemenu"></View>	
  
      	
      	
  <View	
  id="main">	
  
      	
      	
         	
  <View	
  id="iconBar">	
  
      	
      	
         	
         	
  <View	
  id="topActions">	
  
      	
      	
         	
         	
         	
      	
  <ImageView	
  class="topActionButton"	
  id="friendsBtn"></ImageView>	
  
      	
      	
         	
         	
         	
      	
  <ImageView	
  class="topActionButton"	
  id="messagesBtn"></ImageView>	
  
      	
      	
         	
         	
         	
      	
  <ImageView	
  class="topActionButton"	
  id="notificationsBtn"></ImageView>	
  
      	
      	
         	
         	
  </View>	
  
      	
      	
      	
        	
  <ImageView	
  id="menubtn"	
  onClick="showmenu"></ImageView>	
  
      	
      	
      	
        	
  <ImageView	
  id="chatbtn"></ImageView>	
  
      	
      	
      	
  </View>	
  


   CONTROLLERS/INDEX.JS	
                                                                            STYLES/INDEX.TSS	
  
function	
  showmenu(e){	
                                                                    "#menu":{	
  
      	
  $.main.width=Ti.Platform.displayCaps.platformWidth;	
                                     	
  height:	
  Ti.UI.FILL,	
  
      	
  $.main.animate({	
                                                                        	
  width:	
  Ti.UI.FILL,	
  
      	
          	
  left:300,	
                                                                   	
  backgroundColor:	
  "#2c323f",	
  
      	
          	
  duration:100	
                                                                	
  left:	
  0    	
  	
  
      	
  });	
                                                                               }	
  
}	
  
	
  
function	
  hidemenu(e){	
  
      	
  $.main.width=Ti.Platform.displayCaps.platformWidth;	
  
      	
  $.main.animate({	
  
      	
          	
  left:0,	
  
      	
          	
  duration:100	
  
      	
  });	
  
}	
  
	
  
$.index.open();	
  
Resources
This deck
http://slideshare.net/ricardoalcocer
http://speakerdeck.com/ricardoalcocer



Code Samples Github Repository
http://bit.ly/SVTUG1212-code


Official Alloy Github Repository
https://github.com/appcelerator/alloy   <- Look under /test/apps



Alloy App Framework Overview from CodeStrong 2012
http://www.slideshare.net/TonyLukasavage/alloy-codestrong-2012-15179451
Questions?



Thank you
      Ricardo Alcocer
ralcocer@appcelerator.com
      @ricardoalcocer

More Related Content

What's hot

Design Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesDesign Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesMichael Galpin
 
First Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentFirst Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentNuvole
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsEPAM Systems
 
Hacking Your Way to Better Security - PHP South Africa 2016
Hacking Your Way to Better Security - PHP South Africa 2016Hacking Your Way to Better Security - PHP South Africa 2016
Hacking Your Way to Better Security - PHP South Africa 2016Colin O'Dell
 
Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5성일 한
 
Academy PRO: React native - building first scenes
Academy PRO: React native - building first scenesAcademy PRO: React native - building first scenes
Academy PRO: React native - building first scenesBinary Studio
 
Hacking Your Way To Better Security
Hacking Your Way To Better SecurityHacking Your Way To Better Security
Hacking Your Way To Better SecurityColin O'Dell
 
Modules and injector
Modules and injectorModules and injector
Modules and injectorEyal Vardi
 
Angular JS blog tutorial
Angular JS blog tutorialAngular JS blog tutorial
Angular JS blog tutorialClaude Tech
 
UIAutomation + Mechanic.js
UIAutomation + Mechanic.jsUIAutomation + Mechanic.js
UIAutomation + Mechanic.jsjaykz52
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web ComponentsFelix Arntz
 
Academy PRO: React native - miscellaneous
Academy PRO: React native - miscellaneousAcademy PRO: React native - miscellaneous
Academy PRO: React native - miscellaneousBinary Studio
 
Sencha Touch - Introduction
Sencha Touch - IntroductionSencha Touch - Introduction
Sencha Touch - IntroductionABC-GROEP.BE
 
JSF Custom Components
JSF Custom ComponentsJSF Custom Components
JSF Custom ComponentsMichael Fons
 
Web internship Yii Framework
Web internship  Yii FrameworkWeb internship  Yii Framework
Web internship Yii FrameworkNoveo
 
Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)tompunk
 
Real Time App with Node.js
Real Time App with Node.jsReal Time App with Node.js
Real Time App with Node.jsJxck Jxck
 
Jquery tutorial-beginners
Jquery tutorial-beginnersJquery tutorial-beginners
Jquery tutorial-beginnersIsfand yar Khan
 

What's hot (20)

Design Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesDesign Patterns for Tablets and Smartphones
Design Patterns for Tablets and Smartphones
 
First Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentFirst Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven Development
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
Hacking Your Way to Better Security - PHP South Africa 2016
Hacking Your Way to Better Security - PHP South Africa 2016Hacking Your Way to Better Security - PHP South Africa 2016
Hacking Your Way to Better Security - PHP South Africa 2016
 
Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5Laravel 로 배우는 서버사이드 #5
Laravel 로 배우는 서버사이드 #5
 
Academy PRO: React native - building first scenes
Academy PRO: React native - building first scenesAcademy PRO: React native - building first scenes
Academy PRO: React native - building first scenes
 
Hacking Your Way To Better Security
Hacking Your Way To Better SecurityHacking Your Way To Better Security
Hacking Your Way To Better Security
 
Modules and injector
Modules and injectorModules and injector
Modules and injector
 
Jquery examples
Jquery examplesJquery examples
Jquery examples
 
Angular JS blog tutorial
Angular JS blog tutorialAngular JS blog tutorial
Angular JS blog tutorial
 
UIAutomation + Mechanic.js
UIAutomation + Mechanic.jsUIAutomation + Mechanic.js
UIAutomation + Mechanic.js
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web Components
 
Academy PRO: React native - miscellaneous
Academy PRO: React native - miscellaneousAcademy PRO: React native - miscellaneous
Academy PRO: React native - miscellaneous
 
Sencha Touch - Introduction
Sencha Touch - IntroductionSencha Touch - Introduction
Sencha Touch - Introduction
 
The Rails Way
The Rails WayThe Rails Way
The Rails Way
 
JSF Custom Components
JSF Custom ComponentsJSF Custom Components
JSF Custom Components
 
Web internship Yii Framework
Web internship  Yii FrameworkWeb internship  Yii Framework
Web internship Yii Framework
 
Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)
 
Real Time App with Node.js
Real Time App with Node.jsReal Time App with Node.js
Real Time App with Node.js
 
Jquery tutorial-beginners
Jquery tutorial-beginnersJquery tutorial-beginners
Jquery tutorial-beginners
 

Similar to Learning Appcelerator® Alloy™

Codestrong 2012 breakout session what's new in titanium studio
Codestrong 2012 breakout session   what's new in titanium studioCodestrong 2012 breakout session   what's new in titanium studio
Codestrong 2012 breakout session what's new in titanium studioAxway Appcelerator
 
Jacob Waller: Webifying Titanium Development
Jacob Waller: Webifying Titanium DevelopmentJacob Waller: Webifying Titanium Development
Jacob Waller: Webifying Titanium DevelopmentAxway Appcelerator
 
Titanium Appcelerator - Beginners
Titanium Appcelerator - BeginnersTitanium Appcelerator - Beginners
Titanium Appcelerator - BeginnersAmbarish Hazarnis
 
Alloy Tips & Tricks #TiLon
Alloy Tips & Tricks #TiLonAlloy Tips & Tricks #TiLon
Alloy Tips & Tricks #TiLonFokke Zandbergen
 
ProjectProject's Presentation for TiConf 2013
ProjectProject's Presentation for TiConf 2013ProjectProject's Presentation for TiConf 2013
ProjectProject's Presentation for TiConf 2013Raef Akehurst
 
Appcelerator Titanium Kinetic practices part 1
Appcelerator Titanium Kinetic practices part 1Appcelerator Titanium Kinetic practices part 1
Appcelerator Titanium Kinetic practices part 1フ乇丂ひ丂
 
Android development with Scala and SBT
Android development with Scala and SBTAndroid development with Scala and SBT
Android development with Scala and SBTAnton Yalyshev
 
Getting started with Appcelerator Titanium
Getting started with Appcelerator TitaniumGetting started with Appcelerator Titanium
Getting started with Appcelerator TitaniumTechday7
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Jen Andre
 
Appsplash'16 session (3) "Ui components"
Appsplash'16 session (3) "Ui components"Appsplash'16 session (3) "Ui components"
Appsplash'16 session (3) "Ui components"Hany Halim
 
2017-06-22 Documentation as code
2017-06-22 Documentation as code2017-06-22 Documentation as code
2017-06-22 Documentation as codeJérémie Bresson
 
Getting started with titanium
Getting started with titaniumGetting started with titanium
Getting started with titaniumNaga Harish M
 
Documentation For Tab Setup
Documentation For Tab SetupDocumentation For Tab Setup
Documentation For Tab Setupvkeeton
 
Creating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off SwitchCreating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off SwitchRuss Weakley
 

Similar to Learning Appcelerator® Alloy™ (20)

Codestrong 2012 breakout session what's new in titanium studio
Codestrong 2012 breakout session   what's new in titanium studioCodestrong 2012 breakout session   what's new in titanium studio
Codestrong 2012 breakout session what's new in titanium studio
 
Play!ng with scala
Play!ng with scalaPlay!ng with scala
Play!ng with scala
 
Jacob Waller: Webifying Titanium Development
Jacob Waller: Webifying Titanium DevelopmentJacob Waller: Webifying Titanium Development
Jacob Waller: Webifying Titanium Development
 
Titanium Appcelerator - Beginners
Titanium Appcelerator - BeginnersTitanium Appcelerator - Beginners
Titanium Appcelerator - Beginners
 
Alloy Tips & Tricks #TiLon
Alloy Tips & Tricks #TiLonAlloy Tips & Tricks #TiLon
Alloy Tips & Tricks #TiLon
 
Jquery
JqueryJquery
Jquery
 
ProjectProject's Presentation for TiConf 2013
ProjectProject's Presentation for TiConf 2013ProjectProject's Presentation for TiConf 2013
ProjectProject's Presentation for TiConf 2013
 
Ext JS Introduction
Ext JS IntroductionExt JS Introduction
Ext JS Introduction
 
Appcelerator Titanium Kinetic practices part 1
Appcelerator Titanium Kinetic practices part 1Appcelerator Titanium Kinetic practices part 1
Appcelerator Titanium Kinetic practices part 1
 
Android L01 - Warm Up
Android L01 - Warm UpAndroid L01 - Warm Up
Android L01 - Warm Up
 
Android
AndroidAndroid
Android
 
Android development with Scala and SBT
Android development with Scala and SBTAndroid development with Scala and SBT
Android development with Scala and SBT
 
Getting started with Appcelerator Titanium
Getting started with Appcelerator TitaniumGetting started with Appcelerator Titanium
Getting started with Appcelerator Titanium
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'
 
Appsplash'16 session (3) "Ui components"
Appsplash'16 session (3) "Ui components"Appsplash'16 session (3) "Ui components"
Appsplash'16 session (3) "Ui components"
 
2017-06-22 Documentation as code
2017-06-22 Documentation as code2017-06-22 Documentation as code
2017-06-22 Documentation as code
 
Getting started with titanium
Getting started with titaniumGetting started with titanium
Getting started with titanium
 
Documentation For Tab Setup
Documentation For Tab SetupDocumentation For Tab Setup
Documentation For Tab Setup
 
Creating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off SwitchCreating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off Switch
 

More from ralcocer

Multi platform development using titanium + alloy
Multi platform development using titanium + alloyMulti platform development using titanium + alloy
Multi platform development using titanium + alloyralcocer
 
Building websites with Node.ACS
Building websites with Node.ACSBuilding websites with Node.ACS
Building websites with Node.ACSralcocer
 
Develop your first mobile App for iOS and Android
Develop your first mobile App for iOS and AndroidDevelop your first mobile App for iOS and Android
Develop your first mobile App for iOS and Androidralcocer
 
Slides for tiTokyo 2013 - Japanese version
Slides for tiTokyo 2013 - Japanese versionSlides for tiTokyo 2013 - Japanese version
Slides for tiTokyo 2013 - Japanese versionralcocer
 
Appcelerator Alloy Deep Dive - tiTokyo 2013
Appcelerator Alloy Deep Dive - tiTokyo 2013Appcelerator Alloy Deep Dive - tiTokyo 2013
Appcelerator Alloy Deep Dive - tiTokyo 2013ralcocer
 
De Wordpress.com a Wordpress.org
De Wordpress.com a Wordpress.orgDe Wordpress.com a Wordpress.org
De Wordpress.com a Wordpress.orgralcocer
 
Barcamp Mayaguez 2012
Barcamp Mayaguez 2012Barcamp Mayaguez 2012
Barcamp Mayaguez 2012ralcocer
 
Cómo crear plugins para Wordpress
Cómo crear plugins para WordpressCómo crear plugins para Wordpress
Cómo crear plugins para Wordpressralcocer
 
Open Source, estándares y arquitecturas Web 2.0
Open Source, estándares y arquitecturas Web 2.0Open Source, estándares y arquitecturas Web 2.0
Open Source, estándares y arquitecturas Web 2.0ralcocer
 
El pensamiento crítico y el uso de tecnología
El pensamiento crítico y el uso de tecnologíaEl pensamiento crítico y el uso de tecnología
El pensamiento crítico y el uso de tecnologíaralcocer
 
El OpenSource en la educación
El OpenSource en la educaciónEl OpenSource en la educación
El OpenSource en la educaciónralcocer
 
El valor educativo del Open Source
El valor educativo del Open SourceEl valor educativo del Open Source
El valor educativo del Open Sourceralcocer
 
Presentación APH
Presentación APHPresentación APH
Presentación APHralcocer
 
Educapr Oct2010
Educapr Oct2010Educapr Oct2010
Educapr Oct2010ralcocer
 
The Future is Open - Pechakucha@SeriouslyCreative - August 26, 2010
The Future is Open - Pechakucha@SeriouslyCreative - August 26, 2010The Future is Open - Pechakucha@SeriouslyCreative - August 26, 2010
The Future is Open - Pechakucha@SeriouslyCreative - August 26, 2010ralcocer
 

More from ralcocer (15)

Multi platform development using titanium + alloy
Multi platform development using titanium + alloyMulti platform development using titanium + alloy
Multi platform development using titanium + alloy
 
Building websites with Node.ACS
Building websites with Node.ACSBuilding websites with Node.ACS
Building websites with Node.ACS
 
Develop your first mobile App for iOS and Android
Develop your first mobile App for iOS and AndroidDevelop your first mobile App for iOS and Android
Develop your first mobile App for iOS and Android
 
Slides for tiTokyo 2013 - Japanese version
Slides for tiTokyo 2013 - Japanese versionSlides for tiTokyo 2013 - Japanese version
Slides for tiTokyo 2013 - Japanese version
 
Appcelerator Alloy Deep Dive - tiTokyo 2013
Appcelerator Alloy Deep Dive - tiTokyo 2013Appcelerator Alloy Deep Dive - tiTokyo 2013
Appcelerator Alloy Deep Dive - tiTokyo 2013
 
De Wordpress.com a Wordpress.org
De Wordpress.com a Wordpress.orgDe Wordpress.com a Wordpress.org
De Wordpress.com a Wordpress.org
 
Barcamp Mayaguez 2012
Barcamp Mayaguez 2012Barcamp Mayaguez 2012
Barcamp Mayaguez 2012
 
Cómo crear plugins para Wordpress
Cómo crear plugins para WordpressCómo crear plugins para Wordpress
Cómo crear plugins para Wordpress
 
Open Source, estándares y arquitecturas Web 2.0
Open Source, estándares y arquitecturas Web 2.0Open Source, estándares y arquitecturas Web 2.0
Open Source, estándares y arquitecturas Web 2.0
 
El pensamiento crítico y el uso de tecnología
El pensamiento crítico y el uso de tecnologíaEl pensamiento crítico y el uso de tecnología
El pensamiento crítico y el uso de tecnología
 
El OpenSource en la educación
El OpenSource en la educaciónEl OpenSource en la educación
El OpenSource en la educación
 
El valor educativo del Open Source
El valor educativo del Open SourceEl valor educativo del Open Source
El valor educativo del Open Source
 
Presentación APH
Presentación APHPresentación APH
Presentación APH
 
Educapr Oct2010
Educapr Oct2010Educapr Oct2010
Educapr Oct2010
 
The Future is Open - Pechakucha@SeriouslyCreative - August 26, 2010
The Future is Open - Pechakucha@SeriouslyCreative - August 26, 2010The Future is Open - Pechakucha@SeriouslyCreative - August 26, 2010
The Future is Open - Pechakucha@SeriouslyCreative - August 26, 2010
 

Recently uploaded

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 

Recently uploaded (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Learning Appcelerator® Alloy™

  • 1. Learning Appcelerator® Alloy™ Silicon Valley Titanium User Group Meetup December 11, 2012 Ricardo Alcocer Platform Evangelist @ Appcelerator, Inc. @ricardoalcocer ralcocer@appcelerator.com
  • 2. Presentation format •  Highly technical - We’ll be writing and analyzing code! •  Less lecture/more step-by-step, hands-on guide •  Slides and code will be made available for future reference •  We will be testing on iOS, everything run on Android with some minor adjustments to the TSS
  • 3. What is Alloy •  MVC Framework •  Declarative UI •  Free and Open Source •  Beta Stage and under heavy development •  Makes writing Titanium Apps Super Easy (it actually feels like building a website) •  Widgets and themes
  • 4. Installing is easy 1.  Install Titanium Studio 2.  Install Node.js and NPM 3.  Go to Terminal and type: $sudo npm install alloy –g More details at http://bit.ly/alloyqs
  • 5. Start using it 1.  Create a Titanium Mobile Project 2.  Go to Terminal and type $ alloy new (future versions of Studio will allow you to create Alloy projects) 3.  A new directory structure will be created
  • 6. The MVC Pattern Business logic, data Model   manipulation, etc What the user Routing, decision sees View   Controller   making User  
  • 7. Why is MVC important •  Clear separation of roles •  Better code organization •  Easier to maintain and expand
  • 9. The Vocabulary •  Visit the API reference: http://docs.appcelerator.com/titanium/latest/
  • 10. Example 1 VIEWS/INDEX.XML   VIEW   <Alloy>    <Window  class="container">        <Label  id="label"  onClick="showWin2">I'm  Window  1</Label>    </Window>     </Alloy>   STYLES/INDEX.TSS   ".container":  {    backgroundColor:"white"   },   "#label":  {    width:  Ti.UI.SIZE,    height:  Ti.UI.SIZE,    color:  "#000"   }     CONTROLLERS/INDEX.JS   CONTROLLER   function  showWin2(e)  {              var  w=Alloy.createController('win2').getView();          w.open();   }     $.index.open();  
  • 11. Example 1 VIEWS/INDEX.XML   VIEW   <Alloy>    <Window  class="container">        <Label  id="label"  onClick="showWin2">I'm  Window  1</Label>    </Window>   </Alloy>   STYLES/INDEX.TSS   ".container":  {    backgroundColor:"white"   },   "#label":  {    width:  Ti.UI.SIZE,    height:  Ti.UI.SIZE,    color:  "#000"   }     CONTROLLERS/INDEX.JS   CONTROLLER   function  showWin2(e)  {              var  w=Alloy.createController('win2').getView();          w.open();   }     $.index.open();  
  • 12. Example 1 CONTROLLERS/INDEX.JS   function  showWin2(e)  {              var  w=Alloy.createController('win2').getView();          w.open();   }     $.index.open();   VIEWS/WIN2.XML   STYLES/WIN2.TSS   CONTROLLERS/WIN2.JS   <Alloy>   "#container":{   function  closeme(){    <Window  id="container">    backgroundColor:  "#000"    $.container.close();      <Label  id="thelabel"   },   }   onClick="closeme">I'm  Window  2</Label>   "#thelabel":{    </Window>    height:  Ti.UI.SIZE,   </Alloy>    width:  Ti.UI.SIZE,    color:  "#fff"   }  
  • 13. Example 1 CONTROLLERS/INDEX.JS   function  showWin2(e)  {              var  w=Alloy.createController('win2').getView();          w.open();   }     $.index.open();   VIEWS/WIN2.XML   STYLES/WIN2.TSS   CONTROLLERS/WIN2.JS   <Alloy>   "#container":{   function  closeme(){    <Window  id="container">    backgroundColor:  "#000"    $.container.close();      <Label  id="thelabel"   },   }   onClick="closeme">I'm  Window  2</Label>   "#thelabel":{    </Window>    height:  Ti.UI.SIZE,   </Alloy>    width:  Ti.UI.SIZE,    color:  "#fff"   }  
  • 14. Example 1 CONTROLLERS/INDEX.JS   function  showWin2(e)  {              var  w=Alloy.createController('win2').getView();          w.open();   }     $.index.open();   At this point, w is a Titanium Window Object VIEWS/WIN2.XML   STYLES/WIN2.TSS   CONTROLLERS/WIN2.JS   <Alloy>   "#container":{   function  closeme(){    <Window  id="container">    backgroundColor:  "#000"    $.container.close();      <Label  id="thelabel"   },   }   onClick="closeme">I'm  Window  2</Label>   "#thelabel":{    </Window>    height:  Ti.UI.SIZE,   </Alloy>    width:  Ti.UI.SIZE,    color:  "#fff"   }  
  • 16. Example 2 VIEWS/INDEX.XML   <Alloy>    <Window  class="container"  id="win">      <TableView  id="itemsList"  onClick="showItems"></TableView>    </Window>   </Alloy>   CONTROLLERS/INDEX.JS   function  showItems(e)  {        var  payload={              rowId:e.rowData.rowId,   STYLES/INDEX.TSS      itemName:e.rowData.itemName   “.container":  {            }    backgroundColor:"white"            var  w=Alloy.createController('detailwin',payload).getView();   }            w.open();   }     var  rowData=[];   for(var  i=1;i<=10;i++){    var  payload={      rowId:i,      itemName:'Test'  +  i    }    var  row=Alloy.createController('row',payload).getView();    rowData.push(row);   }   $.itemsList.data=rowData;       $.win.open();    
  • 17. Example 2 CONTROLLERS/INDEX.JS   ...   ...    var  payload={      rowId:i,      itemName:'Test'  +  i    }    var  row=Alloy.createController('row',payload).getView();    rowData.push(row);   ...   ...       VIEWS/ROW.XML   STYLES/ROW.TSS   <Alloy>   "#row":{    <TableViewRow  id="row"  rowId="1"  itemName="Test1">    height:  "40dp",      <Label  id="itemName">Test  1</Label>    hasChild:  true    </TableViewRow>   },   </Alloy>   "#itemName":  {    width:  Ti.UI.SIZE,    height:  Ti.UI.SIZE,    color:  "#000",   CONTROLLERS/ROW.JS    left:  0   }   var  args  =  arguments[0]  ||  {};     $.row.rowId=args.rowId;   $.row.itemName=args.itemName;   $.itemName.text=args.itemName;  
  • 18. Example 2 CONTROLLERS/INDEX.JS   STYLES/DETAILWIN.TSS   function  showItems(e)  {        var  payload={   ".container":  {              rowId:e.rowData.rowId,    backgroundColor:  "yellow",      itemName:e.rowData.itemName    layout:"vertical"            }   },            var  w=Alloy.createController('detailwin',payload).getView();   "#itemName":{            w.open();    height:  Ti.UI.SIZE,   }    left:  0   },   "#rowId":{   VIEWS/DETAILWIN.XML    height:  Ti.UI.SIZE,    left:  0   <Alloy>   },    <Window  id="win"  class="container">   "#closebtn":{      <Label  id="itemName"></Label>    height:  Ti.UI.SIZE,      <Label  id="rowId"></Label>    width:  Ti.UI.SIZE      <Button  id="closebtn"  onClick="closeme">Close  Me</Button>   }    </Window>   </Alloy>   CONTROLLERS/DETAILWIN.JS   var  args  =  arguments[0]  ||  {};     $.rowId.text=args.rowId;   $.itemName.text=args.itemName;     function  closeme(){    $.win.close();   }  
  • 19. Let’s build some Alloy XML
  • 20. Let’s build this with 57 lines of XML Markup
  • 21. Start CONTROLLERS/INDEX.XML   <Alloy>    <Window  class="container">      <View  id="main">            </View>    </Window>   </Alloy>   CONTROLLERS/INDEX.TSS   ".container":  {    backgroundColor:"white",    orientationModes:  [Ti.UI.PORTRAIT,Ti.UI.LANDSCAPE_LEFT,Ti.UI.LANDSCAPE_RIGHT,Ti.UI.UPSIDE_PORTRAIT]   },   "#main":{    height:  Ti.UI.FILL,    width:  Ti.UI.FILL,    backgroundColor:  "#c4cde0",    left:  0,    layout:  "vertical"   }  
  • 23. Cutting the assets Sec/on  1   Sec/on  2   Sec/on  3  
  • 24. STYLES/INDEX.TSS   "#iconBar":{    backgroundImage:  "iconBarBG.png",    width:  Ti.UI.FILL,    height:  "54"   },   "#topActions":{    width:"150",    height:"50",    layout:"horizontal"   },   ".topActionButton":{   VIEWS/INDEX.XML      height:"50",      width:"50"   <View  id="iconBar">   },    <View  id="topActions">      <ImageView  class="topActionButton"  id="friendsBtn"></ImageView>   "#friendsBtn":{      <ImageView  class="topActionButton"  id="messagesBtn"></ImageView>    image:"friendsbtn.png"        <ImageView  class="topActionButton"  id="notificationsBtn"></ImageView>   },    </View>   "#messagesBtn":{    <ImageView  id="menubtn"></ImageView>    image:"messagesbtn.png"      <ImageView  id="chatbtn"></ImageView>   },   </View>   "#notificationsBtn":{    image:"notificationsbtn.png"     },   "#menubtn":{    left:  0,    width:  "55",    height:  "54",    image:"menubtn.png"   },   "#chatbtn":{    width:  "55",    height:  "54",    right:  0,    image:"chatbtn.png"   }  
  • 25. VIEWS/INDEX.XML   STYLES/INDEX.TSS   <View  id="menuBar">   "#menuBar":{    <View  class="tbButton">    backgroundColor:  "#f5f6f9",      <ImageView  id="statusBtn"></ImageView>    width:  Ti.UI.FILL,    </View>    height:  "50",    <View    class="tbButton">    layout:  "horizontal"      <ImageView  id="photoBtn"></ImageView>   },      </View>   ".tbButton":{    <View    class="tbButton">    width:  "33%",      <ImageView  id="checkinBtn"></ImageView>    height:  "50"    </View>   },     </View>   "#statusBtn":{    width:  "73",    height:  "19",    image:  "statusbtn.png"   },   "#photoBtn":{    width:  "73",    height:  "19",    image:  "photobtn.png"   },   "#checkinBtn":{    width:  "73",    height:  "19",    image:  "checkinbtn.png"   }  
  • 26. STYLES/INDEX.TSS   "#mainList":{    backgroundColor:  "#c4cde0",    separatorStyle:  "NONE"   },   "#listRow":{    height:  "200",    selectionStyle:  "NONE"   },   "#rowContainer":{    borderColor:  "#cacdd8",    borderRadius:  5,    borderWidth:  1,   VIEWS/INDEX.XML    left:  "5",   <TableView  id="mainList">    right:  "5",    <TableViewRow  id="listRow">    top:  "5",      <View  id="rowContainer">    bottom:  "5",      <ImageView  id="profilePic"></ImageView>    height:  Ti.UI.FILL,      <Label  id="profileName">Ricardo  Alcocer</Label>    width:  Ti.UI.FILL,      <Label  id="timeAgo">10  minutes  ago</Label>    backgroundColor:  "#fff"      <Label  id="status">This  is  my  status  update.</Label>   },      <View  id="grayLine"  bottom="51"></View>   "#profilePic":{      <View  id="bottomActions">      width:"66",        <View  class="itemActionButton">      height:"66",          <ImageView  id="likeBtn"></ImageView>      image:"profilepic.png",        </View>      top:"5",        <View    class="itemActionButton">      left:"5"          <ImageView  id="commentBtn"></ImageView>   },        </View>   "#profileName":{      </View>    top:  "5",    </View>    left:  "80",    </TableViewRow>    color:  "#576b95",   </TableView>    font:  {      fontSize  :  "16",      fontWeight:  "bold"    }   }  
  • 27. STYLES/INDEX.TSS   "#timeAgo":{    top:  "25",    left:  "80",    color:  "#bbbbbb",    font:  {      fontSize  :  "16"    }   },   "#status":{    width:  Ti.UI.SIZE,    left:  5,    right:  5,   VIEWS/INDEX.XML    font:  {   <TableView  id="mainList">      fontSize  :  "16"    <TableViewRow  id="listRow">    }      <View  id="rowContainer">   },      <ImageView  id="profilePic"></ImageView>   "#bottomActions":{      <Label  id="profileName">Ricardo  Alcocer</Label>    bottom:  0,      <Label  id="timeAgo">10  minutes  ago</Label>    height:  "50",      <Label  id="status">This  is  my  status  update.</Label>    width:  Ti.UI.FILL,      <View  id="grayLine"  bottom="51"></View>    backgroundColor:  "#eff2f5",      <View  id="bottomActions">    layout:  "horizontal"        <View  class="itemActionButton">   },          <ImageView  id="likeBtn"></ImageView>   ".itemActionButton":{        </View>    width:  "50%",        <View    class="itemActionButton">    height:  "50"          <ImageView  id="commentBtn"></ImageView>   },        </View>   "#likeBtn":{      </View>    width:  "76",    </View>    height:  "20",    </TableViewRow>    image:  "likebtn.png"   </TableView>   },   "#commentBtn":{    width:  "76",    height:  "20",    image:  "commentbtn.png"   }  
  • 28. The Controller CONTROLLERS/INDEX.JS   $.index.open();  
  • 29. Putting it all together Live Demo
  • 30. Adding the “Menu” View VIEWS/INDEX.XML   <Window  class="container">      <View  id="menu"  onClick="hidemenu"></View>      <View  id="main">        <View  id="iconBar">          <View  id="topActions">              <ImageView  class="topActionButton"  id="friendsBtn"></ImageView>              <ImageView  class="topActionButton"  id="messagesBtn"></ImageView>              <ImageView  class="topActionButton"  id="notificationsBtn"></ImageView>          </View>          <ImageView  id="menubtn"  onClick="showmenu"></ImageView>          <ImageView  id="chatbtn"></ImageView>        </View>   CONTROLLERS/INDEX.JS   STYLES/INDEX.TSS   function  showmenu(e){   "#menu":{    $.main.width=Ti.Platform.displayCaps.platformWidth;    height:  Ti.UI.FILL,    $.main.animate({    width:  Ti.UI.FILL,      left:300,    backgroundColor:  "#2c323f",      duration:100    left:  0      });   }   }     function  hidemenu(e){    $.main.width=Ti.Platform.displayCaps.platformWidth;    $.main.animate({      left:0,      duration:100    });   }     $.index.open();  
  • 31. Resources This deck http://slideshare.net/ricardoalcocer http://speakerdeck.com/ricardoalcocer Code Samples Github Repository http://bit.ly/SVTUG1212-code Official Alloy Github Repository https://github.com/appcelerator/alloy <- Look under /test/apps Alloy App Framework Overview from CodeStrong 2012 http://www.slideshare.net/TonyLukasavage/alloy-codestrong-2012-15179451
  • 32. Questions? Thank you Ricardo Alcocer ralcocer@appcelerator.com @ricardoalcocer