TP-61299 | crash fix (#10178)
Co-authored-by: Aditya Piyush <aditya.piyush@navi.com>
This commit is contained in:
committed by
GitHub
parent
e7c5456b05
commit
0fac143d97
@@ -49,11 +49,11 @@ constructor(
|
||||
this.checkboxTv.apply { setTextFieldData(widgetModel.widgetData?.checkboxData?.title) }
|
||||
this.checkboxCb.apply {
|
||||
isChecked = widgetModel.widgetData?.checkboxData?.savedValue.toBoolean()
|
||||
setOnCheckedChangeListener { _, isChecked ->
|
||||
setOnClickListener {
|
||||
val checkboxClickAction =
|
||||
CheckboxClickAction(
|
||||
widgetId = widgetModel.widgetId,
|
||||
isChecked = isChecked,
|
||||
isChecked = this.isChecked,
|
||||
)
|
||||
widgetCallback.onClick(checkboxClickAction)
|
||||
widgetCallback.onDataChanged(widgetModel.widgetId)
|
||||
|
||||
@@ -12,6 +12,8 @@ import com.navi.design.R as DesignR
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@@ -782,6 +784,7 @@ class HomeLoanFormScreenFragment :
|
||||
private fun handleCheckboxError(showError: Boolean, widgetId: String? = EMPTY) {
|
||||
var checkboxClicked = false
|
||||
var count = 0
|
||||
var itemIndexToUpdate = 0
|
||||
viewModel.formGetResponse.value?.content?.widgets?.forEach {
|
||||
count++
|
||||
if (it.widgetId == FINANCIAL_CO_APPLICANT_CHECKBOX) {
|
||||
@@ -790,7 +793,7 @@ class HomeLoanFormScreenFragment :
|
||||
val previousErrorState = widget.widgetData?.checkboxData?.showError
|
||||
widget.widgetData?.checkboxData?.showError = showError
|
||||
if (previousErrorState != showError) {
|
||||
formAdapter?.notifyItemChanged(count-1)
|
||||
itemIndexToUpdate = count - 1
|
||||
if (previousErrorState == true) {
|
||||
checkboxClicked = true
|
||||
}
|
||||
@@ -798,17 +801,23 @@ class HomeLoanFormScreenFragment :
|
||||
}
|
||||
}
|
||||
}
|
||||
if (checkboxClicked) {
|
||||
viewModel.formGetResponse.value?.content?.widgets?.forEach {
|
||||
if (it.widgetId == widgetId) {
|
||||
val widget = it
|
||||
if (widget is CheckboxWithTitleWidget) {
|
||||
Handler(Looper.getMainLooper()).post { formAdapter?.notifyItemChanged(itemIndexToUpdate) }
|
||||
|
||||
var widgetIndex = -1
|
||||
viewModel.formGetResponse.value?.content?.widgets?.forEach {
|
||||
if (it.widgetId == widgetId) {
|
||||
widgetIndex++
|
||||
val widget = it
|
||||
if (widget is CheckboxWithTitleWidget) {
|
||||
if (checkboxClicked) {
|
||||
widget.widgetData?.checkboxData?.savedValue = true.toString()
|
||||
formAdapter?.notifyDataSetChanged()
|
||||
} else {
|
||||
widget.widgetData?.checkboxData?.savedValue = EMPTY
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (widgetIndex != -1) Handler(Looper.getMainLooper()).post { formAdapter?.notifyItemChanged(widgetIndex) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -245,8 +245,8 @@ class HomeLoanSearchFragment : HomeLoanBaseFragment(), WidgetCallback, BackListe
|
||||
}
|
||||
}
|
||||
|
||||
private fun processInputSearchResponseData(searchResponse: InputSearchResponse) {
|
||||
searchResponse.content?.availableItems?.let { contentList ->
|
||||
private fun processInputSearchResponseData(searchResponse: InputSearchResponse?) {
|
||||
searchResponse?.content?.availableItems?.let { contentList ->
|
||||
val list: MutableList<NaviBaseAdapterModel> = mutableListOf()
|
||||
contentList.forEach { element ->
|
||||
element.name?.let { itemName ->
|
||||
|
||||
Reference in New Issue
Block a user