Skip to content

Commit

Permalink
[MOD] #285 액티비티 kotlin ext -> viewBinding 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
sxunea committed Jul 3, 2024
1 parent 4378b92 commit 44087f9
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import timber.log.Timber
class MyHistoryActivity : BindingActivity<ActivityMyHistoryBinding>(R.layout.activity_my_history),
OnMyHistoryItemClick {
private val viewModel: MyHistoryViewModel by viewModels()
private lateinit var deleteDialogDeleteBinding: CustomDialogDeleteBinding
private lateinit var adapter: MyHistoryAdapter
private lateinit var dialog: AlertDialog

Expand Down Expand Up @@ -66,18 +67,18 @@ class MyHistoryActivity : BindingActivity<ActivityMyHistoryBinding>(R.layout.act
}

private fun initDialog() {
val binding = CustomDialogDeleteBinding.inflate(layoutInflater)
deleteDialogDeleteBinding = CustomDialogDeleteBinding.inflate(layoutInflater)
dialog = setCustomDialog(
binding = binding,
binding = deleteDialogDeleteBinding,
description = DIALOG_DESC,
yesBtnText = DELETE_BTN
)
}

private fun setDialogClickEvent(binding: CustomDialogDeleteBinding) {
dialog.setDialogButtonClickListener(binding) { which ->
private fun setDialogClickEvent() {
dialog.setDialogButtonClickListener(deleteDialogDeleteBinding) { which ->
when (which) {
binding.btnDeleteYes -> viewModel.deleteHistory()
deleteDialogDeleteBinding.btnDeleteYes -> viewModel.deleteHistory()
}
}
}
Expand Down Expand Up @@ -112,8 +113,7 @@ class MyHistoryActivity : BindingActivity<ActivityMyHistoryBinding>(R.layout.act

private fun handleDeleteButtonClicked(it: View) {
if (it.isEnabled) {
val binding = CustomDialogDeleteBinding.inflate(LayoutInflater.from(it.context))
setDialogClickEvent(binding)
setDialogClickEvent()
dialog.show()
}
}
Expand Down

0 comments on commit 44087f9

Please sign in to comment.