Android Bootstrap

5,201 views

Published on

Document th

Published in: Technology, News & Politics
0 Comments
10 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,201
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
105
Comments
0
Likes
10
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Android Bootstrap

    1. 1. buildingMore With Less with android bootstrap
    2. 2. tweet tweet @donnfelker
    3. 3. Building More With Less
    4. 4. agenda open source libraries examples bootstrap
    5. 5. Pay with Square GitHub Gaug.es
    6. 6. tons of open sourcetons of integration work
    7. 7. open source roboguice action bar sherlock http-request gson view pager indicator robotium maven android maven plugin fragments
    8. 8. roboguice.orgroboguicedependency injectionfor android
    9. 9. roboguice.orgclass 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 );    }}
    10. 10. roboguice.org User Interface Service Layer ed a string wha t if I ne e? d own her r esource Persistence Layerservice layer: goo.gl/7NQVZ persistence layer: goo.gl/j5u74
    11. 11. roboguice.orgpublic 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    }}
    12. 12. roboguice.orgpublic 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    }}
    13. 13. roboguice.orgmust extend RoboActivity RoboListActivity RoboFragmentActivity RoboListFragmentActivity ...
    14. 14. roboguice.org
    15. 15. actionbarsherlock.comaction bar sherlockaction bar support for pre 3.x
    16. 16. actionbarsherlock.comPay with Square GitHub Gaug.es
    17. 17. actionbarsherlock.com
    18. 18. actionbarsherlock.comusage getSupportActionBar() native calls supports theming must use Sherlock themes as parent
    19. 19. actionbarsherlock.commust extend SherlockActivity SherlockListActivity SherlockFragmentActivity SherlockListFragmentActivity ...
    20. 20. actionbarsherlock.com ruh roh.roboguice and actionbarsherlock must both extend activity
    21. 21. github.com/rtyley/roboguice-sherlockroboguice-sherlock combines roboguice and sherlock
    22. 22. github.com/rtyley/roboguice-sherlockpublic 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);    }}
    23. 23. github.com/rtyley/roboguice-sherlock
    24. 24. kevinsawicki.github.com/http-request/ http-requestA simple convenience library for using a HttpURLConnection to make requests and access the response.
    25. 25. kevinsawicki.github.com/http-request/
    26. 26. kevinsawicki.github.com/http-request/
    27. 27. kevinsawicki.github.com/http-request/
    28. 28. code.google.com/p/google-gson/ gsona library for working with json
    29. 29. 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);
    30. 30. 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);
    31. 31. code.google.com/p/google-gson/woohoo! no more manual json parsing
    32. 32. code.google.com/p/google-gson/
    33. 33. viewpagerindicator.comview pager indicator
    34. 34. viewpagerindicator.com
    35. 35. viewpagerindicator.com
    36. 36. viewpagerindicator.com
    37. 37. code.google.com/p/maven-android-plugin/ android-maven-pluginan easy to use maven plugin for android
    38. 38. <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>
    39. 39. code.google.com/p/maven-android-plugin/build process easier to manage
    40. 40. code.google.com/p/maven-android-plugin/resources google group ch14 of sonatype book goo.gl/3Waf5
    41. 41. code.google.com/p/maven-android-plugin/
    42. 42. fragments android support library
    43. 43. download from android sdk
    44. 44. code.google.com/p/robotium“its like selenium, but for android”
    45. 45. code.google.com/p/robotiumpublic 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();  }}
    46. 46. code.google.com/p/robotium
    47. 47. androidbootstrap.com
    48. 48. androidbootstrap.cominfluences github and github gauges GitHub Gaug.es
    49. 49. androidbootstrap.comincludes 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...
    50. 50. androidbootstrap.comuses template for your next project use as a reference a how to tutorial project MVP bootstrap
    51. 51. androidbootstrap.comcode
    52. 52. Thank You.questions? tweet @donnfelker

    ×