Slide 14
Slide 14 text
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,