Navigationを見据えたリファクタリング -マルチモジュール化を添えて-

Navigationを見据えたリファクタリング -マルチモジュール化を添えて-

Bonfire Android #5
2019/8/19

9d4a459864f822fb5aa7a5741e60e26b?s=128

Keisuke kiuchi

August 19, 2019
Tweet

Transcript

  1. 2.

    ໦಺ܒี w ৬ۀɿ:ͷ"OESPJEΤϯδχΞ݉ҭࣇύύ w झຯͰ࡞ͬͨϞϊɿʮΒ͘ͰΜ "QQ ʯɺ
 ʮ$MFBO"SDIJUFDUVSF5FNQMBUF'PS,PUMJO 044 ʯ

    w ޷͖ͳΞʔΩςΫνϟɿ$MFBO"SDIJUFDVUF w 4/4
 5XJUUFS!GFJ@LPNF
 (JUIVC!LJVDIJLFJTVLF
 2JJUB!L@LFJTVLF
  2. 14.

    1SFTFOUFS "QQ ࣮૷ interface NaviInterface { fun getFragment2(): Fragment fun

    getFragment3(data: SomeData): Fragment } class RefactoredFragment { override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { android.R.id.home -> changeFragment(naviInterface.getFragment2()) R.id.action_sub -> changeFragment(naviInterface.getFragment3(data)) } return super.onOptionsItemSelected(item) } } class NaviInterfaceImpl : NaviInterface { override fun getFragment2(): Fragment = Fragment2.newInstance() override fun getFragment3(data: SomeData): Fragment = Fragment3.newInstance(data.code, data.name) } OBWJHBUJPOΛ࢖͏ͱ͖͸͜ΕΒΛ ஔ͖׵͑Ε͹0, ͩͱࢥ͏ OBWJHBUJPOʹ͢Δ࣌͸
 ͜ΕΒΛஔ͖׵͑Ε͹0,
  3. 16.

    ऄ଍ͦͷ̍ w ͜ͷख๏ͬͯଞͷϨΨγʔͳ"QJ΍6UJMݺͼग़͠ʹ΋࢖͑ΔΜ͡Όʁ
 ˠ:&4 1SFTFOUFS "QQ 3FGBDUPSFE
 'SBHNFOU -FHBDZ6UJM ɾ

    ɾ ɾ -FHBDZ"QJ -FHBDZ
 *OUFSGBDF -FHBDZ
 *OUFSGBDF
 *NQM -FHBDZ
 *OUFSGBDF -FHBDZ
 *OUFSGBDF -FHBDZ
 *OUFSGBDF
 *NQM -FHBDZ
 *OUFSGBDF
 *NQM
  4. 19.