Last active
July 5, 2021 14:10
-
-
Save erdalkaymak/40d785601e2ce7fd669ae5b6de6371ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fun initialize() { | |
| val fragmentList = arrayListOf<Fragment>( | |
| HourlyWeatherDetailFragment(), WeeklyWeatherDetailFragment() | |
| ) | |
| val tabTitles = arrayListOf( | |
| "Hourly Weather", "Weekly Weather" | |
| ) | |
| val adapter = ViewPagerWeatherAdapter( | |
| fragmentList, | |
| childFragmentManager, | |
| lifecycle | |
| ) | |
| viewPager2.adapter = adapter | |
| TabLayoutMediator(tabLayout, viewPager2) { tab, position -> | |
| tab.text = tabTitles[position] | |
| viewPager2.setCurrentItem(tab.position, true) | |
| }.attach() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment