Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.hily.app.presentation.ui.fragments.puzzle
- import android.os.Bundle
- import android.view.LayoutInflater
- import android.view.View
- import android.view.ViewGroup
- import com.hily.app.data.model.pojo.dialog.DialogResponse
- import com.hily.app.data.model.pojo.thread.IceBreakerListItem
- import com.hily.app.presentation.ui.fragments.BaseFragment
- import org.jetbrains.anko.AnkoContext
- import javax.inject.Inject
- /**
- * Created by Kirill Stoianov on 3/7/19.
- */
- class PuzzleFunnelFragment : BaseFragment(), PuzzleFunnelViewImpl.ActionListener {
- companion object {
- val TAG: String = PuzzleFunnelFragment::class.java.simpleName
- private const val ARG_TAG_PUZZLE_QUIZ = "ARG_TAG_PUZZLE_QUIZ"
- fun newInstance(puzzleQuiz: DialogResponse.PuzzleQuiz): PuzzleFunnelFragment {
- return PuzzleFunnelFragment().apply {
- val args = Bundle()
- args.putParcelable(ARG_TAG_PUZZLE_QUIZ, puzzleQuiz)
- arguments = args
- }
- }
- }
- @Inject
- lateinit var puzzleFunnelPresenter: PuzzleFunnelPresenter
- private val puzzleQuiz by lazy {
- arguments?.getParcelable<DialogResponse.PuzzleQuiz>(ARG_TAG_PUZZLE_QUIZ)
- }
- private val puzzleFunnelViewImpl = PuzzleFunnelViewImpl()
- override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
- return context?.let { c ->
- puzzleFunnelViewImpl.createView(AnkoContext.create(c, this))
- }
- }
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- puzzleFunnelViewImpl.actionListener = this
- puzzleFunnelPresenter.attachView(puzzleFunnelViewImpl)
- //initialize fragment with puzzle quiz
- puzzleQuiz?.apply { puzzleFunnelPresenter.showPuzzleQuiz(this) }
- }
- override fun onDetach() {
- puzzleFunnelPresenter.detachView()
- super.onDetach()
- }
- override fun onAnswer(userId: Long, puzzleAnswerId: Long, puzzleQuestionId: Long) {
- puzzleFunnelPresenter.sendAnswer(userId, puzzleAnswerId, puzzleQuestionId)
- }
- override fun sendMessage(message: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
- override fun sendIceBreaker(iceBreaker: IceBreakerListItem) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
- override fun tryAgain(userId: Long) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement