|
@ -1,5 +1,6 @@ |
|
|
package com.nivesh.production.bajajfd.ui.fragment |
|
|
package com.nivesh.production.bajajfd.ui.fragment |
|
|
|
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint |
|
|
import android.app.DatePickerDialog |
|
|
import android.app.DatePickerDialog |
|
|
import android.os.Bundle |
|
|
import android.os.Bundle |
|
|
import android.text.Editable |
|
|
import android.text.Editable |
|
@ -8,10 +9,12 @@ import android.text.InputFilter.LengthFilter |
|
|
import android.text.TextWatcher |
|
|
import android.text.TextWatcher |
|
|
import android.util.Log |
|
|
import android.util.Log |
|
|
import android.view.LayoutInflater |
|
|
import android.view.LayoutInflater |
|
|
|
|
|
import android.view.MotionEvent |
|
|
import android.view.View |
|
|
import android.view.View |
|
|
import android.view.ViewGroup |
|
|
import android.view.ViewGroup |
|
|
import android.widget.ArrayAdapter |
|
|
import android.widget.ArrayAdapter |
|
|
import android.widget.RadioButton |
|
|
import android.widget.RadioButton |
|
|
|
|
|
import android.widget.Toast |
|
|
import androidx.core.content.ContextCompat |
|
|
import androidx.core.content.ContextCompat |
|
|
import androidx.fragment.app.Fragment |
|
|
import androidx.fragment.app.Fragment |
|
|
import com.google.android.material.textfield.TextInputEditText |
|
|
import com.google.android.material.textfield.TextInputEditText |
|
@ -690,7 +693,7 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@SuppressLint("ClickableViewAccessibility") |
|
|
private fun titleApi() { |
|
|
private fun titleApi() { |
|
|
if (Common.isNetworkAvailable(activity as BajajFdMainActivity)) { |
|
|
if (Common.isNetworkAvailable(activity as BajajFdMainActivity)) { |
|
|
val getCodeRequest = GetCodeRequest() |
|
|
val getCodeRequest = GetCodeRequest() |
|
@ -708,6 +711,8 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
getCodeResponse.Response.StatusCode.let { code -> |
|
|
getCodeResponse.Response.StatusCode.let { code -> |
|
|
when (code) { |
|
|
when (code) { |
|
|
200 -> { |
|
|
200 -> { |
|
|
|
|
|
|
|
|
|
|
|
//set data in spinner |
|
|
listOfTitle = getCodeResponse.Response.GetCodesList |
|
|
listOfTitle = getCodeResponse.Response.GetCodesList |
|
|
if (listOfTitle.isNotEmpty()) { |
|
|
if (listOfTitle.isNotEmpty()) { |
|
|
val adapter = ArrayAdapter( |
|
|
val adapter = ArrayAdapter( |
|
@ -717,17 +722,45 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
) |
|
|
) |
|
|
binding.spTitle.setAdapter(adapter) |
|
|
binding.spTitle.setAdapter(adapter) |
|
|
|
|
|
|
|
|
if ((activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.Client_Title.isNullOrEmpty()) { |
|
|
|
|
|
|
|
|
val titleText=(activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.Client_Title |
|
|
|
|
|
val newTitleText= "$titleText." |
|
|
|
|
|
if (titleText.isNullOrEmpty()) { |
|
|
binding.spTitle.setText( |
|
|
binding.spTitle.setText( |
|
|
adapter.getItem(0)?.Value, |
|
|
adapter.getItem(0)?.Value, |
|
|
false |
|
|
false |
|
|
) |
|
|
) |
|
|
} else { |
|
|
|
|
|
listOfTitle.filter { |
|
|
|
|
|
it.Value == (activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.Client_Title |
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
for (title in listOfTitle) { |
|
|
|
|
|
|
|
|
|
|
|
if (title.Value ==newTitleText) |
|
|
|
|
|
{ |
|
|
|
|
|
binding.spTitle.setText(title.Value,false) |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
binding.spTitle.setOnTouchListener { v, event -> |
|
|
|
|
|
when (event?.action) { |
|
|
|
|
|
MotionEvent.ACTION_DOWN -> { |
|
|
|
|
|
binding.spTitle.setText( |
|
|
|
|
|
adapter.getItem(0)?.Value, |
|
|
|
|
|
false |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
v?.onTouchEvent(event) ?: true |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
binding.spNomineeTitle.setAdapter(adapter) |
|
|
binding.spNomineeTitle.setAdapter(adapter) |
|
|
binding.spNomineeTitle.setText( |
|
|
binding.spNomineeTitle.setText( |
|
|
adapter.getItem(0)?.Value, |
|
|
adapter.getItem(0)?.Value, |
|
|