Created
March 3, 2019 15:38
-
-
Save DjakaTechnology/43b4d0b43fd53a2d0b5ef01cc166dec1 to your computer and use it in GitHub Desktop.
This file contains 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
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