Building More with Less

1,242 views

Published on

Slides for the talk given at AppsWorld America 2013

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,242
On SlideShare
0
From Embeds
0
Number of Embeds
14
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Building More with Less

  1. 1. building More With Less with android bootstrapWednesday, February 6, 13
  2. 2. @donnfelkerWednesday, February 6, 13
  3. 3. Wednesday, February 6, 13
  4. 4. Building More With LessWednesday, February 6, 13
  5. 5. agenda open source libraries examples bootstrapWednesday, February 6, 13
  6. 6. Wednesday, February 6, 13
  7. 7. Pay with Square GitHub Gaug.esWednesday, February 6, 13
  8. 8. tons of open source tons of integration workWednesday, February 6, 13
  9. 9. open source roboguice action bar sherlock http-request gson view pager indicator robotium maven android maven plugin fragmentsWednesday, February 6, 13
  10. 10. roboguice.org roboguice dependency injection for androidWednesday, February 6, 13
  11. 11. roboguice.org class RoboWay extends RoboActivity {     @InjectView(R.id.name)             TextView name;     @InjectView(R.id.thumbnail)        ImageView thumbnail;     @InjectResource(R.drawable.icon)   Drawable icon;     @InjectResource(R.string.app_name) String myName;     @Inject                            LocationManager loc;     public void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.main);         name.setText( "Hello, " + myName );     } }Wednesday, February 6, 13
  12. 12. roboguice.org User Interface Service Layer ng ee d a stri at if I n ? wh do wn here r esource Persistence Layer service layer: goo.gl/7NQVZ persistence layer: goo.gl/j5u74Wednesday, February 6, 13
  13. 13. roboguice.org public class UserRepository {     @InjectResource(R.string.public_key) String publicKey;     public void saveProfile(UserProfile profile) {         // user publicKey to do some encryption // Now, save the encrypted profile to db/api/etc     } }Wednesday, February 6, 13
  14. 14. roboguice.org public class UserRepository {     @InjectResource(R.string.public_key) String publicKey;     @Inject protected AuthService authService;     public void saveProfile(UserProfile profile) {         // Get auth token from auth service then save // user publicKey to do some encryption // Now, save the encrypted profile to api     } }Wednesday, February 6, 13
  15. 15. roboguice.org must extend RoboActivity RoboListActivity RoboFragmentActivity RoboListFragmentActivity ...Wednesday, February 6, 13
  16. 16. roboguice.orgWednesday, February 6, 13
  17. 17. actionbarsherlock.com action bar sherlock action bar support for pre 3.xWednesday, February 6, 13
  18. 18. actionbarsherlock.com Pay with Square GitHub Gaug.esWednesday, February 6, 13
  19. 19. actionbarsherlock.comWednesday, February 6, 13
  20. 20. actionbarsherlock.com usage getSupportActionBar() native calls supports theming must use Sherlock themes as parentWednesday, February 6, 13
  21. 21. actionbarsherlock.com must extend SherlockActivity SherlockListActivity SherlockFragmentActivity SherlockListFragmentActivity ...Wednesday, February 6, 13
  22. 22. actionbarsherlock.com ruh roh. roboguice and actionbarsherlock must both extend activityWednesday, February 6, 13
  23. 23. github.com/rtyley/roboguice-sherlock roboguice-sherlock combines roboguice and sherlockWednesday, February 6, 13
  24. 24. github.com/rtyley/roboguice-sherlock public  class  CarouselActivity  extends  RoboSherlockFragmentActivity  {        @InjectView(id.tpi_header)  private  TitlePageIndicator  indicator;        @InjectView(id.vp_pages)  private  ViewPager  pager;        @Override        protected  void  onCreate(Bundle  savedInstanceState)  {                requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);                super.onCreate(savedInstanceState);                setContentView(R.layout.carousel_view);                pager.setAdapter(new  BootstrapPagerAdapter(getResources(),  getSupportFragmentManager()));                indicator.setViewPager(pager);                pager.setCurrentItem(1);        } }Wednesday, February 6, 13
  25. 25. github.com/rtyley/roboguice-sherlockWednesday, February 6, 13
  26. 26. kevinsawicki.github.com/http-request/ http-request A simple convenience library for using a HttpURLConnection to make requests and access the response.Wednesday, February 6, 13
  27. 27. kevinsawicki.github.com/http-request/Wednesday, February 6, 13
  28. 28. kevinsawicki.github.com/http-request/Wednesday, February 6, 13
  29. 29. Wednesday, February 6, 13
  30. 30. kevinsawicki.github.com/http-request/Wednesday, February 6, 13
  31. 31. code.google.com/p/google-gson/ gson a library for working with jsonWednesday, February 6, 13
  32. 32. code.google.com/p/google-gson/ a pojo class  BagOfPrimitives  {    private  int  value1  =  1;    private  String  value2  =  "abc";    private  transient  int  value3  =  3;    BagOfPrimitives()  {        //  no-­‐args  constructor    } } serialization BagOfPrimitives  obj  =  new  BagOfPrimitives(); Gson  gson  =  new  Gson(); String  json  =  gson.toJson(obj);   deserialization BagOfPrimitives  obj2  =  gson.fromJson(json,  BagOfPrimitives.class);Wednesday, February 6, 13
  33. 33. code.google.com/p/google-gson/ woohoo! no more manual json parsingWednesday, February 6, 13
  34. 34. code.google.com/p/google-gson/Wednesday, February 6, 13
  35. 35. viewpagerindicator.com view pager indicatorWednesday, February 6, 13
  36. 36. viewpagerindicator.comWednesday, February 6, 13
  37. 37. viewpagerindicator.comWednesday, February 6, 13
  38. 38. viewpagerindicator.comWednesday, February 6, 13
  39. 39. code.google.com/p/maven-android-plugin/ android-maven-plugin an easy to use maven plugin for androidWednesday, February 6, 13
  40. 40. <project  xmlns="http://maven.apache.org/POM/4.0.0"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-­‐instance"   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0  http://maven.apache.org/maven-­‐v4_0_0.xsd">        <modelVersion>4.0.0</modelVersion>        <artifactId>android-­‐bootstrap</artifactId>        <packaging>apk</packaging>        <name>Android  Bootstrap  app</name>        <url>https://github.com/donnfelker/android-­‐bootstrap</url>        <parent>                <version>1.0</version>                <groupId>com.donnfelker.android.bootstrap</groupId>                <artifactId>android-­‐bootstrap-­‐parent</artifactId>        </parent>        <properties>                <abs.version>4.1.0</abs.version>        </properties>        <dependencies>                <dependency>                        <groupId>com.google.android</groupId>                        <artifactId>android</artifactId>                        <scope>provided</scope>                        <version>${android.version}</version>                </dependency>                <dependency>                        <groupId>com.google.code.gson</groupId>                        <artifactId>gson</artifactId>                        <version>2.1</version>                </dependency>                <dependency>                        <groupId>com.github.rtyley</groupId>                        <artifactId>roboguice-­‐sherlock</artifactId>                        <version>1.4</version>                </dependency>          ...                  <dependency>                        <groupId>com.github.kevinsawicki</groupId>                        <artifactId>wishlist</artifactId>                        <version>0.3</version>                        <type>apklib</type>                </dependency>                <dependency>Wednesday, February 6, 13
  41. 41. code.google.com/p/maven-android-plugin/ build process easier to manageWednesday, February 6, 13
  42. 42. code.google.com/p/maven-android-plugin/ resources google group ch14 of sonatype book goo.gl/3Waf5 (sample next)Wednesday, February 6, 13
  43. 43. Wednesday, February 6, 13
  44. 44. code.google.com/p/maven-android-plugin/Wednesday, February 6, 13
  45. 45. fragments android support libraryWednesday, February 6, 13
  46. 46. download from android sdkWednesday, February 6, 13
  47. 47. code.google.com/p/robotium “its like selenium, but for android”Wednesday, February 6, 13
  48. 48. code.google.com/p/robotium 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();   } }Wednesday, February 6, 13
  49. 49. code.google.com/p/robotiumWednesday, February 6, 13
  50. 50. androidbootstrap.comWednesday, February 6, 13
  51. 51. Wednesday, February 6, 13
  52. 52. androidbootstrap.com influences are from github and gaug.es GitHub Gaug.esWednesday, February 6, 13
  53. 53. androidbootstrap.com includes roboguice action bar sherlock http-request gson view pager indicator robotium maven android maven plugin fragments api consumption image downloading image caching cache mechanism pojo support ahhhhhh yeah and more...Wednesday, February 6, 13
  54. 54. androidbootstrap.com uses template for your next project use as a reference a how to tutorial project MVP bootstrapWednesday, February 6, 13
  55. 55. androidbootstrap.com q&aWednesday, February 6, 13
  56. 56. Thank You. questions? tweet @donnfelkerWednesday, February 6, 13

×