|
@ -52,9 +52,9 @@ import com.nivesh.production.partnerOnBoarding.ui.activities.SignUpActivity |
|
|
import com.nivesh.production.partnerOnBoarding.util.* |
|
|
import com.nivesh.production.partnerOnBoarding.util.* |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.getFileExtension |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.getFileExtension |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.isValidIndividualPan |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.isValidIndividualPan |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.isValidPan |
|
|
|
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.showDialogValidation |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.showDialogValidation |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.showDialogWithTwoButtons |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.showDialogWithTwoButtons |
|
|
|
|
|
import com.nivesh.production.partnerOnBoarding.util.Constants.Companion.maxFileSize |
|
|
import com.nivesh.production.partnerOnBoarding.viewModels.OnBoardingViewModel |
|
|
import com.nivesh.production.partnerOnBoarding.viewModels.OnBoardingViewModel |
|
|
import okhttp3.MediaType.Companion.toMediaType |
|
|
import okhttp3.MediaType.Companion.toMediaType |
|
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull |
|
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull |
|
@ -65,7 +65,6 @@ import okhttp3.RequestBody.Companion.toRequestBody |
|
|
import org.json.JSONObject |
|
|
import org.json.JSONObject |
|
|
import java.io.* |
|
|
import java.io.* |
|
|
import java.util.* |
|
|
import java.util.* |
|
|
import kotlin.collections.ArrayList |
|
|
|
|
|
|
|
|
|
|
|
class GetStartedFragment : BaseFragment() { |
|
|
class GetStartedFragment : BaseFragment() { |
|
|
private var _binding: FragmentGetStartedBinding? = null |
|
|
private var _binding: FragmentGetStartedBinding? = null |
|
@ -78,35 +77,18 @@ class GetStartedFragment : BaseFragment() { |
|
|
private val mainPANUpload: Int = 1 |
|
|
private val mainPANUpload: Int = 1 |
|
|
private val mainARNPhotoUpload: Int = 2 |
|
|
private val mainARNPhotoUpload: Int = 2 |
|
|
private val mainEUINPhotoUpload: Int = 3 |
|
|
private val mainEUINPhotoUpload: Int = 3 |
|
|
private val secondDocUpload: Int = 4 |
|
|
|
|
|
private var actionType: Int = -1 |
|
|
private var actionType: Int = -1 |
|
|
|
|
|
|
|
|
private var panString: String = "" |
|
|
private var panString: String = "" |
|
|
private var docString: String = "" |
|
|
|
|
|
private var docString2: String = "" |
|
|
|
|
|
private var panFileExt: String? = "" |
|
|
private var panFileExt: String? = "" |
|
|
private var photoFileExt: String? = "" |
|
|
|
|
|
private var doc1FileExt: String? = "" |
|
|
|
|
|
private var doc2fileExt: String? = "" |
|
|
|
|
|
private var docValue: String = "" |
|
|
private var docValue: String = "" |
|
|
private var uploadPosition = 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private var isFront: Boolean = false |
|
|
private var isFront: Boolean = false |
|
|
private var preSelectedDate = "" |
|
|
|
|
|
private var preSelectedDate2 = "" |
|
|
|
|
|
var year = 0 |
|
|
|
|
|
var month = 0 |
|
|
|
|
|
var day = 0 |
|
|
|
|
|
private var cal = Calendar.getInstance() |
|
|
|
|
|
lateinit var viewModel: OnBoardingViewModel |
|
|
|
|
|
|
|
|
private lateinit var viewModel: OnBoardingViewModel |
|
|
private lateinit var listOfDocType: List<Data> |
|
|
private lateinit var listOfDocType: List<Data> |
|
|
private var imageSelectedList = ArrayList<File>() |
|
|
private var imageSelectedList = ArrayList<File>() |
|
|
private var imageSelectedARNOrEUIN = kotlin.collections.ArrayList<File>() |
|
|
|
|
|
private var arnList = ArrayList<DataX>() |
|
|
private var arnList = ArrayList<DataX>() |
|
|
private lateinit var arnData: DataX |
|
|
private lateinit var arnData: DataX |
|
|
private lateinit var panRes: PANResponse |
|
|
private lateinit var panRes: PANResponse |
|
|
private val MaxFileSize = 5 |
|
|
|
|
|
|
|
|
|
|
|
private val permissions = arrayOf( |
|
|
private val permissions = arrayOf( |
|
|
Manifest.permission.READ_EXTERNAL_STORAGE, |
|
|
Manifest.permission.READ_EXTERNAL_STORAGE, |
|
@ -129,18 +111,8 @@ class GetStartedFragment : BaseFragment() { |
|
|
|
|
|
|
|
|
private val requestGalleryPermission = registerForActivityResult( |
|
|
private val requestGalleryPermission = registerForActivityResult( |
|
|
ActivityResultContracts.RequestMultiplePermissions() |
|
|
ActivityResultContracts.RequestMultiplePermissions() |
|
|
) { permission -> |
|
|
|
|
|
// if (!permission.containsValue(false)) { |
|
|
|
|
|
|
|
|
) { |
|
|
selectImageIntent?.launch("image/*") |
|
|
selectImageIntent?.launch("image/*") |
|
|
// } else { |
|
|
|
|
|
// showDialogWithTwoButtons( |
|
|
|
|
|
// (activity as SignUpActivity), |
|
|
|
|
|
// getString(R.string.galleryPermission), |
|
|
|
|
|
// getString( |
|
|
|
|
|
// R.string.permissionsRequired |
|
|
|
|
|
// ) |
|
|
|
|
|
// ) |
|
|
|
|
|
// } |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
override fun onCreateView( |
|
|
override fun onCreateView( |
|
@ -148,7 +120,6 @@ class GetStartedFragment : BaseFragment() { |
|
|
container: ViewGroup?, |
|
|
container: ViewGroup?, |
|
|
savedInstanceState: Bundle? |
|
|
savedInstanceState: Bundle? |
|
|
): View { |
|
|
): View { |
|
|
// Inflate the layout for this fragment |
|
|
|
|
|
_binding = FragmentGetStartedBinding.inflate(inflater, container, false) |
|
|
_binding = FragmentGetStartedBinding.inflate(inflater, container, false) |
|
|
return binding.root |
|
|
return binding.root |
|
|
} |
|
|
} |
|
@ -172,23 +143,6 @@ class GetStartedFragment : BaseFragment() { |
|
|
return null |
|
|
return null |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private fun isInputCorrect( |
|
|
|
|
|
s: Editable, |
|
|
|
|
|
totalSymbols: Int, |
|
|
|
|
|
dividerModulo: Int, |
|
|
|
|
|
divider: Char |
|
|
|
|
|
): Boolean { |
|
|
|
|
|
var isCorrect = s.length <= totalSymbols // check size of entered string |
|
|
|
|
|
for (i in s.indices) { // check that every element is right |
|
|
|
|
|
isCorrect = if (i > 0 && (i + 1) % dividerModulo == 0) { |
|
|
|
|
|
isCorrect and (divider == s[i]) |
|
|
|
|
|
} else { |
|
|
|
|
|
isCorrect and Character.isDigit(s[i]) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return isCorrect |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@SuppressLint("SuspiciousIndentation") |
|
|
@SuppressLint("SuspiciousIndentation") |
|
|
private fun init() { |
|
|
private fun init() { |
|
|
viewModel = ViewModelProvider( |
|
|
viewModel = ViewModelProvider( |
|
@ -198,31 +152,10 @@ class GetStartedFragment : BaseFragment() { |
|
|
|
|
|
|
|
|
var docType = "I" |
|
|
var docType = "I" |
|
|
if (arguments?.getString("arnType").equals("Associate", true)) { |
|
|
if (arguments?.getString("arnType").equals("Associate", true)) { |
|
|
binding.edtArnNumber.visibility = View.GONE |
|
|
|
|
|
binding.tlArnNumber.visibility = View.GONE |
|
|
|
|
|
|
|
|
|
|
|
binding.edtEUINNumber.visibility = View.GONE |
|
|
|
|
|
binding.tlArnNumber.visibility = View.GONE |
|
|
|
|
|
|
|
|
|
|
|
binding.edtPassingAMFI.visibility = View.GONE |
|
|
|
|
|
binding.tlPassingAMFI.visibility = View.GONE |
|
|
|
|
|
|
|
|
|
|
|
binding.edtExpiryAMFI.visibility = View.GONE |
|
|
|
|
|
binding.tlExpiryAMFI.visibility = View.GONE |
|
|
|
|
|
|
|
|
commonMethodForVisibility(View.GONE) |
|
|
docType = "N" |
|
|
docType = "N" |
|
|
|
|
|
|
|
|
} else if (arguments?.getString("arnType").equals("advisory", true)) { |
|
|
} else if (arguments?.getString("arnType").equals("advisory", true)) { |
|
|
binding.edtArnNumber.visibility = View.VISIBLE |
|
|
|
|
|
binding.tlArnNumber.visibility = View.VISIBLE |
|
|
|
|
|
|
|
|
|
|
|
binding.edtEUINNumber.visibility = View.VISIBLE |
|
|
|
|
|
binding.tlArnNumber.visibility = View.VISIBLE |
|
|
|
|
|
|
|
|
|
|
|
binding.edtPassingAMFI.visibility = View.VISIBLE |
|
|
|
|
|
binding.tlPassingAMFI.visibility = View.VISIBLE |
|
|
|
|
|
|
|
|
|
|
|
binding.edtExpiryAMFI.visibility = View.VISIBLE |
|
|
|
|
|
binding.tlExpiryAMFI.visibility = View.VISIBLE |
|
|
|
|
|
|
|
|
commonMethodForVisibility(View.VISIBLE) |
|
|
docType = "I" |
|
|
docType = "I" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -294,7 +227,6 @@ class GetStartedFragment : BaseFragment() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
binding.btnNext.setOnClickListener { |
|
|
binding.btnNext.setOnClickListener { |
|
|
// apiUploadDocument() |
|
|
|
|
|
if (arguments?.getString("arnType").equals("Associate", false)) { |
|
|
if (arguments?.getString("arnType").equals("Associate", false)) { |
|
|
val pt = PartnerRequest() |
|
|
val pt = PartnerRequest() |
|
|
pt.Name = binding.edtFullNamePanCard.text.toString() |
|
|
pt.Name = binding.edtFullNamePanCard.text.toString() |
|
@ -302,9 +234,9 @@ class GetStartedFragment : BaseFragment() { |
|
|
|
|
|
|
|
|
val fragment = AlmostThereFragment() |
|
|
val fragment = AlmostThereFragment() |
|
|
val bundle = Bundle() |
|
|
val bundle = Bundle() |
|
|
bundle.putSerializable("Inputvalue", pt) |
|
|
|
|
|
|
|
|
bundle.putSerializable("InputValue", pt) |
|
|
bundle.putSerializable("arnData", arnData) |
|
|
bundle.putSerializable("arnData", arnData) |
|
|
bundle.putSerializable("PANDATA", panRes) |
|
|
|
|
|
|
|
|
bundle.putSerializable("panData", panRes) |
|
|
bundle.putString("mobile", arguments?.getString("mobile")) |
|
|
bundle.putString("mobile", arguments?.getString("mobile")) |
|
|
fragment.arguments = bundle |
|
|
fragment.arguments = bundle |
|
|
|
|
|
|
|
@ -328,9 +260,9 @@ class GetStartedFragment : BaseFragment() { |
|
|
|
|
|
|
|
|
val fragment = AlmostThereFragment() |
|
|
val fragment = AlmostThereFragment() |
|
|
val bundle = Bundle() |
|
|
val bundle = Bundle() |
|
|
bundle.putSerializable("Inputvalue", pt) |
|
|
|
|
|
|
|
|
bundle.putSerializable("InputValue", pt) |
|
|
bundle.putSerializable("arnData", arnData) |
|
|
bundle.putSerializable("arnData", arnData) |
|
|
bundle.putSerializable("PANDATA", panRes) |
|
|
|
|
|
|
|
|
bundle.putSerializable("panData", panRes) |
|
|
bundle.putString("mobile", arguments?.getString("mobile")) |
|
|
bundle.putString("mobile", arguments?.getString("mobile")) |
|
|
fragment.arguments = bundle |
|
|
fragment.arguments = bundle |
|
|
|
|
|
|
|
@ -397,12 +329,12 @@ class GetStartedFragment : BaseFragment() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
binding.rlARNUpload.setOnClickListener{ |
|
|
|
|
|
|
|
|
binding.rlARNUpload.setOnClickListener { |
|
|
actionType = mainARNPhotoUpload |
|
|
actionType = mainARNPhotoUpload |
|
|
selectImage() |
|
|
|
|
|
|
|
|
selectImage() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
binding.rlEUINUpload.setOnClickListener{ |
|
|
|
|
|
|
|
|
binding.rlEUINUpload.setOnClickListener { |
|
|
actionType = mainEUINPhotoUpload |
|
|
actionType = mainEUINPhotoUpload |
|
|
selectImage() |
|
|
selectImage() |
|
|
} |
|
|
} |
|
@ -410,15 +342,17 @@ class GetStartedFragment : BaseFragment() { |
|
|
binding.edtPanNumber.addTextChangedListener(object : TextWatcher { |
|
|
binding.edtPanNumber.addTextChangedListener(object : TextWatcher { |
|
|
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { |
|
|
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { |
|
|
Common.removeError(binding.tlPanNumber) |
|
|
Common.removeError(binding.tlPanNumber) |
|
|
if(s.toString().length > 3 && s.toString()[3] != 'P'){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isValidIndividualPan(s.toString().trim())) { |
|
|
|
|
|
binding.rlEUINUpload.visibility = View.GONE |
|
|
|
|
|
} else { |
|
|
binding.rlEUINUpload.visibility = View.VISIBLE |
|
|
binding.rlEUINUpload.visibility = View.VISIBLE |
|
|
if(!TextUtils.isEmpty(binding.edtEUINNumber.text)){ |
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(binding.edtEUINNumber.text)) { |
|
|
binding.edtEUINNumberNF.setText(binding.edtEUINNumber.text.toString()) |
|
|
binding.edtEUINNumberNF.setText(binding.edtEUINNumber.text.toString()) |
|
|
binding.edtEUINNumber.visibility = View.GONE |
|
|
binding.edtEUINNumber.visibility = View.GONE |
|
|
} |
|
|
} |
|
|
}else if(s.toString().length > 3 && s.toString()[3] == 'P'){ |
|
|
|
|
|
binding.rlEUINUpload.visibility = View.GONE |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (s.toString().trim().length >= 10 && !isPanVerify) { |
|
|
if (s.toString().trim().length >= 10 && !isPanVerify) { |
|
|
apiPANVerify(s.toString().trim()) |
|
|
apiPANVerify(s.toString().trim()) |
|
|
} else if (s.toString().trim().length < 10 && !isPanVerify) { |
|
|
} else if (s.toString().trim().length < 10 && !isPanVerify) { |
|
@ -429,7 +363,7 @@ class GetStartedFragment : BaseFragment() { |
|
|
0 |
|
|
0 |
|
|
) |
|
|
) |
|
|
binding.edtFullNamePanCard.setText("") |
|
|
binding.edtFullNamePanCard.setText("") |
|
|
}else if(s.toString().length < 10){ |
|
|
|
|
|
|
|
|
} else if (s.toString().length < 10) { |
|
|
isPanVerify = false |
|
|
isPanVerify = false |
|
|
binding.edtPanNumber.setCompoundDrawablesWithIntrinsicBounds( |
|
|
binding.edtPanNumber.setCompoundDrawablesWithIntrinsicBounds( |
|
|
0, |
|
|
0, |
|
@ -437,8 +371,7 @@ class GetStartedFragment : BaseFragment() { |
|
|
0, |
|
|
0, |
|
|
0 |
|
|
0 |
|
|
) |
|
|
) |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
} else { |
|
|
binding.edtPanNumber.setCompoundDrawablesWithIntrinsicBounds( |
|
|
binding.edtPanNumber.setCompoundDrawablesWithIntrinsicBounds( |
|
|
0, |
|
|
0, |
|
|
0, |
|
|
0, |
|
@ -461,6 +394,17 @@ class GetStartedFragment : BaseFragment() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun commonMethodForVisibility(visibility: Int) { |
|
|
|
|
|
binding.edtArnNumber.visibility = visibility |
|
|
|
|
|
binding.tlArnNumber.visibility = visibility |
|
|
|
|
|
binding.edtEUINNumber.visibility = visibility |
|
|
|
|
|
binding.tlArnNumber.visibility = visibility |
|
|
|
|
|
binding.edtPassingAMFI.visibility = visibility |
|
|
|
|
|
binding.tlPassingAMFI.visibility = visibility |
|
|
|
|
|
binding.edtExpiryAMFI.visibility = visibility |
|
|
|
|
|
binding.tlExpiryAMFI.visibility = visibility |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private fun documentTypeAPI(docType: String) { |
|
|
private fun documentTypeAPI(docType: String) { |
|
|
try { |
|
|
try { |
|
|
ProgressUtil.showLoading(activity as SignUpActivity) |
|
|
ProgressUtil.showLoading(activity as SignUpActivity) |
|
@ -481,7 +425,7 @@ class GetStartedFragment : BaseFragment() { |
|
|
DocumentTypeResponse::class.java |
|
|
DocumentTypeResponse::class.java |
|
|
) |
|
|
) |
|
|
Log.e("checkDocRes", res.toString()) |
|
|
Log.e("checkDocRes", res.toString()) |
|
|
if (res.Status == "success") { |
|
|
|
|
|
|
|
|
if (res.Status == getString(R.string.successText)) { |
|
|
listOfDocType = res.Result.Data |
|
|
listOfDocType = res.Result.Data |
|
|
if (listOfDocType.isNotEmpty()) { |
|
|
if (listOfDocType.isNotEmpty()) { |
|
|
val adapter = ArrayAdapter( |
|
|
val adapter = ArrayAdapter( |
|
@ -492,68 +436,14 @@ class GetStartedFragment : BaseFragment() { |
|
|
binding.spDocType.setAdapter(adapter) |
|
|
binding.spDocType.setAdapter(adapter) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
//TODO: Check AMFI Data Available or not |
|
|
|
|
|
apiAMFIDetail("Mobile", arguments?.getString("mobile")) |
|
|
apiAMFIDetail("Mobile", arguments?.getString("mobile")) |
|
|
// apiAMFIDetail("Mobile", "1722651388") |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} catch (e: Exception) { |
|
|
} catch (e: Exception) { |
|
|
// ProgressUtil.hideLoading() |
|
|
|
|
|
Log.e("checkPANError", e.message.toString()) |
|
|
Log.e("checkPANError", e.message.toString()) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private fun prepareImagePart(file: File, partName: String): MultipartBody.Part { |
|
|
|
|
|
var requestBody: RequestBody = |
|
|
|
|
|
file.asRequestBody("application/octet-stream".toMediaTypeOrNull()) |
|
|
|
|
|
return MultipartBody.Part.createFormData( |
|
|
|
|
|
"Files", |
|
|
|
|
|
partName, |
|
|
|
|
|
requestBody |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun apiUploadDocument() { |
|
|
|
|
|
|
|
|
|
|
|
if (imageSelectedList != null && imageSelectedList.size != 0) { |
|
|
|
|
|
|
|
|
|
|
|
var part = ArrayList<MultipartBody.Part>() |
|
|
|
|
|
|
|
|
|
|
|
imageSelectedList.forEachIndexed { index, element -> |
|
|
|
|
|
|
|
|
|
|
|
if (index == 0) { |
|
|
|
|
|
part.add(prepareImagePart(element, "front")) |
|
|
|
|
|
} else { |
|
|
|
|
|
part.add(prepareImagePart(element, "back")) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentUpload( |
|
|
|
|
|
part, |
|
|
|
|
|
3, |
|
|
|
|
|
5, |
|
|
|
|
|
8, |
|
|
|
|
|
(activity as SignUpActivity) |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentUploadMutableData.observe( |
|
|
|
|
|
viewLifecycleOwner |
|
|
|
|
|
) { response -> |
|
|
|
|
|
Log.e("check_upload_res", response.toString()) |
|
|
|
|
|
val res: DocumentUploadResponse = |
|
|
|
|
|
Gson().fromJson( |
|
|
|
|
|
response?.data.toString(), |
|
|
|
|
|
DocumentUploadResponse::class.java |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
if (res.Status == "success") { |
|
|
|
|
|
Toast.makeText(activity as SignUpActivity, res.Message, Toast.LENGTH_LONG) |
|
|
|
|
|
.show() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun apiPANVerify(pan: String) { |
|
|
private fun apiPANVerify(pan: String) { |
|
|
try { |
|
|
try { |
|
|
ProgressUtil.showLoading(activity as SignUpActivity) |
|
|
ProgressUtil.showLoading(activity as SignUpActivity) |
|
@ -599,9 +489,9 @@ class GetStartedFragment : BaseFragment() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private fun apiAMFIDetail(type: String, value: String?) { |
|
|
private fun apiAMFIDetail(type: String, value: String?) { |
|
|
var jsonObject = JSONObject() |
|
|
|
|
|
|
|
|
val jsonObject = JSONObject() |
|
|
val mediaType = "application/json; charset=utf-8".toMediaType() |
|
|
val mediaType = "application/json; charset=utf-8".toMediaType() |
|
|
var body: RequestBody |
|
|
|
|
|
|
|
|
val body: RequestBody |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
jsonObject.put(type, value) |
|
|
jsonObject.put(type, value) |
|
@ -621,12 +511,11 @@ class GetStartedFragment : BaseFragment() { |
|
|
response?.data.toString(), |
|
|
response?.data.toString(), |
|
|
GetAMFIDetailResponse::class.java |
|
|
GetAMFIDetailResponse::class.java |
|
|
) |
|
|
) |
|
|
//TODO: Need to set up Data if not null |
|
|
|
|
|
if (res != null && res.Result.data != null) { |
|
|
if (res != null && res.Result.data != null) { |
|
|
arnList.clear() |
|
|
arnList.clear() |
|
|
arnList = res.Result.data as ArrayList<DataX> |
|
|
arnList = res.Result.data as ArrayList<DataX> |
|
|
|
|
|
|
|
|
if (res.Status == "success") { |
|
|
|
|
|
|
|
|
if (res.Status == getString(R.string.successText)) { |
|
|
if (type == "ARN") { |
|
|
if (type == "ARN") { |
|
|
if (arnList.size > 0) { |
|
|
if (arnList.size > 0) { |
|
|
arnData = arnList[0] |
|
|
arnData = arnList[0] |
|
@ -640,17 +529,17 @@ class GetStartedFragment : BaseFragment() { |
|
|
binding.edtExpiryAMFI.setText(arnData.ARNValidTill) |
|
|
binding.edtExpiryAMFI.setText(arnData.ARNValidTill) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
setARNEUIN(View.GONE) |
|
|
|
|
|
|
|
|
setArnUploadVisibility(View.GONE) |
|
|
} else { |
|
|
} else { |
|
|
var adapter = ArrayAdapter( |
|
|
|
|
|
|
|
|
val adapter = ArrayAdapter( |
|
|
(activity as SignUpActivity), |
|
|
(activity as SignUpActivity), |
|
|
androidx.appcompat.R.layout.support_simple_spinner_dropdown_item, |
|
|
androidx.appcompat.R.layout.support_simple_spinner_dropdown_item, |
|
|
arnList |
|
|
arnList |
|
|
) |
|
|
) |
|
|
binding.edtArnNumber.setAdapter(adapter) |
|
|
binding.edtArnNumber.setAdapter(adapter) |
|
|
} |
|
|
} |
|
|
}else if(type == "ARN" && binding.edtArnNumber.text.length >= 7){ |
|
|
|
|
|
setARNEUIN(View.VISIBLE) |
|
|
|
|
|
|
|
|
} else if (type == "ARN" && binding.edtArnNumber.text.length >= 7) { |
|
|
|
|
|
setArnUploadVisibility(View.VISIBLE) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -660,11 +549,8 @@ class GetStartedFragment : BaseFragment() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private fun setARNEUIN(visibility: Int) { |
|
|
|
|
|
|
|
|
private fun setArnUploadVisibility(visibility: Int) { |
|
|
binding.rlARNUpload.visibility = visibility |
|
|
binding.rlARNUpload.visibility = visibility |
|
|
// binding.rlEUINUpload.visibility = visibility |
|
|
|
|
|
// if(visibility==View.VISIBLE) binding.tlEUINNumber.visibility = View.GONE |
|
|
|
|
|
// else binding.tlEUINNumber.visibility = View.VISIBLE |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private fun commonErrorMethod( |
|
|
private fun commonErrorMethod( |
|
@ -735,10 +621,6 @@ class GetStartedFragment : BaseFragment() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private fun setUploadOption(checked: Boolean) { |
|
|
|
|
|
isFront = checked |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun selectImage() { |
|
|
private fun selectImage() { |
|
|
val builder = AlertDialog.Builder( |
|
|
val builder = AlertDialog.Builder( |
|
|
activity as SignUpActivity |
|
|
activity as SignUpActivity |
|
@ -821,7 +703,7 @@ class GetStartedFragment : BaseFragment() { |
|
|
|
|
|
|
|
|
private fun setVisibility(s: String) { |
|
|
private fun setVisibility(s: String) { |
|
|
binding.llDoc.visibility = View.VISIBLE |
|
|
binding.llDoc.visibility = View.VISIBLE |
|
|
if (s.contains("Aadhaar")) { |
|
|
|
|
|
|
|
|
if (s.contains(getString(R.string.aadhaarText))) { |
|
|
binding.txtFront.visibility = View.VISIBLE |
|
|
binding.txtFront.visibility = View.VISIBLE |
|
|
binding.uploadFront.visibility = View.VISIBLE |
|
|
binding.uploadFront.visibility = View.VISIBLE |
|
|
binding.txtBack.visibility = View.VISIBLE |
|
|
binding.txtBack.visibility = View.VISIBLE |
|
@ -920,7 +802,7 @@ class GetStartedFragment : BaseFragment() { |
|
|
val size: Double = Common.getFileSizeInMB(fileExtension.length()) |
|
|
val size: Double = Common.getFileSizeInMB(fileExtension.length()) |
|
|
|
|
|
|
|
|
setFrontHideVisible(uri) |
|
|
setFrontHideVisible(uri) |
|
|
if (size < MaxFileSize) { |
|
|
|
|
|
|
|
|
if (size < maxFileSize) { |
|
|
if (type == "c") { |
|
|
if (type == "c") { |
|
|
encodedPANBase64(fileExtension) |
|
|
encodedPANBase64(fileExtension) |
|
|
if (isFront) imageSelectedList.add(0, fileExtension) |
|
|
if (isFront) imageSelectedList.add(0, fileExtension) |
|
@ -946,10 +828,10 @@ class GetStartedFragment : BaseFragment() { |
|
|
} else { |
|
|
} else { |
|
|
panString = "" |
|
|
panString = "" |
|
|
panFileExt = "" |
|
|
panFileExt = "" |
|
|
showDialogValidation(activity,getString(R.string.fileSizeCant)) |
|
|
|
|
|
|
|
|
showDialogValidation(activity, getString(R.string.fileSizeCant)) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
mainARNPhotoUpload ->{ |
|
|
|
|
|
|
|
|
mainARNPhotoUpload -> { |
|
|
val fileDir: File = (activity as SignUpActivity).cacheDir |
|
|
val fileDir: File = (activity as SignUpActivity).cacheDir |
|
|
val fileExtension = File(fileDir.toString().plus("/").plus(getFileName(uri))) |
|
|
val fileExtension = File(fileDir.toString().plus("/").plus(getFileName(uri))) |
|
|
panFileExt = getFileExtension(getFileName(uri)) |
|
|
panFileExt = getFileExtension(getFileName(uri)) |
|
@ -957,12 +839,10 @@ class GetStartedFragment : BaseFragment() { |
|
|
|
|
|
|
|
|
binding.ivARNUpload.setImageURI(uri) |
|
|
binding.ivARNUpload.setImageURI(uri) |
|
|
|
|
|
|
|
|
if (size < MaxFileSize) { |
|
|
|
|
|
|
|
|
if (size < maxFileSize) { |
|
|
if (type == "c") { |
|
|
if (type == "c") { |
|
|
encodedPANBase64(fileExtension) |
|
|
encodedPANBase64(fileExtension) |
|
|
// imageSelectedARNOrEUIN.add(0,fileExtension) |
|
|
|
|
|
imageSelectedARNOrEUIN.add(0,fileExtension) |
|
|
|
|
|
binding.tvUploadARN.visibility = View.GONE |
|
|
|
|
|
|
|
|
imageSelectedList.add(2, fileExtension) |
|
|
} else { |
|
|
} else { |
|
|
val bitmap: Bitmap = |
|
|
val bitmap: Bitmap = |
|
|
MediaStore.Images.Media.getBitmap(context?.contentResolver, uri) |
|
|
MediaStore.Images.Media.getBitmap(context?.contentResolver, uri) |
|
@ -977,18 +857,16 @@ class GetStartedFragment : BaseFragment() { |
|
|
fOut.close() |
|
|
fOut.close() |
|
|
|
|
|
|
|
|
if (file.exists()) encodedPANBase64(file) |
|
|
if (file.exists()) encodedPANBase64(file) |
|
|
// imageSelectedList.add(2, file) |
|
|
|
|
|
imageSelectedARNOrEUIN.add(0,file) |
|
|
|
|
|
binding.tvUploadARN.visibility = View.GONE |
|
|
|
|
|
|
|
|
imageSelectedList.add(2, file) |
|
|
Log.e("check_panString", panString + "\n" + bitmap.toString()) |
|
|
Log.e("check_panString", panString + "\n" + bitmap.toString()) |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
panString = "" |
|
|
panString = "" |
|
|
panFileExt = "" |
|
|
panFileExt = "" |
|
|
showDialogValidation(activity,getString(R.string.fileSizeCant)) |
|
|
|
|
|
|
|
|
showDialogValidation(activity, getString(R.string.fileSizeCant)) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
mainEUINPhotoUpload ->{ |
|
|
|
|
|
|
|
|
mainEUINPhotoUpload -> { |
|
|
val fileDir: File = (activity as SignUpActivity).cacheDir |
|
|
val fileDir: File = (activity as SignUpActivity).cacheDir |
|
|
val fileExtension = File(fileDir.toString().plus("/").plus(getFileName(uri))) |
|
|
val fileExtension = File(fileDir.toString().plus("/").plus(getFileName(uri))) |
|
|
panFileExt = getFileExtension(getFileName(uri)) |
|
|
panFileExt = getFileExtension(getFileName(uri)) |
|
@ -996,12 +874,10 @@ class GetStartedFragment : BaseFragment() { |
|
|
|
|
|
|
|
|
binding.ivEUINUpload.setImageURI(uri) |
|
|
binding.ivEUINUpload.setImageURI(uri) |
|
|
|
|
|
|
|
|
if (size < MaxFileSize) { |
|
|
|
|
|
|
|
|
if (size < maxFileSize) { |
|
|
if (type == "c") { |
|
|
if (type == "c") { |
|
|
encodedPANBase64(fileExtension) |
|
|
encodedPANBase64(fileExtension) |
|
|
// imageSelectedList.add(3, fileExtension) |
|
|
|
|
|
imageSelectedARNOrEUIN.add(1,fileExtension) |
|
|
|
|
|
binding.tvUploadEUINTitle.visibility = View.GONE |
|
|
|
|
|
|
|
|
imageSelectedList.add(3, fileExtension) |
|
|
} else { |
|
|
} else { |
|
|
val bitmap: Bitmap = |
|
|
val bitmap: Bitmap = |
|
|
MediaStore.Images.Media.getBitmap(context?.contentResolver, uri) |
|
|
MediaStore.Images.Media.getBitmap(context?.contentResolver, uri) |
|
@ -1016,20 +892,69 @@ class GetStartedFragment : BaseFragment() { |
|
|
fOut.close() |
|
|
fOut.close() |
|
|
|
|
|
|
|
|
if (file.exists()) encodedPANBase64(file) |
|
|
if (file.exists()) encodedPANBase64(file) |
|
|
// imageSelectedList.add(3, file) |
|
|
|
|
|
imageSelectedARNOrEUIN.add(1,file) |
|
|
|
|
|
binding.tvUploadEUINTitle.visibility = View.GONE |
|
|
|
|
|
|
|
|
imageSelectedList.add(3, file) |
|
|
Log.e("check_panString", panString + "\n" + bitmap.toString()) |
|
|
Log.e("check_panString", panString + "\n" + bitmap.toString()) |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
panString = "" |
|
|
panString = "" |
|
|
panFileExt = "" |
|
|
panFileExt = "" |
|
|
showDialogValidation(activity,getString(R.string.fileSizeCant)) |
|
|
|
|
|
|
|
|
showDialogValidation(activity, getString(R.string.fileSizeCant)) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun apiUploadDocument() { |
|
|
|
|
|
|
|
|
|
|
|
if (imageSelectedList != null && imageSelectedList.size != 0) { |
|
|
|
|
|
|
|
|
|
|
|
val part = ArrayList<MultipartBody.Part>() |
|
|
|
|
|
|
|
|
|
|
|
imageSelectedList.forEachIndexed { index, element -> |
|
|
|
|
|
|
|
|
|
|
|
if (index == 0) { |
|
|
|
|
|
part.add(prepareImagePart(element, "front")) |
|
|
|
|
|
} else { |
|
|
|
|
|
part.add(prepareImagePart(element, "back")) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentUpload( |
|
|
|
|
|
part, |
|
|
|
|
|
3, |
|
|
|
|
|
5, |
|
|
|
|
|
8, |
|
|
|
|
|
(activity as SignUpActivity) |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentUploadMutableData.observe( |
|
|
|
|
|
viewLifecycleOwner |
|
|
|
|
|
) { response -> |
|
|
|
|
|
Log.e("check_upload_res", response.toString()) |
|
|
|
|
|
val res: DocumentUploadResponse = |
|
|
|
|
|
Gson().fromJson( |
|
|
|
|
|
response?.data.toString(), |
|
|
|
|
|
DocumentUploadResponse::class.java |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
if (res.Status == getString(R.string.successText)) { |
|
|
|
|
|
Toast.makeText(activity as SignUpActivity, res.Message, Toast.LENGTH_LONG) |
|
|
|
|
|
.show() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun prepareImagePart(file: File, partName: String): MultipartBody.Part { |
|
|
|
|
|
val requestBody: RequestBody = |
|
|
|
|
|
file.asRequestBody("application/octet-stream".toMediaTypeOrNull()) |
|
|
|
|
|
return MultipartBody.Part.createFormData( |
|
|
|
|
|
"Files", |
|
|
|
|
|
partName, |
|
|
|
|
|
requestBody |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private fun setFrontHideVisible(uri: Uri) { |
|
|
private fun setFrontHideVisible(uri: Uri) { |
|
|
if (isFront) { |
|
|
if (isFront) { |
|
|
binding.uploadFront.visibility = View.GONE |
|
|
binding.uploadFront.visibility = View.GONE |
|
|