diff --git a/app/src/main/java/com/nivesh/production/niveshfd/adapter/CustomerListAdapter.kt b/app/src/main/java/com/nivesh/production/niveshfd/adapter/CustomerListAdapter.kt
index 04cbdc0..434cfbf 100644
--- a/app/src/main/java/com/nivesh/production/niveshfd/adapter/CustomerListAdapter.kt
+++ b/app/src/main/java/com/nivesh/production/niveshfd/adapter/CustomerListAdapter.kt
@@ -34,8 +34,15 @@ class CustomerListAdapter(
val cList = customerList?.get(position)
if (cList != null) {
holder.txtLabel.text = cList.Label
- holder.tvCustomerName.setOnCheckedChangeListener { _, isChecked ->
- cList.isSelected = isChecked
+ if(holder.txtLabel.text.contains("outside of india",true) ) {
+ holder.tvCustomerName.isChecked = true
+ holder.tvCustomerName.setOnCheckedChangeListener { _, isChecked ->
+ cList.isSelected = isChecked
+ }
+ }else {
+ holder.tvCustomerName.setOnCheckedChangeListener { _, isChecked ->
+ cList.isSelected = isChecked
+ }
}
}
}
diff --git a/app/src/main/java/com/nivesh/production/niveshfd/ui/activity/NiveshFdMainActivity.kt b/app/src/main/java/com/nivesh/production/niveshfd/ui/activity/NiveshFdMainActivity.kt
index 569cb44..dece4ea 100644
--- a/app/src/main/java/com/nivesh/production/niveshfd/ui/activity/NiveshFdMainActivity.kt
+++ b/app/src/main/java/com/nivesh/production/niveshfd/ui/activity/NiveshFdMainActivity.kt
@@ -262,11 +262,11 @@ class NiveshFdMainActivity : BaseActivity() {
val viewPager: DisableAdapter = binding.viewPager
viewPager.adapter = sectionsPagerAdapter
viewPager.setPagingEnabled(false)
- if (sectionsPagerAdapter.count > 1) {
+ // if (sectionsPagerAdapter.count > 1) {
viewPager.offscreenPageLimit = stepCount
- } else {
- viewPager.offscreenPageLimit = 1
- }
+ // } else {
+ // viewPager.offscreenPageLimit = 1
+ // }
viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrolled(
position: Int,
@@ -356,7 +356,7 @@ class NiveshFdMainActivity : BaseActivity() {
}
// step 2 response
- fun stepTwoApi() {
+ fun stepTwoApi() {
binding.viewPager.currentItem = 2
if (stepCount == 3) {
stepFourBajajFDFragment.displayReceivedData()
@@ -364,7 +364,7 @@ class NiveshFdMainActivity : BaseActivity() {
}
// step 3 response
- fun stepThreeApi() {
+ fun stepThreeApi() {
binding.viewPager.currentItem = 3
stepFourBajajFDFragment.displayReceivedData()
}
diff --git a/app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepFourNiveshFDFragment.kt b/app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepFourNiveshFDFragment.kt
index bfd4f24..08146c1 100644
--- a/app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepFourNiveshFDFragment.kt
+++ b/app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepFourNiveshFDFragment.kt
@@ -28,6 +28,7 @@ class StepFourNiveshFDFragment : Fragment() {
private var selectedList: String = ""
private var payUrl: String = ""
private var value: String = ""
+ private var checkNRI: Boolean = false
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
@@ -60,7 +61,7 @@ class StepFourNiveshFDFragment : Fragment() {
)
)
}
-
+ checkNRI = true
binding.btnNext.setOnClickListener {
selectedList = ""
for (getCodes in listOfCustomer) {
@@ -68,6 +69,9 @@ class StepFourNiveshFDFragment : Fragment() {
selectedList = if (selectedList.isEmpty()) {
getCodes.Value
} else {
+ if (getCodes.Value.contains("outside of india", true)) {
+ checkNRI = getCodes.isSelected
+ }
selectedList.plus(",").plus(getCodes.Value)
}
}
@@ -94,60 +98,48 @@ class StepFourNiveshFDFragment : Fragment() {
(activity as NiveshFdMainActivity).binding.viewPager.currentItem = 1
}
}
- }
- private fun validated(): Boolean {
- return if (selectedList.isEmpty()) {
- showDialogValidation(
- activity as NiveshFdMainActivity,
- getString(R.string.validTermsCondition)
- )
- false
- } else if (!binding.checkBox.isChecked) {
- showDialogValidation(
- activity as NiveshFdMainActivity,
- resources.getString(R.string.validTermsConditions)
- )
- false
- } else {
- true
- }
+ customerListApi()
}
- private fun saveFDOtherData(data: SaveFDOtherDataRequest, payUrl: String, value: String) {
- // ProgressUtil.showLoading(activity as NiveshFdMainActivity)
- (activity as NiveshFdMainActivity).viewModel.saveFDOtherData(
- data,
+ private fun customerListApi() {
+ val getCodeRequest = GetCodeRequest()
+ getCodeRequest.ProductName = getString(R.string.bajajFD)
+ getCodeRequest.Category = getString(R.string.customerCategory)
+ getCodeRequest.Language = getString(R.string.language)
+ getCodeRequest.InputValue = ""
+ (activity as NiveshFdMainActivity).viewModel.customerListApi(
+ getCodeRequest,
PreferenceManager(activity as NiveshFdMainActivity).getToken(),
activity as NiveshFdMainActivity
)
- (activity as NiveshFdMainActivity).viewModel.getFDOtherMutableData.observe(
+ (activity as NiveshFdMainActivity).viewModel.customerListMutableData.observe(
viewLifecycleOwner
) { response ->
when (response) {
is Resource.Success -> {
- Log.e("saveFDOtherData", " response -->${response.data.toString()}")
- val saveFDOtherDataResponse: SaveFDOtherDataResponse =
- Gson().fromJson(
- response.data?.toString(),
- SaveFDOtherDataResponse::class.java
- )
- saveFDOtherDataResponse.Response.StatusCode.let { code ->
+ Log.e("customerListApi", " response -->${response.data.toString()}")
+ val getCodeResponse: GetCodeResponse =
+ Gson().fromJson(response.data?.toString(), GetCodeResponse::class.java)
+ getCodeResponse.Response.StatusCode.let { code ->
when (code) {
200 -> {
- (activity as NiveshFdMainActivity).stepFourApi(payUrl, value)
+ if (getCodeResponse.Response.GetCodesList.isNotEmpty()) {
+ listOfCustomer = getCodeResponse.Response.GetCodesList
+ setUpRecyclerView(listOfCustomer)
+ }
}
// 650 -> refreshToken()
else -> {
- if (saveFDOtherDataResponse.Response.Errors.isNotEmpty()) {
+ if (getCodeResponse.Response.Errors.isNotEmpty()) {
showDialogValidation(
activity as NiveshFdMainActivity,
- saveFDOtherDataResponse.Response.Errors[0].ErrorMessage
+ getCodeResponse.Response.Errors[0].ErrorMessage
)
- }else{
+ } else {
showDialogValidation(
activity as NiveshFdMainActivity,
- "".plus(saveFDOtherDataResponse.Response.Message)
+ "".plus(getCodeResponse.Response.Message)
)
}
}
@@ -161,7 +153,7 @@ class StepFourNiveshFDFragment : Fragment() {
}
}
is Resource.Loading -> {
- // ProgressUtil.hideLoading()
+
}
is Resource.DataError -> {
@@ -170,49 +162,58 @@ class StepFourNiveshFDFragment : Fragment() {
}
}
- fun displayReceivedData() {
- getFDDetailsApi()
- customerListApi()
+ private fun validated(): Boolean {
+ return if (!checkNRI) {
+ showDialogValidation(
+ activity as NiveshFdMainActivity,
+ getString(R.string.validNRI)
+ )
+ false
+ } else if (!binding.checkBox.isChecked) {
+ showDialogValidation(
+ activity as NiveshFdMainActivity,
+ resources.getString(R.string.validTermsConditions)
+ )
+ false
+ } else {
+ true
+ }
}
- private fun customerListApi() {
- val getCodeRequest = GetCodeRequest()
- getCodeRequest.ProductName = getString(R.string.bajajFD)
- getCodeRequest.Category = getString(R.string.customerCategory)
- getCodeRequest.Language = getString(R.string.language)
- getCodeRequest.InputValue = ""
- (activity as NiveshFdMainActivity).viewModel.customerListApi(
- getCodeRequest,
+ private fun saveFDOtherData(data: SaveFDOtherDataRequest, payUrl: String, value: String) {
+ // ProgressUtil.showLoading(activity as NiveshFdMainActivity)
+ (activity as NiveshFdMainActivity).viewModel.saveFDOtherData(
+ data,
PreferenceManager(activity as NiveshFdMainActivity).getToken(),
activity as NiveshFdMainActivity
)
- (activity as NiveshFdMainActivity).viewModel.customerListMutableData.observe(
+ (activity as NiveshFdMainActivity).viewModel.getFDOtherMutableData.observe(
viewLifecycleOwner
) { response ->
when (response) {
is Resource.Success -> {
- Log.e("customerListApi", " response -->${response.data.toString()}")
- val getCodeResponse: GetCodeResponse =
- Gson().fromJson(response.data?.toString(), GetCodeResponse::class.java)
- getCodeResponse.Response.StatusCode.let { code ->
+ Log.e("saveFDOtherData", " response -->${response.data.toString()}")
+ val saveFDOtherDataResponse: SaveFDOtherDataResponse =
+ Gson().fromJson(
+ response.data?.toString(),
+ SaveFDOtherDataResponse::class.java
+ )
+ saveFDOtherDataResponse.Response.StatusCode.let { code ->
when (code) {
200 -> {
- if (getCodeResponse.Response.GetCodesList.isNotEmpty()) {
- listOfCustomer = getCodeResponse.Response.GetCodesList
- setUpRecyclerView(listOfCustomer)
- }
+ (activity as NiveshFdMainActivity).stepFourApi(payUrl, value)
}
// 650 -> refreshToken()
else -> {
- if (getCodeResponse.Response.Errors.isNotEmpty()) {
+ if (saveFDOtherDataResponse.Response.Errors.isNotEmpty()) {
showDialogValidation(
activity as NiveshFdMainActivity,
- getCodeResponse.Response.Errors[0].ErrorMessage
+ saveFDOtherDataResponse.Response.Errors[0].ErrorMessage
)
- }else{
+ } else {
showDialogValidation(
activity as NiveshFdMainActivity,
- "".plus(getCodeResponse.Response.Message)
+ "".plus(saveFDOtherDataResponse.Response.Message)
)
}
}
@@ -226,7 +227,7 @@ class StepFourNiveshFDFragment : Fragment() {
}
}
is Resource.Loading -> {
-
+ // ProgressUtil.hideLoading()
}
is Resource.DataError -> {
@@ -243,6 +244,10 @@ class StepFourNiveshFDFragment : Fragment() {
}
+ fun displayReceivedData() {
+ getFDDetailsApi()
+ }
+
private fun getFDDetailsApi() {
if (Common.isNetworkAvailable(activity as NiveshFdMainActivity)) {
val getFDDetailsRequest = GetFDDetailsRequest()
@@ -289,7 +294,7 @@ class StepFourNiveshFDFragment : Fragment() {
activity as NiveshFdMainActivity,
getFDDetailsResponse.Response.Errors[0].ErrorMessage
)
- }else{
+ } else {
showDialogValidation(
activity as NiveshFdMainActivity,
"".plus(getFDDetailsResponse.Response.Message)
@@ -313,10 +318,10 @@ class StepFourNiveshFDFragment : Fragment() {
}
}
}
+
}
}
-
override fun onDestroyView() {
super.onDestroyView()
_binding = null
diff --git a/app/src/main/res/values-hi-rIN/strings.xml b/app/src/main/res/values-hi-rIN/strings.xml
index 7016edc..67ff6e1 100644
--- a/app/src/main/res/values-hi-rIN/strings.xml
+++ b/app/src/main/res/values-hi-rIN/strings.xml
@@ -260,7 +260,7 @@
OK
Selected Bank is Not Eligible For Investment of Bajaj Fd
-
+ Sorry! We are not serving NRI residents at present.
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index b8c3a03..5164a61 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -259,8 +259,7 @@
OK
Selected Bank is Not Eligible For Investment of Bajaj Fd
-
-
+ Sorry! We are not serving NRI residents at present.
\ No newline at end of file