Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android Bootstrap

Donn Felker
November 15, 2013

Android Bootstrap

Bootstrap your next Android Application with Android Bootstrap or use it as a reference to learn new technology.

Donn Felker

November 15, 2013
Tweet

More Decks by Donn Felker

Other Decks in Programming

Transcript

  1. loose agenda what is android bootstrap? why was it built?

    lots of demos libraries & examples questions
  2. A collection of libraries and frameworks integrated together in a

    easy to use application that can serve as a boilerplate or reference for existing or future Android apps.
  3. http api consumption dependency injection pojos instead of raw json

    message bus fragments navigation drawer action bar testing responsive layout backwards compatibility boilerplate for new projects
  4. open source used dagger app compat navigation drawer otto http-request

    gson view pager indicator robotium gradle fragments parse.com
  5. Parse.com datastore & REST endpoint (MongoDB in the cloud) app

    requests data parse REST API returns JSON data
  6. Views Activities Service Layer Event Bus Repository Layer POJOS JSON

    parse Dependency Injection API consumption through HTTP Otto Dagger & Butterknife GSON Fragments (http-request)
  7. Background Service Timer Activity is updated from background service. Timer

    will continue to run in background. Use notification to go back to the activity. Timer is updated and looks like its running at all times.
  8. Use Cases Activity / Fragment Communication Service / Fragment /

    Activity Communication Basic Message Passing between objects in scope Excellent Message Bus
  9. Publish an event FROM A FRAGMENT bus.post(new AnswerAvailableEvent(42)); @Subscribe public

    void answerAvailable(AnswerAvailableEvent event) { // TODO: React to the event somehow! } Subscribing to the event FROM A ACTIVITY
  10. usage include library via libs, maven or gradle // Register

    in onResume() bus.register(this); // Unregister in onPause() bus.unregister(this); // in onPause @Provides bus.post(event); @Subscribe
  11. class  BagOfPrimitives  {    private  int  value1  =  1;  

     private  String  value2  =  "abc";    private  transient  int  value3  =  3;    BagOfPrimitives()  {        //  no-­‐args  constructor    } } BagOfPrimitives  obj  =  new  BagOfPrimitives(); Gson  gson  =  new  Gson(); String  json  =  gson.toJson(obj);   a pojo serialization BagOfPrimitives  obj2  =  gson.fromJson(json,  BagOfPrimitives.class); deserialization code.google.com/p/google-gson/
  12. Why is it so fast? - Compile Time Validation -

    Compile Time Code Generation
  13. User Interface Service Layer Repository Layer what if I a

    particular dependency down here that depends on context? service layer: goo.gl/7NQVZ repository/persistence layer: goo.gl/j5u74 http://square.github.io/dagger/ Traditional IoC/DI Diagram
  14. public class EditorTest extends ActivityInstrumentationTestCase2<EditorActivity> { private Solo solo; public

    EditorTest() { super("com.test.editor", EditorActivity.class); } public void setUp() throws Exception { solo = new Solo(getInstrumentation(), getActivity()); } public void testPreferenceIsSaved() throws Exception { solo.sendKey(Solo.MENU); solo.clickOnText("More"); solo.clickOnText("Preferences"); solo.clickOnText("Edit File Extensions"); Assert.assertTrue(solo.searchText("rtf")); solo.clickOnText("txt"); solo.clearEditText(2); solo.enterText(2, "robotium"); solo.clickOnButton("Save"); solo.goBack(); solo.clickOnText("Edit File Extensions"); Assert.assertTrue(solo.searchText("application/robotium")); } @Override public void tearDown() throws Exception { solo.finishOpenedActivities(); } } code.google.com/p/robotium
  15. Generate Your Next Project Gradle - Android Studio - AppCompat

    - NavigationDrawer Maven - IntelliJ - ActionBarSherlock - SlidingMenu androidbootstrap.com alpha.androidbootstrap.com USE THIS ONE
  16. androidbootstrap.com includes dagger otto action bar sherlock or app compat

    http-request gson view pager indicator robotium maven or gradle fragments api consumption image downloading image caching cache mechanism pojo support and much more... ahhhhhh yeah
  17. uses template for your next project use as a reference

    a how to tutorial project MVP bootstrap androidbootstrap.com