@@ -58,7 +58,6 @@ import kotlinx.android.synthetic.main.fragment_attendee.view.yearText
5858import kotlinx.android.synthetic.main.fragment_attendee.view.cardNumber
5959import kotlinx.android.synthetic.main.fragment_attendee.view.acceptCheckbox
6060import kotlinx.android.synthetic.main.fragment_attendee.view.countryPicker
61- import kotlinx.android.synthetic.main.fragment_attendee.view.countryPickerContainer
6261import kotlinx.android.synthetic.main.fragment_attendee.view.billingInfoContainer
6362import kotlinx.android.synthetic.main.fragment_attendee.view.billingInfoCheckboxSection
6463import kotlinx.android.synthetic.main.fragment_attendee.view.billingEnabledCheckbox
@@ -90,6 +89,7 @@ import kotlinx.android.synthetic.main.fragment_attendee.view.signInText
9089import kotlinx.android.synthetic.main.fragment_attendee.view.signInTextLayout
9190import kotlinx.android.synthetic.main.fragment_attendee.view.signInLayout
9291import kotlinx.android.synthetic.main.fragment_attendee.view.signOutLayout
92+ import kotlinx.android.synthetic.main.fragment_attendee.view.paymentTitle
9393import org.fossasia.openevent.general.BuildConfig
9494import org.fossasia.openevent.general.R
9595import org.fossasia.openevent.general.auth.User
@@ -284,7 +284,7 @@ class AttendeeFragment : Fragment(), ComplexBackPressFragment {
284284 }
285285
286286 private fun setupCountDownTimer (orderExpiryTime : Int ) {
287- rootView.timeoutCounterLayout.visibility = View . VISIBLE
287+ rootView.timeoutCounterLayout.isVisible = true
288288 rootView.timeoutInfoTextView.text =
289289 getString(R .string.ticket_timeout_info_message, orderExpiryTime.toString())
290290
@@ -320,7 +320,6 @@ class AttendeeFragment : Fragment(), ComplexBackPressFragment {
320320
321321 attendeeViewModel.totalAmount.value = safeArgs.amount
322322 rootView.paymentSelectorContainer.isVisible = safeArgs.amount > 0
323- rootView.countryPickerContainer.isVisible = safeArgs.amount > 0
324323 rootView.billingInfoCheckboxSection.isVisible = safeArgs.amount > 0
325324 rootView.amount.text = " Total: ${attendeeViewModel.paymentCurrency}${safeArgs.amount} "
326325
@@ -334,7 +333,7 @@ class AttendeeFragment : Fragment(), ComplexBackPressFragment {
334333 val currentTickets = attendeeViewModel.tickets.value
335334 val currentTotalPrice = safeArgs.amount
336335 if (currentTickets != null && currentTotalPrice != null ) {
337- rootView.paymentSelector.visibility = if ( currentTotalPrice > 0 ) View . VISIBLE else View . GONE
336+ rootView.paymentSelector.isVisible = currentTotalPrice > 0
338337 rootView.amount.text = " Total: ${attendeeViewModel.paymentCurrency}$currentTotalPrice "
339338
340339 ticketsRecyclerAdapter.addAll(currentTickets)
@@ -524,7 +523,6 @@ class AttendeeFragment : Fragment(), ComplexBackPressFragment {
524523 attendeeViewModel.countryPosition = position
525524 }
526525 }
527- rootView.countryPickerContainer.visibility = if (attendeeViewModel.singleTicket) View .VISIBLE else View .GONE
528526 }
529527
530528 private fun setupPaymentOptions (event : Event ) {
@@ -549,33 +547,38 @@ class AttendeeFragment : Fragment(), ComplexBackPressFragment {
549547 attendeeViewModel.selectedPaymentOption = position
550548 when (position) {
551549 paymentOptions.indexOf(getString(R .string.stripe)) -> {
552- rootView.stripePayment.visibility = View . VISIBLE
553- rootView.offlinePayment.visibility = View . GONE
550+ rootView.stripePayment.isVisible = true
551+ rootView.offlinePayment.isVisible = false
554552 }
555553 paymentOptions.indexOf(getString(R .string.on_site)) -> {
556- rootView.offlinePayment.visibility = View . VISIBLE
557- rootView.stripePayment.visibility = View . GONE
554+ rootView.offlinePayment.isVisible = true
555+ rootView.stripePayment.isVisible = false
558556 rootView.offlinePaymentDescription.text = event.onsiteDetails
559557 }
560558 paymentOptions.indexOf(getString(R .string.bank_transfer)) -> {
561- rootView.offlinePayment.visibility = View . VISIBLE
562- rootView.stripePayment.visibility = View . GONE
559+ rootView.offlinePayment.isVisible = true
560+ rootView.stripePayment.isVisible = false
563561 rootView.offlinePaymentDescription.text = event.bankDetails
564562 }
565563 paymentOptions.indexOf(getString(R .string.cheque)) -> {
566- rootView.offlinePayment.visibility = View . VISIBLE
567- rootView.stripePayment.visibility = View . GONE
564+ rootView.offlinePayment.isVisible = true
565+ rootView.stripePayment.isVisible = false
568566 rootView.offlinePaymentDescription.text = event.chequeDetails
569567 }
570568 else -> {
571- rootView.stripePayment.visibility = View . GONE
572- rootView.offlinePayment.visibility = View . GONE
569+ rootView.stripePayment.isVisible = false
570+ rootView.offlinePayment.isVisible = false
573571 }
574572 }
575573 }
576574 }
577575 if (attendeeViewModel.selectedPaymentOption != - 1 )
578576 rootView.paymentSelector.setSelection(attendeeViewModel.selectedPaymentOption)
577+
578+ if (paymentOptions.size == 1 ) {
579+ rootView.paymentSelector.isVisible = false
580+ rootView.paymentTitle.text = " ${getString(R .string.payment)} ${paymentOptions[0 ]} "
581+ }
579582 }
580583
581584 private fun setupCardNumber () {
@@ -605,20 +608,21 @@ class AttendeeFragment : Fragment(), ComplexBackPressFragment {
605608 }
606609
607610 private fun setupMonthOptions () {
608- val month = ArrayList <String >()
609- month.add(getString(R .string.month_string))
610- month.add(getString(R .string.january))
611- month.add(getString(R .string.february))
612- month.add(getString(R .string.march))
613- month.add(getString(R .string.april))
614- month.add(getString(R .string.may))
615- month.add(getString(R .string.june))
616- month.add(getString(R .string.july))
617- month.add(getString(R .string.august))
618- month.add(getString(R .string.september))
619- month.add(getString(R .string.october))
620- month.add(getString(R .string.november))
621- month.add(getString(R .string.december))
611+ val month = mutableListOf (
612+ getString(R .string.month_string),
613+ getString(R .string.january),
614+ getString(R .string.february),
615+ getString(R .string.march),
616+ getString(R .string.april),
617+ getString(R .string.may),
618+ getString(R .string.june),
619+ getString(R .string.july),
620+ getString(R .string.august),
621+ getString(R .string.september),
622+ getString(R .string.october),
623+ getString(R .string.november),
624+ getString(R .string.december)
625+ )
622626
623627 rootView.month.adapter = ArrayAdapter (requireContext(), android.R .layout.simple_spinner_dropdown_item,
624628 month)
@@ -844,10 +848,10 @@ class AttendeeFragment : Fragment(), ComplexBackPressFragment {
844848
845849 private fun loadTicketDetailsTableUI (show : Boolean ) {
846850 if (show) {
847- rootView.ticketDetails.visibility = View . VISIBLE
851+ rootView.ticketDetails.isVisible = true
848852 rootView.ticketTableDetails.text = context?.getString(R .string.hide)
849853 } else {
850- rootView.ticketDetails.visibility = View . GONE
854+ rootView.ticketDetails.isVisible = false
851855 rootView.ticketTableDetails.text = context?.getString(R .string.view)
852856 }
853857 }
0 commit comments