GithubHelp home page GithubHelp logo

ricardoalcocer / alloyapptemplate Goto Github PK

View Code? Open in Web Editor NEW
51.0 11.0 17.0 10.03 MB

This repo was moved to https://github.com/appcelerator-developer-relations/Template.Hierarchical-Navigation

License: Other

JavaScript 53.39% CSS 9.11% Python 37.50%

alloyapptemplate's Introduction

Cross-Platform Application Template

IMPORTANT NOTE: I moved this template to https://github.com/appcelerator-developer-relations/Template.Hierarchical-Navigation, so make sure you check there for updates. I won't be updating this one.

I originally created this template for my talk at ConnectJS 2014.

The template provides the necessary scaffolding to implement platform-specific containers, with content reusability. This is how it works:

  • Index.xml is an empty view
  • Index.js picks up the request and loads the "home" controller
  • The "home" controller is platform specific, so you have two versions: /views/ios/home.xml and /views/android/home.xml. Alloy picks up the right one for the platform.
  • Home.xml "Requires" the "sharedhome" controller
  • Home.js is a single cross-platform controller used by either one of the home.xml files. From here we can "talk" to the "sharedhome" files, effectively providing platform-specific containers with shared content

Important to keep in mind

This template project is using platform-specific folders to organize your main app containers and keep them in separate places. This practice is perfectly fine for the main container. For all other windows I recommend you keep your code in a single View file and use the platform attribute, for example:

<Alloy>
  <Window backgroundColor="#fff">

    <!-- this tag is Android-only -->
    <ActionBar platform="android" title="Window Title"/>

    <!-- this tag is iOS-only -->
    <Toolbar platform="ios" title="Window Title" top="20">
      <Items>
        <FlexSpace/>
        <Label id="wintitle">Window Title</Label>
        <FlexSpace/>
      </Items>
    </Toolbar>

  </Window>
</Alloy>

The same thing goes for your controllers, where you can use platform variables like:

if (OS_IOS){
  // do some iOS stuff
}else if (OS_ANDROID){
  // do some Android stuff
}

Versions

1.1

  • iPad and Android Tablet checks

1.0

  • Initial release

Sigthings

Using Studio?

My buddy Andrew McElroy of CodexLabs turned this template into an Aptana Ruble that can be integrated into Studio, allowing you to select the template at the time of project creation.

NOTE: home.js includes ActionBarExtras to help you easily customize the ActionBar without the need for custom ActionBar Styles


Licensed under the terms of the MIT License

alloyapptemplate's People

Contributors

ricardoalcocer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alloyapptemplate's Issues

Cant open Second Window three times with Titanium 3.5.0 SDK

Hello Ricardo,

Thanks for this great and really useful contribution!

There is an issue with Titanium 3.5.0 Titanium SDK (works perfectly with SDK 3.4.1)

In 3.5.0 Titanium SDK im starting a fresh project (the Ricardo Bootstrap template) and after running it in ios 8.1 simulator (i tried iPhone 4S, 5 and 6, same result) i can only open (and close) the secondwin only twice. When i click the "plus" button a third time, nothing happens and it does not open the secondwin.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.