Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Activity, Fragment, CustomView の使い分け - マッチョなActivityにさよならする方法 -

45,852 views

Published on

DroidKaigi

Published in: Technology
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download Full EPUB Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download Full doc Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download PDF EBOOK here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download EPUB Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download doc Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Activity, Fragment, CustomView の使い分け - マッチョなActivityにさよならする方法 -

  1. 1. あんざいゆき, @yanzm, uPhyca Inc.
  2. 2. 開発規模 成熟度 2008 2015
  3. 3. 開発規模 成熟度 2008 2015 コンタクトアプリのJavaファイル数 2.3
  4. 4. 開発規模 成熟度 2008 2015 Tablet
  5. 5. 開発規模 成熟度 2008 2015 コンタクトアプリのJavaファイル数 4.0.1 2.3 Tablet
  6. 6. 開発規模 成熟度 2008 2015 Material Design Tablet
  7. 7. 開発規模 成熟度 2008 2015 Tablet コンタクトアプリのJavaファイル数 4.0.1 2.3 5.0.1 Material Design
  8. 8. Activity Fragment CustomView テーマ ⚪ △ Windowを 作成 ⚪ 他の画面から 呼び出せる ⚪ ライフサイクル のハンドリング ⚪ ⚪ △
  9. 9. Activity Fragment CustomView 1画面に複数 ⚪ ⚪ Orientation 指定 ⚪ Fragmentを 持てる ⚪ 画面回転の前後 でインスタンス を保持 ⚪
  10. 10. Activity Fragment CustomView 描画 ⚪ KeyEvent ⚪ ⚪ バックキー ⚪ ⚪ BackStack ⚪ ⚪
  11. 11. Activity Fragment CustomView Options Menu ⚪ ⚪ Loader ⚪ ⚪ 状態の リストア ⚪ ⚪ △ テスト しやすさ ⚪
  12. 12. Activity Fragment CustomView ActionBar カスタマイズ ⚪ △
  13. 13. • ImageView • EditText • Spinner • RadioButton • pick list
  14. 14. private static final String KEY_DESSERT_LIST = "dessert_list"; @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); ArrayList<String> dessertList = new ArrayList<>(); … outState.putStringArrayList(KEY_DESSERT_LIST, dessertList); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); ArrayList<String> dessertList = savedInstanceState .getStringArrayList(KEY_DESSERT_LIST); … }
  15. 15. CompoundButtonのコードがわかりやすい
  16. 16. static class SavedState extends BaseSavedState { ArrayList<String> favoriteDessert; SavedState(Parcelable superState) { super(superState); } private SavedState(Parcel in) { super(in); favoriteDessert = in.readArrayList(String.class.getClassL } @Override public void writeToParcel(@NonNull Parcel out, int flags) { super.writeToParcel(out, flags); out.writeStringList(favoriteDessert); } … }
  17. 17. @Override public Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); SavedState ss = new SavedState(superState); ss.favoriteDessert = getFavoriteDesserts(); return ss; } @Override public void onRestoreInstanceState(Parcelable state) { SavedState ss = (SavedState) state; super.onRestoreInstanceState(ss.getSuperState()); setFavoriteDesserts(ss.favoriteDessert); requestLayout(); }
  18. 18. static class SavedState extends BaseSavedState { String imageUrl; String uriString; SavedState(Parcelable superState) { super(superState); } private SavedState(Parcel in) { super(in); imageUrl = in.readString(); uriString = in.readString(); } @Override public void writeToParcel(@NonNull Parcel out, int flags) { super.writeToParcel(out, flags); out.writeString(imageUrl); out.writeString(uriString); } … }
  19. 19. @Override public Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); SavedState ss = new SavedState(superState); ss.imageUrl = imageUrl; if (localImageUri != null) { ss.uriString = localImageUri.toString(); } return ss; } @Override public void onRestoreInstanceState(Parcelable state) { SavedState ss = (SavedState) state; super.onRestoreInstanceState(ss.getSuperState()); if (!TextUtils.isEmpty(ss.uriString)) { setImageFromUriString(ss.uriString); } else if (!TextUtils.isEmpty(ss.imageUrl)) { setImageUrl(ss.imageUrl); } requestLayout(); }
  20. 20. final int id = eventGroup.getCheckedRadioButtonId(); switch (id) { case R.id.attend: profileData.eventStatus = ProfileData.EVENT_STATUS_ATTEN break; case R.id.not_attend: profileData.eventStatus = ProfileData.EVENT_STATUS_NOT_A break; case R.id.unknown: profileData.eventStatus = ProfileData.EVENT_STATUS_UNKNO break; default: return; }
  21. 21. @Retention(RetentionPolicy.SOURCE) @IntDef({EVENT_STATUS_UNDEFINED, EVENT_STATUS_ATTEND, EVENT_STATUS_NOT_ATTEND, EVENT_STATUS_UNKNOWN}) public @interface EventStatus { } @EventStatus public int getEventStatus() { final int id = getCheckedRadioButtonId(); switch (id) { case R.id.attend: return EVENT_STATUS_ATTEND; case R.id.not_attend: return EVENT_STATUS_NOT_ATTEND; case R.id.unknown: return EVENT_STATUS_UNKNOWN; default: return EVENT_STATUS_UNDEFINED; } }
  22. 22. private boolean validate() { // バリデーション失敗: エラーメッセージ表示 final String name = nameEditText.getText().toString(); if (TextUtils.isEmpty(name)) { Toast.makeText(MainActivity.this, "名前が入力されていません", Toast.LENGTH_SHORT).show( return false; } if (eventStatusPicker.getEventStatus() == EventStatusPicker.EVENT_STATUS_UNDEFINED) { Toast.makeText(MainActivity.this, "DroidKaigiが選択されていません", Toast.LENGTH_SHORT return false; } return true; }

×