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.

navigation-uiライブラリは、既存のアプリを置き換える ことができないかもしれない

671 views

Published on

2018 06-07 umeda.apk #4 LT資料です。
https://shibuya-apk.connpass.com/event/88738/

Published in: Mobile
  • Be the first to comment

  • Be the first to like this

navigation-uiライブラリは、既存のアプリを置き換える ことができないかもしれない

  1. 1. 2018/06/07 umeda.apk #4
  2. 2. Who are you? ▸ ( ) ▸ tech vein ( ) ▸ ▸ GitHub: kwmt twitter: kwmt27 ▸ Google I/O2018 2
  3. 3. ▸ navigation-ui ▸ navigation-ui ▸ navigation-ui ▸ 3
  4. 4. /18 ▸ Navigation Architecture Component ▸ 1.0.0-alpha01 ▸ Navigation Drawer BottomNavigation ▸ navigation-fragment 4 implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha01' implementation 'android.arch.navigation:navigation-ui:1.0.0-alpha01'
  5. 5. /185 class MainActivity : AppCompatActivity() { private val binding: MainActivityBinding by lazy { DataBindingUtil.setContentView<MainActivityBinding>(this, R.layout.main_activity) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setSupportActionBar(binding.toolbar) ActionBarDrawerToggle( this, binding.drawerLayout, binding.toolbar, R.string.openDrawerContentDescRes, R.string.closeDrawerContentDescRes ) .also { binding.drawerLayout.addDrawerListener(it) } .apply { isDrawerIndicatorEnabled = true isDrawerSlideAnimationEnabled = true syncState() } binding.navView.setNavigationItemSelectedListener { val f = when (it.itemId) { R.id.mainFragment -> MainFragment() R.id.repositoryListFragment -> RepositoryListFragment() else -> MainFragment() } val ft = supportFragmentManager.beginTransaction() ft.add(R.id.main_nav_host_fragment, f) ft.commitNow() binding.drawerLayout.closeDrawers() true } } }
  6. 6. /186
  7. 7. /187 class MainActivity : AppCompatActivity() { private val binding: MainActivityBinding by lazy { DataBindingUtil.setContentView<MainActivityBinding>(this, R.layout.main_activity) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setSupportActionBar(binding.toolbar) findNavController(R.id.main_nav_host_fragment).apply { setupActionBarWithNavController(this, binding.drawerLayout) binding.navView.setupWithNavController(this) } } override fun onSupportNavigateUp(): Boolean = binding.drawerLayout.navigateUp(findNavController(R.id.main_nav_host_fragment)) }
  8. 8. /188
  9. 9. /189 🤔
  10. 10. /1810
  11. 11. /1811 Navigation startDestination※ ※ startDestination
  12. 12. /1812
  13. 13. /1813
  14. 14. /1814
  15. 15. /1815 😱
  16. 16. /1816
  17. 17. /18 ▸ b.androd.com issue ▸ won’t fix ▸ ▸ navigation-ui alpha 17
  18. 18. /18 ▸ 6/14 Osaka Mix Leap Study #16 - Android JetPack ▸ https://yahoo-osaka.connpass.com/event/89865/ ▸ 6/15 Dev #2 WWDC & Google IO ▸ https://kyoto-dev-cafe.connpass.com/event/89875/ 18

×