Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. package org.mifos.visionppi.ui.new_survey
  2.  
  3. import android.os.Bundle
  4. import androidx.appcompat.app.AppCompatActivity
  5. import androidx.recyclerview.widget.LinearLayoutManager
  6. import androidx.recyclerview.widget.PagerSnapHelper
  7. import kotlinx.android.synthetic.main.activity_new_survey.*
  8. import org.mifos.visionppi.R
  9. import org.mifos.visionppi.adapters.QuestionAdapter
  10. import org.mifos.visionppi.objects.PPISurvey
  11.  
  12.  
  13.  
  14.  
  15. class NewSurveyActivity : AppCompatActivity() , NewSurveyMVPView {
  16.  
  17. var mNewSurveyPresenter : NewSurveyPresenter = NewSurveyPresenter()
  18. lateinit var mPPISurvey: PPISurvey
  19.  
  20. override fun onCreate(savedInstanceState: Bundle?) {
  21. super.onCreate(savedInstanceState)
  22. setContentView(R.layout.activity_new_survey)
  23.  
  24. getSurveyQuestions()
  25.  
  26. }
  27.  
  28. override fun getSurveyQuestions() {
  29. mPPISurvey = mNewSurveyPresenter.getSurvey(1, applicationContext)
  30. renderSurvey(mPPISurvey)
  31. }
  32.  
  33. override fun renderSurvey(mPPISurvey: PPISurvey) {
  34. val snapHelper = PagerSnapHelper()
  35. snapHelper.attachToRecyclerView(ppi_survey)
  36. ppi_survey.layoutManager = LinearLayoutManager(this)
  37. ppi_survey.setLayoutManager(LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false))
  38. ppi_survey.adapter = QuestionAdapter(mPPISurvey.questionDatas, applicationContext)
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement