Skip to content

Commit

Permalink
fix: git conflict 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
chaehyuns committed Aug 6, 2024
1 parent 609be26 commit 7071c40
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 84 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ dependencies {

// WebView
implementation("androidx.webkit:webkit:1.9.0")

// Firebase
implementation(platform("com.google.firebase:firebase-bom:33.1.2"))
implementation("com.google.firebase:firebase-analytics")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ import java.util.Calendar
class OfferingWriteFragment : Fragment(), OnOfferingWriteClickListener {
private var _fragmentBinding: FragmentOfferingWriteBinding? = null
private val fragmentBinding get() = _fragmentBinding!!

private var _dateTimePickerBinding: DialogDateTimePickerBinding? = null
private val dateTimePickerBinding get() = _dateTimePickerBinding!!
private var toast: Toast? = null
private val dialog: Dialog by lazy { Dialog(requireActivity()) }

private val viewModel: OfferingWriteViewModel by viewModels {
OfferingWriteViewModel.getFactory(
offeringRepository = (requireActivity().application as ChongdaeApp).offeringRepository,
)
}

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
Expand All @@ -42,7 +42,7 @@ class OfferingWriteFragment : Fragment(), OnOfferingWriteClickListener {
initBinding(inflater, container)
return fragmentBinding.root
}

override fun onViewCreated(
view: View,
savedInstanceState: Bundle?,
Expand All @@ -54,42 +54,42 @@ class OfferingWriteFragment : Fragment(), OnOfferingWriteClickListener {
selectDeadline()
searchPlace()
}

private fun searchPlace() {
fragmentBinding.tvPlaceValue?.setOnClickListener {
fragmentBinding.tvPlaceValue.setOnClickListener {
AddressFinderDialog().show(parentFragmentManager, this.tag)
}
setFragmentResultListener(AddressFinderDialog.ADDRESS_KEY) { _, bundle ->
fragmentBinding.tvPlaceValue?.text = bundle.getString(AddressFinderDialog.BUNDLE_ADDRESS_KEY)
fragmentBinding.tvPlaceValue.text = bundle.getString(AddressFinderDialog.BUNDLE_ADDRESS_KEY)
}
}

private fun selectDeadline() {
viewModel.deadlineChoiceEvent.observe(viewLifecycleOwner) {
dialog.setContentView(dateTimePickerBinding.root)
dialog.show()
setDateTimeText(dateTimePickerBinding)
}
}

override fun onDateTimeSubmitButtonClick() {
viewModel.updateDeadline(
dateTimePickerBinding.tvDate.text.toString(),
dateTimePickerBinding.tvTime.text.toString(),
)
dialog.dismiss()
}

override fun onDateTimeCancelButtonClick() {
dialog.dismiss()
}

private fun setDateTimeText(dateTimeBinding: DialogDateTimePickerBinding) {
val calendar = Calendar.getInstance()
updateDate(calendar, dateTimeBinding)
updateTime(calendar, dateTimeBinding)
}

private fun updateTime(
calendar: Calendar,
dateTimeBinding: DialogDateTimePickerBinding,
Expand All @@ -101,7 +101,7 @@ class OfferingWriteFragment : Fragment(), OnOfferingWriteClickListener {
updateTimeTextView(dateTimeBinding.tvTime, hourOfDay, minute)
}
}

private fun updateDate(
calendar: Calendar,
dateTimeBinding: DialogDateTimePickerBinding,
Expand All @@ -114,7 +114,7 @@ class OfferingWriteFragment : Fragment(), OnOfferingWriteClickListener {
updateDateTextView(dateTimeBinding.tvDate, year, monthOfYear, dayOfMonth)
}
}

private fun updateDateTextView(
textView: TextView,
year: Int,
Expand All @@ -128,7 +128,7 @@ class OfferingWriteFragment : Fragment(), OnOfferingWriteClickListener {
dayOfMonth,
)
}

private fun updateTimeTextView(
textView: TextView,
hourOfDay: Int,
Expand All @@ -138,20 +138,20 @@ class OfferingWriteFragment : Fragment(), OnOfferingWriteClickListener {
val hour = if (hourOfDay % 12 == 0) 12 else hourOfDay % 12
textView.text = getString(R.string.write_selected_time, amPm, hour, minute)
}

private fun initBinding(
inflater: LayoutInflater,
container: ViewGroup?,
) {
_fragmentBinding = FragmentOfferingWriteBinding.inflate(inflater, container, false)
fragmentBinding.vm = viewModel
fragmentBinding.lifecycleOwner = viewLifecycleOwner

_dateTimePickerBinding = DialogDateTimePickerBinding.inflate(inflater, container, false)
dateTimePickerBinding.vm = viewModel
dateTimePickerBinding.onClickListener = this
}

private fun observeInvalidInputEvent() {
viewModel.invalidTotalCountEvent.observe(viewLifecycleOwner) {
showToast(R.string.write_invalid_total_count)
Expand All @@ -166,14 +166,14 @@ class OfferingWriteFragment : Fragment(), OnOfferingWriteClickListener {
showToast(it)
}
}

private fun observeFinishEvent() {
viewModel.finishEvent.observe(viewLifecycleOwner) {
showToast(R.string.write_success_writing)
parentFragmentManager.popBackStack()
}
}

private fun showToast(
@StringRes message: Int,
) {
Expand All @@ -186,7 +186,7 @@ class OfferingWriteFragment : Fragment(), OnOfferingWriteClickListener {
)
toast?.show()
}

override fun onDestroy() {
super.onDestroy()
_fragmentBinding = null
Expand Down
Loading

0 comments on commit 7071c40

Please sign in to comment.