Skip to content

Commit

Permalink
[FEAT/#26] 여행 생성 뷰 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
crownjoe committed Jan 8, 2024
1 parent 963178b commit 1757a5d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ import com.going.presentation.R
import com.going.presentation.databinding.FragmentBottomSheetDateContentBinding
import com.going.ui.base.BaseBottomSheet
import com.going.ui.extension.setOnSingleClickListener

class DateBottomSheet(val viewModel: CreateTripViewModel, val isStart: Boolean) :
BaseBottomSheet<FragmentBottomSheetDateContentBinding>(R.layout.fragment_bottom_sheet_date_content) {

override fun onStart() {
super.onStart()
dialog?.window?.setBackgroundDrawableResource(R.color.transparent)

}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

initFinishBtnClickListener()
}

Expand All @@ -36,23 +35,18 @@ class DateBottomSheet(val viewModel: CreateTripViewModel, val isStart: Boolean)
viewModel.StartMonth.value = binding.dpCreateTripDate.month + 1
viewModel.StartDay.value = binding.dpCreateTripDate.dayOfMonth
viewModel.checkStartDateAvailable()
} else {
if (viewModel.StartYear.value?.let { binding.dpCreateTripDate.year > it } ?: true) {
viewModel.EndYear.value = binding.dpCreateTripDate.year
viewModel.EndMonth.value = binding.dpCreateTripDate.month + 1
viewModel.EndDay.value = binding.dpCreateTripDate.dayOfMonth
viewModel.checkEndDateAvailable()
} else {
}
} else if (viewModel.StartYear.value?.let { binding.dpCreateTripDate.year > it } ?: true) {
viewModel.EndYear.value = binding.dpCreateTripDate.year
viewModel.EndMonth.value = binding.dpCreateTripDate.month + 1
viewModel.EndDay.value = binding.dpCreateTripDate.dayOfMonth
viewModel.checkEndDateAvailable()
}
}


private fun initFinishBtnClickListener(){
private fun initFinishBtnClickListener() {
binding.btnCreateTripFinish.setOnSingleClickListener {
sendDateInfo()
dismiss()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ class CreateTripActivity :
viewModel.isNameAvailable.value == NameState.Blank && counter == binding.tvNameCounter -> R.color.red_500 to R.drawable.shape_rect_4_red500_line
else -> R.color.gray_700 to R.drawable.shape_rect_4_gray700_line
}

setCounterColor(counter, color)
setBackground(background)
}
Expand Down Expand Up @@ -132,15 +131,13 @@ class CreateTripActivity :
binding.tvCreateTripStartDate.setOnSingleClickListener {
val bottomSheetDialog = DateBottomSheet(viewModel, true)
bottomSheetDialog.show(supportFragmentManager, bottomSheetDialog.tag)

}
}

private fun initEndDateClickListener() {
binding.tvCreateTripEndDate.setOnSingleClickListener {
val bottomSheetDialog = DateBottomSheet(viewModel, false)
bottomSheetDialog.show(supportFragmentManager, bottomSheetDialog.tag)

}
}

Expand Down

0 comments on commit 1757a5d

Please sign in to comment.