Skip to content

Commit

Permalink
[Feat/#47] dialog post 로직 임시 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
ss99x2002 committed Jul 11, 2023
1 parent 633d7f2 commit e479f7f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.viewModels
import com.sopt.umbba_android.R
import com.sopt.umbba_android.databinding.FragmentConfirmAnswerDialogBinding
import timber.log.Timber

class ConfirmAnswerDialogFragment : DialogFragment() {

private var _binding: FragmentConfirmAnswerDialogBinding? = null
private val confirmAnswerDialogViewModel by viewModels<ConfirmAnswerDialogFragmentViewModel>()
private val binding get() = requireNotNull(_binding) { "ConfirmAnswerDialogFragment is null" }

override fun onCreateView(
Expand All @@ -30,12 +32,16 @@ class ConfirmAnswerDialogFragment : DialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setBackgroundDesign()
setBtnClickEvent()
setPreviewAnswer()
setBtnClickEvent()
}

private fun setPreviewAnswer() {
binding.tvAnswer.text = arguments?.getString("ConfirmAnswerText")
with(binding) {
tvAnswer.text = arguments?.getString("answer")
tvTitle.text = arguments?.getString("title")
tvTopic.text = arguments?.getString("topic")
}
}

private fun setBackgroundDesign() {
Expand All @@ -49,7 +55,7 @@ class ConfirmAnswerDialogFragment : DialogFragment() {
}
btnConfirm.setOnClickListener {
dismiss()
//TODO(답변 내용 POST API 연결 부분)
confirmAnswerDialogViewModel.postAnswer(tvAnswer.text.toString())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.sopt.umbba_android.presentation.qna

import androidx.lifecycle.ViewModel

class ConfirmAnswerDialogFragmentViewModel : ViewModel() {
fun postAnswer(answer: String) {
//TODO(post Repo로 가는 함수 가보자고.)
}
}

0 comments on commit e479f7f

Please sign in to comment.