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

CleanArchitecture For Android

MinoHiroki
January 14, 2017

CleanArchitecture For Android

CleanArchitectureを参考に、Androidアプリをつくってみたことの紹介

MinoHiroki

January 14, 2017
Tweet

Other Decks in Technology

Transcript

  1. Activity/Fragment Viewͱͯ͠ͷ໾ׂ→ViewModelͷ৘ใΛը໘ʹදࣔ ίϯτϩʔϥͱͯ͠ͷ໾ׂ→Presenter΁ͷϦΫΤετ ViewModel ֤ը໘ͷঢ়ଶɻ Presenter
 ֤ը໘ݻ༗ͷϩδοΫɻ
 UseCase
 σʔλͷऔಘ΍ߋ৽ͳͲͷϏδωεϩδοΫ Entity


    αʔϏε্ͷ֓೦Λͦͷ··දݱͨ͠Ϋϥε܈ɻ
 Ϣʔβʔ৘ใɺνϟϯωϧ৘ใͳͲɻ
 Repository ӬଓԽσʔλͷग़͠ೖΕɻ "1*΍%#΁ͷΞΫηεΛϥοϓ͢Δɻ API DB API΍ϩʔΧϧDB͔Βͷσʔλͷऔಘɻ CleanArchitectureʹج͍ͮͨAndroid։ൃ
  2. CleanArchitectureʹج͍ͮͨAndroid։ൃ Activity/Fragment Viewͱͯ͠ͷ໾ׂ→ViewModelͷ৘ใΛը໘ʹදࣔ ίϯτϩʔϥͱͯ͠ͷ໾ׂ→Presenter΁ͷϦΫΤετ ViewModel ֤ը໘ͷঢ়ଶɻ Presenter
 ֤ը໘ݻ༗ͷϩδοΫɻ
 UseCase
 σʔλͷऔಘ΍ߋ৽ͳͲͷϏδωεϩδοΫ

    Entity
 αʔϏε্ͷ֓೦Λͦͷ··දݱͨ͠Ϋϥε܈ɻ
 Ϣʔβʔ৘ใɺνϟϯωϧ৘ใͳͲɻ
 Repository ӬଓԽσʔλͷग़͠ೖΕɻ "1*΍%#΁ͷΞΫηεΛϥοϓ͢Δɻ API DB API΍ϩʔΧϧDB͔Βͷσʔλͷऔಘɻ
  3. | |- mobile | | | |- ui | |-

    user // Activity/Fragment&Presenter&ViewModel | |- UserActivity | |- UserComponent | |- UserPresenter | |- UserView | |- UserViewModel | |- core | |- user
 | |- repository // Repository & Dao /Api | | |- UserRepositoryImpl | | |- UserApi | | |- UserDao | | | |- usecase // UseCase | | |- GetLoginUser | | | |- User // Entity | ύοέʔδߏ੒ CleanArchitectureʹج͍ͮͨAndroid։ൃ
  4. | |- core | |- user
 | |- repository //

    Repository & Dao /Api | | |- UserRepositoryImpl | | |- UserApi | | |- UserDao | | | |- usecase // UseCase | | |- GetLoginUser | | | |- User // Entity | CleanArchitectureʹج͍ͮͨAndroid։ൃ
  5. | |- mobile | | | |- ui | |-

    user // Activity/Fragment&Presenter&ViewModel | |- UserActivity | |- UserComponent | |- UserPresenter | |- UserView | |- UserViewModel CleanArchitectureʹج͍ͮͨAndroid։ൃ
  6. | |- mobile | | | |- ui | |-

    user // Activity/Fragment, Presenter, ViewModel | |- UserActivity | |- UserComponent | |- UserPresenter | |- UserView | |- UserViewModel | |- core | |- user
 | |- repository // Repository, Dao/Api | | |- UserRepositoryImpl | | |- UserApi | | |- UserDao | | |- UserRepositoryModule | | | |- usecase // Usecase | | |- GetLoginUser | | |- UserRepository | | | |- User // Entity | CleanArchitectureʹج͍ͮͨAndroid։ൃ ҎԼͷ੺จࣈͷΫϥε͸packageείʔϓͰఆٛͰ͖Δ