Appcelerator Titanium Smartphone App Development Cookbook nbsp;· Appcelerator Titanium Smartphone App Development ... He currently lives in London and works as a freelance Titanium developer and ... of the iPhone and App

  • View

  • Download

Embed Size (px)


  • Appcelerator Titanium Smartphone App Development Cookbook

    Boydlee Pollentine

    Chapter No. 7 "Creating Animations, Transformations, and

    Understanding Drag-and-drop"

  • In this package, you will find: A Biography of the author of the book

    A preview chapter from the book, Chapter NO.7 "Creating Animations, Transformations, and Understanding Drag-and-drop"

    A synopsis of the books content

    Information on where to buy this book

    About the Author Boydlee Pollentine is a keen mobile developer who has created numerous apps for the iTunes and Android stores and a number of indie games. He is passionate about mobile development, and in particular the Appcelerator Titanium platform. He is both a Titanium Certified Application developer and a member of the Titans evangelist group.

    He has been a software engineer and programmer for the last 10 years, primarily focusing on web technologies and Microsofts .NET platform. During this time, he has worked for numerous small and large organizations, including a number of Australian Federal Government departments, state departments, banks, and media organizations.

    He currently lives in London and works as a freelance Titanium developer and runs a small blog dedicated to mobile development at

    Id like to thank everyone on the Appcelerator forums, Twitter, and the Web, who have helped to contribute and make the great Titanium community what it is today.

    For More Information:


  • Appcelerator Titanium Smartphone App Development Cookbook Not so long ago, creating a mobile application and getting it published was difficult, costly, and, for most developers, commercially unviable. Flash forward a number of years to the introduction of the iPhone and App Store, and suddenly there was a way where anyone who could write a code in Apple's Objective-C language, and had a healthy understanding of provisioning certificates for the Mac, could write a smartphone application and distribute it worldwide with minimal amount of fuss and very little red tape. During the last decade, many of us in the web development community have moved away from archaic C-based languages, and have squarely focused much of our programming knowledge on JavaScript, that ubiquitous little language that despite all its shortcomings has gained momentum and was commonplace both on and off the Web.

    Shortly after that, we began to see a number of "alternative" platforms emerge which promised developers the ability to build mobile applications without the hassle of re-skilling in Objective-C, or in the case of Android, in Java. Among these was a newcomer called Titanium Mobile, which held the promise of allowing native applications to be built using only JavaScript, and the ability to make those applications cross-platform (across both iOS and Android). As of December 2011, Appcelerator's Titanium Mobile boasts over 1.5 million active developers and has released 30,000 applications in the marketplace. It has the backing of major players such as eBay and powers some of the world's most popular apps, including Wunderlist, eBay Mobile, and GetGlue. There is support for Blackberry and the mobile web. It also has the ability to build cross-platform games using popular engines such as OpenGL and Box2D. It even has its own Mobile Marketplace, where developers can sell and distribute their Titanium modules to the rest of the community.

    In this book, we'll cover all of the aspects of building your mobile applications in Titanium Mobile, from layout to maps and GPS, all the way through social media integration and accessing your device's input hardware, including the camera and microphone. Each "recipe" described within is a self-contained lesson. You may pick and choose which areas you wish to read and use it as a reference. Alternatively, you can follow along each recipe in succession through most chapters and build a small app from start to finish. We'll also go through how to extend your applications using custom modules, and how to package them for distribution and sale in both the iTunes App Store and the Android Marketplace.

    For More Information:


  • What This Book Covers In Chapter 1, Building Apps using Native UI Components, we'll begin our journey into Titanium Mobile by understanding the basics of layout and creating controls, before moving onto tabbed interfaces, web views, and how to add and open multiple windows.

    In Chapter 2, Working with Local and Remote Data Sources, we are going to build ourselves a mini-app that reads data from the Web using HTTP requests, and we'll see how to parse and iterate data in both XML and JSON formats. We'll also see how to store and retrieve data locally using an SQLite database and some basic SQL queries.

    In Chapter 3, Integrating Google Maps and GPS, we'll add a MapView to your application and interact with it using annotations, geo-coding and events that track the user's location. We'll also go through the basics of adding routes and using your device's inbuilt compass to track our heading.

    In Chapter 4, Enhancing your Apps with Audio, Video, and the Camera, we'll see how to interact with your device's media features using Titanium, including the camera, photo gallery, and audio recorder.

    In Chapter 5, Connecting your Apps with Social Media and E-mail, we're going to see how to leverage Titanium and integrate it with Facebook, Twitter, and the e-mail capabilities of your mobiles devices. We'll also go through setting up a Facebook application and give you a brief introduction to the world of OAuth.

    In Chapter 6, Getting to Grips with Events and Properties, we'll briefly run through how properties work in Titanium, and how you can get and set global variables in your app. We'll also explain how event listeners and handlers work and how to fire events, both from your controls and custom events from anywhere in your application.

    In Chapter 7, Creating Animations, Transformations and Understanding Drag-and-drop, we'll show you how to create animations, and how to transform your objects using 2D and 3D matrices in Titanium. We will also run through dragging and dropping controls and capturing screenshots using the inbuilt "toImage" functionality.

    In Chapter 8, Interacting with Native Phone Applications and APIs, we will discover how to interact with native device APIs, such as the device's contacts and calendar. We'll also discover how to use local notifications and background services.

    For More Information:


  • In Chapter 9, Integrating your Apps with External Services, we'll dive deeper into OAuth and HTTP authentication, and also show you how to connect to external APIs, such as Yahoo! YQL and Foursquare. We will also run through the set up and integration of push notifications into your Titanium apps.

    In Chapter 10, Extending your Apps with Custom Modules, we will see how you can extend the native functionality in Titanium and add your own custom, native modules using Objective-C and Xcode. We'll run through a sample module from start to finish in Xcode for creating short URLs using the service.

    In Chapter 11, Platform Differences, Device Information, and Quirks, we'll take a look at how to use Titanium to find out information about the device, including important features such as making phone calls, checking the memory, and checking the remaining allocation of the battery. We will also go through screen orientations and how to code differences between the iOS and Android platforms.

    In Chapter 12, Preparing your App for Distribution and Getting it Published, we will see how to prepare and package your applications for distribution and sale to the iTunes App Store and Android Marketplaces, along with a background into how to set up and provision your apps correctly with provisioning profiles and development certificates.

    For More Information:


  • 7Creating Animations, Transformations, and

    Understanding Drag-and-drop

    In this chapter, we will cover:

    Animating a View using the "animate" method

    Animating a View using 2D matrix and 3D matrix transforms

    Dragging an ImageView using touch events

    Scaling an ImageView using a Slider control

    Saving our "Funny Face" image using the toImage() method

    IntroductionAlmost any control or element in Titanium can have an animation or transform applied to it. This allows you to enhance your applications by adding a level of interactivity and "bling" that your apps would otherwise perhaps not have.

    In this chapter, we are going to create a small application that allows the user to choose a "funny face" image, which we are going to position over the top of a photograph of ourselves. We'll use transitions and animations in order to displa