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

tab for Androidの作り方

Avatar for lychee lychee
April 24, 2014

tab for Androidの作り方

Avatar for lychee

lychee

April 24, 2014
Tweet

More Decks by lychee

Other Decks in Technology

Transcript

  1. tab for Android • 2013/2 ։ൃ։࢝ • ݱࡏ1.9.3൛ • ։ൃମ੍2໊

    • ϦϦʔε݄2ʙ4ϖʔε • ରԠൣғɿAPI Ϩϕϧ 10(2.3.3)Ҏ্ • ࡉʑͱ΍ͬͯ·͢ ΤϯδχΞืूதʂ
  2. ։ൃπʔϧ • IDE • Eclipse • Android StudioʹҠ ߦத •

    ϦϙδτϦ • GitHub Enterprise • CI • Jenkins @AWS • ࣾ಺ςετ഑෍ • DeployGate
  3. ͦͷଞπʔϧ • A/Bςετ • Apptimize • Ҋ݅؅ཧ • Pivotal Tracker

    • όά؅ཧ • Bugsense • ίϛϡχέʔγϣϯ • Hipchat
  4. "1*௨৴෦෼ • ϥΠϒϥϦ:Android Async Http Client • ౰࣌Volley͕ͳ͔ͬͨ • ը૾μ΢ϯϩʔυܥAPI͸͔ͭͬͯͳ͍

    (ޙड़) • AsyncHttpResponseHandleΛ֦ு͠REST APIίʔϧ͔ΒJSONύʔεͯ͠ModelΦϒ δΣΫτͱͯ͠อ࣋͢Δ·ͰҰ؏Ͱ΍ΕΔ Α͏ʹ͍ͯ͠Δɻ
  5. ʢྫʣ"1*௨৴෦෼ public static void get(int id, final OnPostListener<ItemObject> listener) {

    String pathString = String.format("items/%d.json", id); tabRestClient.execute( pathString, null, new TabApiResponseHandler<ItemObject>(listener)); }
  6. ྫʣσʔλऔಘ Item.get(itemId, new OnPostListener<ItemObject>() { @Override public void onError(Throwable e,

    Error error) { //Τϥʔॲཧ } @Override public void onCompletion(ItemObject response) { Item item = response.getItem(); // Α͠ͳʹ } });
  7. ίʔυྔͷൺֱ import lombok.Data; @Data public class Item implements Serializable {

    public static final String KEY = "item"; /** Response */ private int id; private String title; private String description; public static void get(int id, hogehoge...){ //͖ͬ͞ͷίʔυ } } public class Item implements Serializable { public static final String KEY = "item"; /** Response */ private int id = Models.INVALID_INT; private String title; private String description; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public static void get(int id, hogehoge...) { //͖ͬ͞ͷίʔυ } }
  8. Loader/Adapter <<abstract>> BaseAdapter <<abstract>> AbstractLoaderAdapter CustomAdapter CustomPairLayout Adapter <<abstract>> AbstractDataLoader

    <<interface>> DataLoader CustomLoader Activity, Fragment <<create>> <<create>> <<interface>> DataLoaderListener
  9. ʢྫʣLoader public class ItemLoader extends AbstractDataLoader<Item> { @Override protected void

    onLoadPage(int page, int limit, OnPostListener<? extends PaginatedResponse<Item>> listener) { Item.list(page, limit, (OnPostListener<PaginatedItems>) listener); } }
  10. ʢྫʣAdapter public class ItemAdapter extends AbstractLoaderAdapter<ItemLoader> { public ItemAdapter(ItemLoader loader,

    Context context) { super(loader, context); reload(); } @Override public View getView(int position, View convertView, ViewGroup parent) { // Α͠ͳʹ } }
  11.  Pull to refresh ListView • ࢖༻ϥΠϒϥϦ: Pull to Refresh

    ListView • ౰࣌ActionBar-PullToRefresh΋ SwipeRefreshLayout΋ͳ͔ͬͨ • ܰྔ • GridView͕࢖͑ͳ͍ • ͋·Γϝϯςφϯε͞Εͯͳ͍ͷͰɺҰ෦ SwipeRefreshLayoutʹҠߦத • ϑολʔʹϩʔσΟϯάΞχϝʔγϣϯΛදࣔ͢ ΔΑ͏֦ு
  12. ͦͷଞ࢖༻ϥΠϒϥϦ • Android-ViewPagerIndicator • Android-MenuDrawer • ArcMenu/SwitchCompatLibrary • Google Play

    Service • GridLayout • Facebook SDK • Twitter4j • OrmLite ... ଟ͗ͯ͢ɺ ϝιου਺্ݶʹ Ҿ͔͔ͬΔ
  13. ϝιου਺্ݶ໰୊ • ݱ৅ • ಛఆͷ2.3ܥ୺຤ͰىಈͰ͖ͳ͍ • Error while installing application

    (INSTALL_FAILED_DEXOPT) • ݪҼ • ϝιου਺͕65536Ҏ্ʹͳΔͱDexoptͷ ࢖͏όοϑΝαΠζΛ௒͑Δ
  14. ରॲ • ϥΠϒϥϦΛεϦϜʹ • ͋·Γ࢖ͬͯͳ͔ͬͨGuavaΛ֎͢ • GooglePlayServicesͱAnalyticsͷϥΠϒϥϦ Λซ༻͠ͳ͍ • ຊདྷ͸...

    • ProGuardͰ࠷దԽ • dexϑΝΠϧΛ෼ׂ͠ΧελϜΫϥεϩʔσΟ ϯά • Facebookϒϩάͱ͔