Skip to content

Instantly share code, notes, and snippets.

@muzafakar
Created October 14, 2019 14:51
Show Gist options
  • Save muzafakar/cb199a2c2cc2fc8656fe77cc26a77d4e to your computer and use it in GitHub Desktop.
Save muzafakar/cb199a2c2cc2fc8656fe77cc26a77d4e to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() {
private lateinit var adpOnBoarding: AdpOnBoarding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
adpOnBoarding = AdpOnBoarding(supportFragmentManager, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT)
tlDotsContainer.setupWithViewPager(vpOnBoarding)
vpOnBoarding.adapter = adpOnBoarding
initOnBoarding()
}
private fun initOnBoarding() {
val walkingOnBoarding = OnBoardingItemFragment().apply {
arguments = bundleOf(
OnBoardingItemFragment.LOTTIE to R.raw.walking,
OnBoardingItemFragment.TEXT to R.string.walking
)
}
val meetingOnBoarding = OnBoardingItemFragment().apply {
arguments = bundleOf(
OnBoardingItemFragment.LOTTIE to R.raw.meeting,
OnBoardingItemFragment.TEXT to R.string.meeting
)
}
adpOnBoarding.addItem(walkingOnBoarding)
adpOnBoarding.addItem(meetingOnBoarding)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment