Skip to content

Instantly share code, notes, and snippets.

@DjakaTechnology
Created March 3, 2019 15:38
Show Gist options
  • Save DjakaTechnology/43b4d0b43fd53a2d0b5ef01cc166dec1 to your computer and use it in GitHub Desktop.
Save DjakaTechnology/43b4d0b43fd53a2d0b5ef01cc166dec1 to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() {
val data: ArrayList<PageModel> = ArrayList()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
prepareData()
prepareViewPager()
}
private fun addData(message:String, color:Int){
data.add(PageModel(message, color))
}
private fun prepareData() {
addData("I'm Angry >:(", android.R.color.holo_red_dark)
addData("I'm sad :'(", android.R.color.holo_blue_dark)
addData("I'm happy :D", android.R.color.holo_green_dark)
}
private fun prepareViewPager() {
vp_main.adapter = VPMainAdapter(data)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment