Author | SHA1 | Message | Date |
---|---|---|---|
|
630b233ac7 | added modification in code | 2 years ago |
|
8dd2952201 | POB API | 2 years ago |
|
ad19100c2b | gradle changes | 2 years ago |
|
39ce0a10e0 | resolved gradle setting issue | 2 years ago |
@ -1,32 +0,0 @@ | |||
package com.nivesh.production.partnerOnBoarding.api | |||
import com.nivesh.production.partnerOnBoarding.util.Resource | |||
import retrofit2.Call | |||
import retrofit2.Callback | |||
import retrofit2.Response | |||
abstract class ApiCallback<T : Any> : Callback<Resource<T>> { | |||
abstract fun onSuccess(response: Resource<T>) | |||
abstract fun onFailure(response: Resource<T>) | |||
override fun onResponse(call: Call<Resource<T>>, response: Response<Resource<T>>) { | |||
if (response.isSuccessful && response.body() != null && response.code() == 200) { | |||
onSuccess(response.body()!!) | |||
} else if (response.code() == 650){ | |||
// handle 4xx & 5xx error codes here | |||
// val resp = Resource<T>() | |||
// resp.status = false | |||
// resp.message = response.message() | |||
// onFailure(resp) | |||
} | |||
} | |||
override fun onFailure(call: Call<Resource<T>>, t: Throwable) { | |||
// val response = Resource<T>() | |||
// response.status = false | |||
// response.message = t.message.toString() | |||
// onFailure(response) | |||
} | |||
} |
@ -0,0 +1,18 @@ | |||
package com.nivesh.production.partnerOnBoarding.model | |||
data class Data( | |||
val Address1: String, | |||
val Address2: String, | |||
val Address3: String, | |||
val Category: String, | |||
val City: String, | |||
val DOB: String, | |||
val FirstName: String, | |||
val FullName: String, | |||
val Gender: String, | |||
val LastName: String, | |||
val MiddleName: Any, | |||
val Pincode: String, | |||
val State: String, | |||
val Street: String | |||
) |
@ -0,0 +1,19 @@ | |||
package com.nivesh.production.partnerOnBoarding.model | |||
import java.io.Serializable | |||
data class DataX( | |||
val ARN: String = "", | |||
val ARNValidFrom: String, | |||
val ARNValidTill: String, | |||
val Address: String, | |||
val City: String, | |||
val State: String, | |||
val EUIN: String, | |||
val FullName: String, | |||
val Pincode: String | |||
) : Serializable { | |||
override fun toString(): String { | |||
return ARN | |||
} | |||
} |
@ -0,0 +1,6 @@ | |||
package com.nivesh.production.partnerOnBoarding.model | |||
data class Error( | |||
val ErrorCode: Int, | |||
val ErrorMessage: String | |||
) |
@ -0,0 +1,6 @@ | |||
package com.nivesh.production.partnerOnBoarding.model | |||
data class Result( | |||
val Errors: List<Error>, | |||
val PartnerCode: String | |||
) |
@ -0,0 +1,6 @@ | |||
package com.nivesh.production.partnerOnBoarding.model | |||
data class ResultX( | |||
val IsPartialRegistered: Boolean, | |||
val PartnerCode: String | |||
) |
@ -0,0 +1,5 @@ | |||
package com.nivesh.production.partnerOnBoarding.model | |||
data class ResultXX( | |||
val Errors: List<Error> | |||
) |
@ -0,0 +1,24 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.request | |||
import java.io.Serializable | |||
data class PartnerRequest( | |||
var ARNNumber: String = "", | |||
var Address1: String = "", | |||
var Address2: String = "", | |||
var City: String = "", | |||
var DateOfExpiryAMFICertificate: Any? = null, | |||
var DateOfIncorporation: String = "", | |||
var DateOfPassingAMFICertificate: Any? = null, | |||
var EUINNumber: String = "", | |||
var Email: String = "", | |||
var InterestedProductId: List<Any> = emptyList(), | |||
var Mobile: String = "", | |||
var Name: String = "", | |||
var OtherProductName: String = "", | |||
var PAN: String = "", | |||
var PartnerCode: String = "", | |||
var PartnerType: String = "", | |||
var Pin: String = "", | |||
var State: String = "" | |||
) : Serializable |
@ -0,0 +1,8 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.request | |||
data class SaveEAgreementRequest( | |||
var FinancialYear: String = "", | |||
var OTP: Int = 0, | |||
var OTPGenerationDate: String = "", | |||
var SubBrokerCode: String = "" | |||
) |
@ -0,0 +1,13 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.request | |||
data class SendOTPRequest( | |||
var AMCID: String = "", | |||
var CommunicationValue: String = "", | |||
var ExpiryTime: Int = 0, | |||
var Mode: String = "", | |||
var MsgState: String = "", | |||
var Name: String = "", | |||
var ProductId: Int = 0, | |||
var UserId: String = "", | |||
var UserRole: Int = 0 | |||
) |
@ -0,0 +1,5 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.request | |||
data class ValidatePartnerRequest( | |||
var Mobile: String = "" | |||
) |
@ -0,0 +1,10 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
data class Data( | |||
val DocumentId: Int, | |||
val DocumentType: String | |||
) { | |||
override fun toString(): String { | |||
return DocumentType | |||
} | |||
} |
@ -0,0 +1,6 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
data class DataX( | |||
val ProductId: Int, | |||
val ProductName: String | |||
) |
@ -0,0 +1,7 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
data class DocumentTypeResponse( | |||
val Message: String, | |||
val Result: ResultXX, | |||
val Status: String | |||
) |
@ -0,0 +1,9 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
import com.nivesh.production.partnerOnBoarding.model.ResultXX | |||
data class DocumentUploadResponse( | |||
val Message: String, | |||
val Result: ResultXX, | |||
val Status: String | |||
) |
@ -0,0 +1,7 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
data class GetAMFIDetailResponse( | |||
val Message: String, | |||
val Result: ResultX, | |||
val Status: String | |||
) |
@ -0,0 +1,7 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
data class GetAllProductResponse( | |||
val Message: String, | |||
val Result: ResultXXX, | |||
val Status: String | |||
) |
@ -0,0 +1,9 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
import java.io.Serializable | |||
data class PANResponse( | |||
val Message: String, | |||
val Result: Result, | |||
val Status: String | |||
) : Serializable |
@ -0,0 +1,9 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
import com.nivesh.production.partnerOnBoarding.model.Result | |||
data class PartnerResponse( | |||
val Message: String, | |||
val Result: Result, | |||
val Status: String | |||
) |
@ -0,0 +1,8 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
import com.nivesh.production.partnerOnBoarding.model.Data | |||
data class Result( | |||
val Errors: Any, | |||
val `data`: Data | |||
) |
@ -0,0 +1,7 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
import com.nivesh.production.partnerOnBoarding.model.DataX | |||
data class ResultX( | |||
val `data`: List<DataX> | |||
) |
@ -0,0 +1,5 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
data class ResultXX( | |||
val Data: List<Data> | |||
) |
@ -0,0 +1,5 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
data class ResultXXX( | |||
val Data: List<DataX> | |||
) |
@ -0,0 +1,7 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
data class SaveEAgreementResponse( | |||
val Message: String, | |||
val Result: String, | |||
val Status: String | |||
) |
@ -0,0 +1,8 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
data class SendOTPResponse( | |||
val Message: String, | |||
// val Result: com.nivesh.production.partnerOnBoarding.model.response.Result, | |||
val Status: String | |||
) |
@ -0,0 +1,7 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
data class ValidateOTPResponse( | |||
val Message: String, | |||
val Result: Any, | |||
val Status: String | |||
) |
@ -0,0 +1,9 @@ | |||
package com.nivesh.production.partnerOnBoarding.model.response | |||
import com.nivesh.production.partnerOnBoarding.model.ResultX | |||
data class ValidatePartnerResponse( | |||
val Message: String, | |||
val Result: ResultX, | |||
val Status: String | |||
) |
@ -1,15 +1,44 @@ | |||
package com.nivesh.production.partnerOnBoarding.repositories | |||
import com.nivesh.production.partnerOnBoarding.api.ApiInterface | |||
import com.nivesh.production.partnerOnBoarding.model.request.PartnerRequest | |||
import com.nivesh.production.partnerOnBoarding.model.request.SendOTPRequest | |||
import com.nivesh.production.partnerOnBoarding.model.request.ValidatePartnerRequest | |||
import okhttp3.MultipartBody | |||
import okhttp3.RequestBody | |||
class MainRepository constructor(private val apiInterface: ApiInterface) { | |||
suspend fun getPartnerCreationResponse(requestBody: PartnerRequest, token: String) = | |||
apiInterface.postPartnerCreation(requestBody) | |||
// MainActivity | |||
// suspend fun getStepsCountResponse(requestBody: FDStepsCountRequest, token: String) = | |||
// apiInterface.getFDStepsCount(requestBody, token) | |||
// | |||
// suspend fun getClientDetailsResponse(getClientDetails: getClientDetailsRequest, token: String) = | |||
// apiInterface.getClientDetails(getClientDetails, token) | |||
// | |||
suspend fun getValidatePartnerResponse(validatePartnerRequest: ValidatePartnerRequest) = | |||
apiInterface.postPartnerValidate(validatePartnerRequest) | |||
suspend fun getSendOTPResponse(sendOTPRequest: SendOTPRequest) = | |||
apiInterface.postOTP(sendOTPRequest) | |||
suspend fun getSendSaveEAgreementOTPResponse(sendOTPRequest: SendOTPRequest) = | |||
apiInterface.postSaveEagreementOTP(sendOTPRequest) | |||
suspend fun getVerifyOTP(requestBody: RequestBody) = | |||
apiInterface.postVerifyOTP(requestBody) | |||
suspend fun getAMFIDetailResponse(requestBody: RequestBody) = | |||
apiInterface.postAMFIDetail(requestBody) | |||
suspend fun getPANDetailResponse(url: String,value: String) = | |||
apiInterface.getPANDetail(url,value) | |||
suspend fun getDocumentTypeResponse(url: String,value: String,type: String) = | |||
apiInterface.getDocumentType(url,value,type) | |||
suspend fun getDocumentUploadResponse(multipartBody: List<MultipartBody.Part>,pc: Int,pr: Int,di: Int) = | |||
apiInterface.getUploadDocument(multipartBody,pc,pr,di) | |||
suspend fun getSaveEAgreement(requestBody: RequestBody, token: String) = | |||
apiInterface.postSaveEAgreement(requestBody) | |||
suspend fun getAllProduct(url: String) = | |||
apiInterface.getAllProduct(url) | |||
} |
@ -0,0 +1,37 @@ | |||
package com.nivesh.production.partnerOnBoarding.ui.fragments | |||
import android.os.Bundle | |||
import android.view.LayoutInflater | |||
import android.view.View | |||
import android.view.ViewGroup | |||
import com.nivesh.production.partnerOnBoarding.R | |||
import com.nivesh.production.partnerOnBoarding.databinding.FragmentQuestionBinding | |||
import com.nivesh.production.partnerOnBoarding.ui.activities.SignUpActivity | |||
class QuestionsFragment : BaseFragment() { | |||
private var _binding: FragmentQuestionBinding? = null | |||
private val binding get() = _binding!! | |||
override fun onCreateView( | |||
inflater: LayoutInflater, | |||
container: ViewGroup?, | |||
savedInstanceState: Bundle? | |||
): View { | |||
_binding = FragmentQuestionBinding.inflate(inflater,container,false) | |||
return binding.root | |||
} | |||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |||
super.onViewCreated(view, savedInstanceState) | |||
init() | |||
} | |||
private fun init() { | |||
binding.header.tvHelpCall.visibility = View.VISIBLE | |||
binding.header.tvTitle.text = getString(R.string.questions) | |||
binding.tvMsg.text = getString(R.string.questionsContent)//questionsContent | |||
binding.header.ivBack.setOnClickListener{ | |||
(activity as SignUpActivity).onBackPressedDispatcher.onBackPressed() | |||
} | |||
} | |||
} |
@ -0,0 +1,361 @@ | |||
package com.nivesh.production.partnerOnBoarding.ui.fragments | |||
import android.annotation.SuppressLint | |||
import android.app.AlertDialog | |||
import android.app.Dialog | |||
import android.os.Bundle | |||
import android.text.Editable | |||
import android.text.InputFilter | |||
import android.text.TextWatcher | |||
import android.util.Log | |||
import android.view.* | |||
import android.widget.EditText | |||
import android.widget.TextView | |||
import androidx.appcompat.app.ActionBar | |||
import com.google.android.material.button.MaterialButton | |||
import com.google.android.material.textfield.TextInputEditText | |||
import com.google.android.material.textfield.TextInputLayout | |||
import com.google.gson.Gson | |||
import com.nivesh.production.partnerOnBoarding.R | |||
import com.nivesh.production.partnerOnBoarding.databinding.FragmentSaveEAgreementBinding | |||
import com.nivesh.production.partnerOnBoarding.db.PreferenceManager | |||
import com.nivesh.production.partnerOnBoarding.model.request.SendOTPRequest | |||
import com.nivesh.production.partnerOnBoarding.model.response.SendOTPResponse | |||
import com.nivesh.production.partnerOnBoarding.model.response.ValidateOTPResponse | |||
import com.nivesh.production.partnerOnBoarding.ui.activities.SignUpActivity | |||
import com.nivesh.production.partnerOnBoarding.util.Common | |||
import okhttp3.MediaType.Companion.toMediaType | |||
import okhttp3.RequestBody | |||
import okhttp3.RequestBody.Companion.toRequestBody | |||
import org.json.JSONObject | |||
class SaveEAgreementFragment : BaseFragment() { | |||
private var _binding: FragmentSaveEAgreementBinding? = null | |||
private val binding get() = _binding!! | |||
private lateinit var dialog: Dialog | |||
override fun onCreateView( | |||
inflater: LayoutInflater, | |||
container: ViewGroup?, | |||
savedInstanceState: Bundle? | |||
): View { | |||
_binding = FragmentSaveEAgreementBinding.inflate(inflater, container, false) | |||
return binding.root | |||
} | |||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |||
super.onViewCreated(view, savedInstanceState) | |||
init() | |||
} | |||
@SuppressLint("SetTextI18n") | |||
private fun init() { | |||
binding.header.tvTitle.text = "AGREEMENT" | |||
binding.btnAgree.setOnClickListener { | |||
smsAPI() | |||
} | |||
(activity as SignUpActivity).viewModelOne.getSaveEAgreementMutableData.observe( | |||
viewLifecycleOwner | |||
) { response -> | |||
} | |||
(activity as SignUpActivity).viewModelOne.getSaveEAgreementMutableData.observe( | |||
viewLifecycleOwner | |||
) { response -> | |||
val res: ValidateOTPResponse = | |||
Gson().fromJson( | |||
response?.data.toString(), | |||
ValidateOTPResponse::class.java | |||
) | |||
if (res.Status == getString(R.string.successText)) { | |||
if (dialog.isShowing) dialog.cancel() | |||
showConfirmDialog(res.Message) | |||
} else if (res.Status == "error") { | |||
Common.showDialogValidation((activity as SignUpActivity), res.Message) | |||
} | |||
Log.e("check_otp_res", response?.data.toString()) | |||
} | |||
} | |||
private fun showConfirmDialog(message: String) { | |||
val builder = AlertDialog.Builder(activity) | |||
builder.setMessage(message) | |||
builder.setCancelable(false) | |||
if (activity != null) { | |||
builder.setPositiveButton(getString(R.string.Ok)) { dialogInterface, _ -> | |||
dialogInterface.dismiss() | |||
} | |||
} | |||
builder.show() | |||
} | |||
@SuppressLint("SetTextI18n") | |||
private fun dialogOTP() { | |||
dialog = Dialog(activity as SignUpActivity) | |||
dialog.setContentView(R.layout.agreement_otp) | |||
val txtDigit: TextView = dialog.findViewById(R.id.txtDigit) | |||
val btnSubmit: MaterialButton = dialog.findViewById(R.id.btnSubmit) | |||
val edtOTP1: TextInputEditText = dialog.findViewById(R.id.edtOTP1) | |||
val edtOTP2: TextInputEditText = dialog.findViewById(R.id.edtOTP2) | |||
val edtOTP3: TextInputEditText = dialog.findViewById(R.id.edtOTP3) | |||
val edtOTP4: TextInputEditText = dialog.findViewById(R.id.edtOTP4) | |||
val edtOTP5: TextInputEditText = dialog.findViewById(R.id.edtOTP5) | |||
val edtOTP6: TextInputEditText = dialog.findViewById(R.id.edtOTP6) | |||
val tlOTP1: TextInputLayout = dialog.findViewById(R.id.tlOTP1) | |||
val tlOTP2: TextInputLayout = dialog.findViewById(R.id.tlOTP2) | |||
val tlOTP3: TextInputLayout = dialog.findViewById(R.id.tlOTP3) | |||
val tlOTP4: TextInputLayout = dialog.findViewById(R.id.tlOTP4) | |||
val tlOTP5: TextInputLayout = dialog.findViewById(R.id.tlOTP5) | |||
val tlOTP6: TextInputLayout = dialog.findViewById(R.id.tlOTP6) | |||
val txtResendOTP: TextView = dialog.findViewById(R.id.txtResendOTP) | |||
edtOTP1.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(1)) | |||
edtOTP2.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(1)) | |||
edtOTP3.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(1)) | |||
edtOTP4.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(1)) | |||
edtOTP5.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(1)) | |||
edtOTP6.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(1)) | |||
edtOTP1.addTextChangedListener( | |||
GenericTextWatcher( | |||
edtOTP1, | |||
edtOTP2 | |||
) | |||
) | |||
edtOTP2.addTextChangedListener( | |||
GenericTextWatcher( | |||
edtOTP2, | |||
edtOTP3 | |||
) | |||
) | |||
edtOTP3.addTextChangedListener( | |||
GenericTextWatcher( | |||
edtOTP3, | |||
edtOTP4 | |||
) | |||
) | |||
edtOTP4.addTextChangedListener( | |||
GenericTextWatcher( | |||
edtOTP4, | |||
edtOTP5 | |||
) | |||
) | |||
edtOTP5.addTextChangedListener( | |||
GenericTextWatcher( | |||
edtOTP5, | |||
edtOTP6 | |||
) | |||
) | |||
edtOTP6.addTextChangedListener( | |||
GenericTextWatcher( | |||
edtOTP6, | |||
null | |||
) | |||
) | |||
edtOTP1.setOnKeyListener(OTPFragment.GenericKeyEvent(edtOTP1, null)) | |||
edtOTP2.setOnKeyListener( | |||
GenericKeyEvent( | |||
edtOTP2, | |||
edtOTP1 | |||
) | |||
) | |||
edtOTP3.setOnKeyListener( | |||
GenericKeyEvent( | |||
edtOTP3, | |||
edtOTP2 | |||
) | |||
) | |||
edtOTP4.setOnKeyListener( | |||
OTPFragment.GenericKeyEvent( | |||
edtOTP4, | |||
edtOTP3 | |||
) | |||
) | |||
edtOTP5.setOnKeyListener( | |||
OTPFragment.GenericKeyEvent( | |||
edtOTP5, | |||
edtOTP4 | |||
) | |||
) | |||
edtOTP6.setOnKeyListener( | |||
OTPFragment.GenericKeyEvent( | |||
edtOTP6, | |||
edtOTP5 | |||
) | |||
) | |||
txtDigit.text = | |||
getString(R.string.sixDigitOTP) + " " + arguments?.getString("email").toString() | |||
txtResendOTP.setOnClickListener{ | |||
if(dialog.isShowing) dialog.cancel() | |||
} | |||
btnSubmit.setOnClickListener { | |||
if (edtOTP1.text.toString().isEmpty()) { // EditText | |||
Common.commonErrorMethod( | |||
edtOTP1, | |||
tlOTP1, | |||
"" | |||
) | |||
} else if (edtOTP2.text.toString().isEmpty()) { // EditText | |||
Common.commonErrorMethod( | |||
edtOTP2, | |||
tlOTP2, | |||
"" | |||
) | |||
} else if (edtOTP3.text.toString().isEmpty()) { // EditText | |||
Common.commonErrorMethod( | |||
edtOTP3, | |||
tlOTP3, | |||
"" | |||
) | |||
} else if (edtOTP4.text.toString().isEmpty()) { // EditText | |||
Common.commonErrorMethod( | |||
edtOTP4, | |||
tlOTP4, | |||
"" | |||
) | |||
} else if (edtOTP5.text.toString().isEmpty()) { // EditText | |||
Common.commonErrorMethod( | |||
edtOTP5, | |||
tlOTP5, | |||
"" | |||
) | |||
} else if (edtOTP6.text.toString().isEmpty()) { // EditText | |||
Common.commonErrorMethod( | |||
edtOTP6, | |||
tlOTP6, | |||
"" | |||
) | |||
} else { | |||
apiVerifyOTP( | |||
edtOTP1.text.toString().plus( | |||
edtOTP2.text.toString().plus( | |||
edtOTP3.text.toString().plus( | |||
edtOTP4.text.toString().plus( | |||
edtOTP5.text.toString().plus( | |||
edtOTP6.text.toString())) | |||
) | |||
) | |||
) | |||
) | |||
} | |||
} | |||
if(!dialog.isShowing) dialog.show() | |||
val window: Window = dialog.window!! | |||
window.setLayout(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.WRAP_CONTENT) | |||
} | |||
private fun apiVerifyOTP(otp: String) { | |||
val obj = JSONObject() | |||
obj.put("SubBrokerCode", PreferenceManager((activity as SignUpActivity)).getPartnerCode()) | |||
obj.put("OTP", otp) | |||
obj.put("OTPGenerationDate", Common.getDateFromTimeMills(System.currentTimeMillis())) | |||
obj.put("FinancialYear", "") | |||
val mediaType = "application/json; charset=utf-8".toMediaType() | |||
val body: RequestBody = obj.toString().toRequestBody(mediaType) | |||
(activity as SignUpActivity).viewModelOne.getSaveEAgreement( | |||
body, | |||
"", | |||
(activity as SignUpActivity) | |||
) | |||
} | |||
private fun smsAPI() { | |||
val sendOTPRequest = SendOTPRequest() | |||
sendOTPRequest.AMCID = "" | |||
sendOTPRequest.CommunicationValue = arguments?.getString("email").toString() | |||
sendOTPRequest.Mode = "email" | |||
sendOTPRequest.MsgState = "EagreementOTP" | |||
sendOTPRequest.Name = "Manoj Singh" | |||
sendOTPRequest.ProductId = 1 | |||
sendOTPRequest.UserRole = 3 | |||
sendOTPRequest.UserId = "4988" | |||
(activity as SignUpActivity).viewModelOne.getSaveEAgreementSendOTP( | |||
sendOTPRequest, | |||
"", | |||
(activity as SignUpActivity) | |||
) | |||
(activity as SignUpActivity).viewModelOne.getSendOTPSaveEAgreementMutableData.observe( | |||
viewLifecycleOwner | |||
) { response -> | |||
Log.e("check_res_otp", response?.data.toString()) | |||
if(response!=null) { | |||
val res: SendOTPResponse = | |||
Gson().fromJson( | |||
response.data.toString(), | |||
SendOTPResponse::class.java | |||
) | |||
if (res.Status ==getString(R.string.successText)) { | |||
dialogOTP() | |||
} | |||
} | |||
} | |||
} | |||
class GenericKeyEvent internal constructor( | |||
private val currentView: EditText, | |||
private val previousView: EditText? | |||
) : View.OnKeyListener { | |||
override fun onKey(p0: View?, keyCode: Int, event: KeyEvent?): Boolean { | |||
if (event!!.action == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_DEL && currentView.id != R.id.edtOTP1 && currentView.text.isEmpty()) { | |||
//If current is empty then previous EditText's number will also be deleted | |||
previousView!!.text = null | |||
previousView.requestFocus() | |||
return true | |||
} | |||
return false | |||
} | |||
} | |||
class GenericTextWatcher internal constructor( | |||
private val currentView: View, | |||
private val nextView: View? | |||
) : TextWatcher { | |||
override fun afterTextChanged(editable: Editable) { // TODO Auto-generated method stub | |||
val text = editable.toString() | |||
when (currentView.id) { | |||
R.id.edtOTP1 -> if (text.length == 1) nextView!!.requestFocus() | |||
R.id.edtOTP2 -> if (text.length == 1) nextView!!.requestFocus() | |||
R.id.edtOTP3 -> if (text.length == 1) nextView!!.requestFocus() | |||
R.id.edtOTP4 -> if (text.length == 1) nextView!!.requestFocus() | |||
R.id.edtOTP5 -> if (text.length == 1) nextView!!.requestFocus() | |||
//You can use EditText4 same as above to hide the keyboard | |||
} | |||
} | |||
override fun beforeTextChanged( | |||
arg0: CharSequence, | |||
arg1: Int, | |||
arg2: Int, | |||
arg3: Int | |||
) { | |||
} | |||
override fun onTextChanged( | |||
arg0: CharSequence, | |||
arg1: Int, | |||
arg2: Int, | |||
arg3: Int | |||
) { | |||
} | |||
} | |||
} |
@ -1,10 +1,14 @@ | |||
package com.nivesh.production.partnerOnBoarding.util | |||
class Constants() { | |||
class Constants { | |||
companion object { | |||
const val BASE_URL = "https://providential.in/WebApi_Bajaj/api/" | |||
// const val token = "636F8F63-06C4-4D95-8562-392B34025FB0" | |||
const val paymentUrl = "https://uat.nivesh.com/bajajFD/OrderStatus" | |||
const val BASE_URL = "http://3.109.121.6:5001/api/" | |||
// const val BASE_URL = "http://3.109.121.6/partner/api/" | |||
const val BASE_URL_COMMON = "http://3.109.121.6:5002/api/" | |||
// const val token = "636F8F63-06C4-4D95-8562-392B34025FB0" | |||
const val maxFileSize : Double = 5.0 | |||
} | |||
} |
@ -1,27 +0,0 @@ | |||
package com.nivesh.production.partnerOnBoarding.util | |||
import android.graphics.Bitmap; | |||
import android.graphics.BitmapFactory; | |||
import android.util.Base64; | |||
import java.io.ByteArrayOutputStream; | |||
class ImageUtil { | |||
@Throws(IllegalArgumentException::class) | |||
fun convert(base64Str: String): Bitmap? { | |||
val decodedBytes: ByteArray = Base64.decode( | |||
base64Str.substring(base64Str.indexOf(",") + 1), | |||
Base64.DEFAULT | |||
) | |||
return BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.size) | |||
} | |||
companion object { | |||
fun convert(bitmap: Bitmap): String? { | |||
val outputStream = ByteArrayOutputStream() | |||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream) | |||
return Base64.encodeToString(outputStream.toByteArray(), Base64.DEFAULT) | |||
} | |||
} | |||
} |
@ -1,35 +0,0 @@ | |||
package com.nivesh.production.partnerOnBoarding.util | |||
import android.text.Editable | |||
import android.text.TextWatcher | |||
class MaskWatcher(private val mask: String) : TextWatcher { | |||
private var isRunning = false | |||
private var isDeleting = false | |||
override fun beforeTextChanged(charSequence: CharSequence, start: Int, count: Int, after: Int) { | |||
isDeleting = count > after | |||
} | |||
override fun onTextChanged(charSequence: CharSequence, start: Int, before: Int, count: Int) {} | |||
override fun afterTextChanged(editable: Editable) { | |||
if (isRunning || isDeleting) { | |||
return | |||
} | |||
isRunning = true | |||
val editableLength = editable.length | |||
if (editableLength < mask.length) { | |||
if (mask[editableLength] != '#') { | |||
editable.append(mask[editableLength]) | |||
} else if (mask[editableLength - 1] != '#') { | |||
editable.insert(editableLength - 1, mask, editableLength - 1, editableLength) | |||
} | |||
} | |||
isRunning = false | |||
} | |||
companion object { | |||
fun buildCpf(): MaskWatcher { | |||
return MaskWatcher("###.###.###-##") | |||
} | |||
} | |||
} |
@ -0,0 +1,79 @@ | |||
package com.nivesh.production.partnerOnBoarding.util.maskedEditText | |||
interface IFormattedString : CharSequence { | |||
val unMaskedString: String | |||
} | |||
internal abstract class AbstractFormattedString(val mMask: Mask, val inputString: String) : IFormattedString { | |||
private var mFormattedString: String? = null | |||
final override val unMaskedString: String | |||
init { | |||
unMaskedString = this.buildRawString(inputString) | |||
} | |||
internal abstract fun formatString(): String | |||
internal abstract fun buildRawString(str: String): String | |||
override val length: Int | |||
get() = toString().length | |||
override fun toString(): String { | |||
return mFormattedString ?: formatString() | |||
} | |||
override fun subSequence(startIndex: Int, endIndex: Int): CharSequence { | |||
return toString().subSequence(startIndex, endIndex) | |||
} | |||
override fun get(index: Int): Char { | |||
return toString()[index] | |||
} | |||
} | |||
internal class FormattedString(mask: Mask, rawString: String) : AbstractFormattedString(mask, rawString) { | |||
override fun buildRawString(str: String): String { | |||
val builder = StringBuilder() | |||
val inputLen = mMask.size().coerceAtMost(str.length) | |||
for (i in 0 until inputLen) { | |||
val ch = str[i] | |||
if (!mMask.isValidPrepopulateCharacter(ch, i)) | |||
builder.append(ch) | |||
} | |||
return builder.toString() | |||
} | |||
override fun formatString(): String { | |||
val builder = StringBuilder() | |||
var strIndex = 0 | |||
var maskCharIndex = 0 | |||
var stringCharacter: Char | |||
while (strIndex < inputString.length && maskCharIndex < mMask.size()) { | |||
val maskChar = mMask[maskCharIndex] | |||
stringCharacter = inputString[strIndex] | |||
when { | |||
maskChar.isValidCharacter(stringCharacter) -> { | |||
builder.append(maskChar.processCharacter(stringCharacter)) | |||
strIndex += 1 | |||
maskCharIndex += 1 | |||
} | |||
maskChar.isPrepopulate -> { | |||
builder.append(maskChar.processCharacter(stringCharacter)) | |||
maskCharIndex += 1 | |||
} | |||
else -> strIndex += 1 | |||
} | |||
} | |||
return builder.toString() | |||
} | |||
} |
@ -0,0 +1,60 @@ | |||
package com.nivesh.production.partnerOnBoarding.util.maskedEditText | |||
class Mask() { | |||
lateinit var formatString: String | |||
private lateinit var mMask: List<MaskCharacter> | |||
private val mFabric: MaskCharacterFabric = MaskCharacterFabric() | |||
private var mPrepopulateCharacter: MutableList<MaskCharacter>? = null | |||
constructor(fmtString: String) : this() { | |||
formatString = fmtString | |||
mMask = buildMask(formatString) | |||
} | |||
fun size(): Int { | |||
return mMask.size | |||
} | |||
operator fun get(index: Int): MaskCharacter { | |||
return mMask[index] | |||
} | |||
fun isValidPrepopulateCharacter(ch: Char, at: Int): Boolean { | |||
return try { | |||
val character = mMask[at] | |||
character.isPrepopulate && character.isValidCharacter(ch) | |||
} catch (e: IndexOutOfBoundsException) { | |||
false | |||
} | |||
} | |||
fun isValidPrepopulateCharacter(ch: Char): Boolean { | |||
for (maskCharacter in mPrepopulateCharacter!!) { | |||
if (maskCharacter.isValidCharacter(ch)) { | |||
return true | |||
} | |||
} | |||
return false | |||
} | |||
private fun buildMask(fmtString: String): List<MaskCharacter> { | |||
val result = ArrayList<MaskCharacter>() | |||
mPrepopulateCharacter = ArrayList() | |||
for (ch in fmtString.toCharArray()) { | |||
val maskCharacter = mFabric.buildCharacter(ch) | |||
if (maskCharacter?.isPrepopulate == true) { | |||
mPrepopulateCharacter?.add(maskCharacter) | |||
} | |||
maskCharacter?.let { result.add(it) } | |||
} | |||
return result | |||
} | |||
fun getFormattedString(value: String): IFormattedString { | |||
return FormattedString(this, value) | |||
} | |||
} |
@ -0,0 +1,93 @@ | |||
package com.nivesh.production.partnerOnBoarding.util.maskedEditText | |||
abstract class MaskCharacter { | |||
open val isPrepopulate: Boolean | |||
get() = false | |||
abstract fun isValidCharacter(ch: Char): Boolean | |||
open fun processCharacter(ch: Char): Char { | |||
return ch | |||
} | |||
} | |||
internal class DigitCharacter : MaskCharacter() { | |||
override fun isValidCharacter(ch: Char): Boolean { | |||
return Character.isDigit(ch) | |||
} | |||
} | |||
internal class UpperCaseCharacter : MaskCharacter() { | |||
override fun isValidCharacter(ch: Char): Boolean { | |||
return Character.isUpperCase(ch) | |||
} | |||
override fun processCharacter(ch: Char): Char { | |||
return Character.toUpperCase(ch) | |||
} | |||
} | |||
internal class LowerCaseCharacter : MaskCharacter() { | |||
override fun isValidCharacter(ch: Char): Boolean { | |||
return Character.isLowerCase(ch) | |||
} | |||
override fun processCharacter(ch: Char): Char { | |||
return Character.toLowerCase(ch) | |||
} | |||
} | |||
internal class AlphaNumericCharacter : MaskCharacter() { | |||
override fun isValidCharacter(ch: Char): Boolean { | |||
return Character.isLetterOrDigit(ch) | |||
} | |||
} | |||
internal class LetterCharacter : MaskCharacter() { | |||
override fun isValidCharacter(ch: Char): Boolean { | |||
return Character.isLetter(ch) | |||
} | |||
} | |||
internal class HexCharacter : MaskCharacter() { | |||
override fun isValidCharacter(ch: Char): Boolean { | |||
return Character.isLetterOrDigit(ch) && HEX_CHARS.indexOf(Character.toUpperCase(ch)) != -1 | |||
} | |||
override fun processCharacter(ch: Char): Char { | |||
return Character.toUpperCase(ch) | |||
} | |||
companion object { | |||
private val HEX_CHARS = "0123456789ABCDEF" | |||
} | |||
} | |||
internal class LiteralCharacter : MaskCharacter { | |||
private var character: Char? = null | |||
override val isPrepopulate: Boolean | |||
get() = character != null | |||
constructor() { | |||
character = null | |||
} | |||
constructor(ch: Char) { | |||
character = ch | |||
} | |||
override fun isValidCharacter(ch: Char): Boolean { | |||
return character == null || character == ch | |||
} | |||
override fun processCharacter(ch: Char): Char { | |||
return if (character != null) character!! else ch | |||
} | |||
} |
@ -0,0 +1,29 @@ | |||
package com.nivesh.production.partnerOnBoarding.util.maskedEditText | |||
internal class MaskCharacterFabric { | |||
fun buildCharacter(ch: Char): MaskCharacter? { | |||
return when (ch) { | |||
ANYTHING_KEY -> LiteralCharacter() | |||
DIGIT_KEY -> DigitCharacter() | |||
UPPERCASE_KEY -> UpperCaseCharacter() | |||
LOWERCASE_KEY -> LowerCaseCharacter() | |||
ALPHA_NUMERIC_KEY -> AlphaNumericCharacter() | |||
CHARACTER_KEY -> LetterCharacter() | |||
HEX_KEY -> HexCharacter() | |||
else -> { | |||
LiteralCharacter(ch) | |||
} | |||
} | |||
} | |||
companion object { | |||
private const val ANYTHING_KEY = '*' | |||
private const val DIGIT_KEY = '#' | |||
private const val UPPERCASE_KEY = 'U' | |||
private const val LOWERCASE_KEY = 'L' | |||
private const val ALPHA_NUMERIC_KEY = 'A' | |||
private const val CHARACTER_KEY = '?' | |||
private const val HEX_KEY = 'H' | |||
} | |||
} |
@ -0,0 +1,50 @@ | |||
package com.nivesh.production.partnerOnBoarding.util.maskedEditText | |||
import android.content.Context | |||
import android.util.AttributeSet | |||
import androidx.appcompat.widget.AppCompatEditText | |||
import com.google.android.material.textfield.TextInputEditText | |||
import com.nivesh.production.partnerOnBoarding.R | |||
class MaskedEditText(context: Context, attrs: AttributeSet) : TextInputEditText(context, attrs) { | |||
private var mMaskedFormatter: MaskedFormatter? = null | |||
private var mMaskedWatcher: MaskedWatcher? = null | |||
val maskString: String? | |||
get() = mMaskedFormatter?.maskString | |||
val unMaskedText: String? | |||
get() { | |||
val currentText = text?.toString() | |||
val formattedString = currentText?.let { mMaskedFormatter?.formatString(it) } | |||
return formattedString?.unMaskedString | |||
} | |||
init { | |||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.MaskedEditText) | |||
if (typedArray.hasValue(R.styleable.MaskedEditText_mask)) { | |||
val maskStr = typedArray.getString(R.styleable.MaskedEditText_mask) | |||
if (maskStr != null && maskStr.isNotEmpty()) { | |||
setMask(maskStr) | |||
} | |||
} | |||
typedArray.recycle() | |||
} | |||
fun setMask(mMaskStr: String) { | |||
mMaskedFormatter = MaskedFormatter(mMaskStr) | |||
if (mMaskedWatcher != null) { | |||
removeTextChangedListener(mMaskedWatcher) | |||
} | |||
mMaskedFormatter?.let { mMaskedWatcher = MaskedWatcher(it, this) } | |||
addTextChangedListener(mMaskedWatcher) | |||
} | |||
} |
@ -0,0 +1,27 @@ | |||
package com.nivesh.production.partnerOnBoarding.util.maskedEditText | |||
class MaskedFormatter internal constructor() { | |||
internal var mMask: Mask? = null | |||
val maskString: String? | |||
get() = mMask?.formatString | |||
val maskLength: Int? | |||
get() = mMask?.size() | |||
init { | |||
mMask = null | |||
} | |||
constructor(fmtString: String) : this() { | |||
this.setMask(fmtString) | |||
} | |||
fun setMask(fmtString: String) { | |||
mMask = Mask(fmtString) | |||
} | |||
fun formatString(value: String): IFormattedString? { | |||
return mMask?.getFormattedString(value) | |||
} | |||
} |
@ -0,0 +1,79 @@ | |||
package com.nivesh.production.partnerOnBoarding.util.maskedEditText | |||
import android.text.Editable | |||
import android.text.TextWatcher | |||
import android.widget.EditText | |||
import com.google.android.material.textfield.TextInputEditText | |||
import java.lang.ref.WeakReference | |||
class MaskedWatcher(maskedFormatter: MaskedFormatter, editText: TextInputEditText) : TextWatcher { | |||
private val mMaskFormatter: WeakReference<MaskedFormatter> = WeakReference(maskedFormatter) | |||
private val mEditText: WeakReference<TextInputEditText> = WeakReference(editText) | |||
private var oldFormattedValue = "" | |||
private var oldCursorPosition: Int = 0 | |||
// =========================================================== | |||
// Listeners, methods for/from Interfaces | |||
// =========================================================== | |||
private fun setFormattedText(formattedString: IFormattedString) { | |||
val editText = mEditText.get() ?: return | |||
val deltaLength = formattedString.length - oldFormattedValue.length | |||
editText.removeTextChangedListener(this) | |||
editText.setText(formattedString) | |||
editText.addTextChangedListener(this) | |||
var newCursorPosition = oldCursorPosition | |||
if (deltaLength > 0) { | |||
newCursorPosition += deltaLength | |||
} else if (deltaLength < 0) { | |||
newCursorPosition -= 1 | |||
} else { | |||
var mask: Mask? = null | |||
mMaskFormatter.get()?.mMask?.let { mask = it } | |||
var maskLength = 0 | |||
mMaskFormatter.get()?.maskLength?.let { maskLength = it} | |||
newCursorPosition = 1.coerceAtLeast(newCursorPosition.coerceAtMost(maskLength)) | |||
var isPopulate = false | |||
mask?.get(newCursorPosition - 1)?.isPrepopulate?.let { isPopulate = it } | |||
if (isPopulate) | |||
newCursorPosition -= 1 | |||
} | |||
newCursorPosition = 0.coerceAtLeast(newCursorPosition.coerceAtMost(formattedString.length)) | |||
editText.setSelection(newCursorPosition) | |||
} | |||
override fun afterTextChanged(s: Editable?) { | |||
if (s == null) | |||
return | |||
var value = s.toString() | |||
var maskLength = 0 | |||
mMaskFormatter.get()?.maskLength?.let { maskLength = it} | |||
if (value.length > oldFormattedValue.length && maskLength < value.length) { | |||
value = oldFormattedValue | |||
} | |||
val formattedString = mMaskFormatter.get()?.formatString(value) | |||
formattedString?.let { setFormattedText(it) } | |||
oldFormattedValue = formattedString.toString() | |||
} | |||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) { | |||
mEditText.get()?.selectionStart?.let { this.oldCursorPosition = it } | |||
} | |||
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {} | |||
} |
@ -1,12 +0,0 @@ | |||
package com.nivesh.production.partnerOnBoarding.viewModels | |||
import androidx.lifecycle.MutableLiveData | |||
import androidx.lifecycle.ViewModel | |||
open class MyObservable : ViewModel() | |||
{ | |||
val data = MutableLiveData<String>() | |||
fun data(item: String) { | |||
data.value = item | |||
} | |||
} |
@ -1,32 +1,154 @@ | |||
package com.nivesh.production.partnerOnBoarding.viewModels | |||
import android.app.Activity | |||
import androidx.lifecycle.MutableLiveData | |||
import androidx.lifecycle.ViewModel | |||
import androidx.lifecycle.viewModelScope | |||
import com.google.gson.JsonObject | |||
import com.nivesh.production.partnerOnBoarding.model.request.PartnerRequest | |||
import com.nivesh.production.partnerOnBoarding.model.request.SendOTPRequest | |||
import com.nivesh.production.partnerOnBoarding.model.request.ValidatePartnerRequest | |||
import com.nivesh.production.partnerOnBoarding.repositories.MainRepository | |||
import com.nivesh.production.partnerOnBoarding.util.Common | |||
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.handleError | |||
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.handleResponse | |||
import com.nivesh.production.partnerOnBoarding.util.Resource | |||
import kotlinx.coroutines.launch | |||
import okhttp3.MultipartBody | |||
import okhttp3.RequestBody | |||
open class OnBoardingViewModel(private val mainRepository: MainRepository) : ViewModel() { | |||
// val getStepsCountMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | |||
// fun getStepsCount( | |||
// requestBody: FDStepsCountRequest, | |||
// token: String, | |||
// activity: Activity | |||
// ) = viewModelScope.launch(handleError(activity)) { | |||
// if (Common.isNetworkAvailable(activity)) { | |||
// getStepsCountMutableData.postValue(Resource.Loading()) | |||
// val response = mainRepository.getStepsCountResponse(requestBody, token) | |||
// getStepsCountMutableData.postValue(handleResponse(response)) | |||
// } | |||
// } | |||
// | |||
// val getClientDetailsMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | |||
// fun getClientDetails(getClientDetailsRequest: getClientDetailsRequest, token: String, activity: Activity) = | |||
// viewModelScope.launch(handleError(activity)) { | |||
// if (Common.isNetworkAvailable(activity)) { | |||
// getClientDetailsMutableData.postValue(Resource.Loading()) | |||
// val response = | |||
// mainRepository.getClientDetailsResponse(getClientDetailsRequest, token) | |||
// getClientDetailsMutableData.postValue(handleResponse(response)) | |||
// } | |||
// } | |||
val getPartnerCreationMutableData: MutableLiveData<Resource<JsonObject>?> = MutableLiveData() | |||
fun getPartnerCreateData( | |||
requestBody: PartnerRequest, | |||
token: String, | |||
activity: Activity | |||
) = viewModelScope.launch(handleError(activity)) { | |||
if (Common.isNetworkAvailable(activity)) { | |||
val response = mainRepository.getPartnerCreationResponse(requestBody, token) | |||
getPartnerCreationMutableData.postValue(handleResponse(response)) | |||
} | |||
} | |||
val getValidatePartnerMutableData: MutableLiveData<Resource<JsonObject>?> = MutableLiveData() | |||
fun getPartnerValidate( | |||
validatePartnerRequest: ValidatePartnerRequest, | |||
token: String, | |||
activity: Activity | |||
) = viewModelScope.launch(handleError(activity)) { | |||
if (Common.isNetworkAvailable(activity)) { | |||
val response = mainRepository.getValidatePartnerResponse(validatePartnerRequest) | |||
getValidatePartnerMutableData.postValue(handleResponse(response)) | |||
} | |||
} | |||
val getSendOTPMutableData: MutableLiveData<Resource<JsonObject>?> = MutableLiveData() | |||
fun getSendOTP( | |||
sendOTPRequest: SendOTPRequest, | |||
token: String, | |||
activity: Activity | |||
) = viewModelScope.launch(handleError(activity)) { | |||
if (Common.isNetworkAvailable(activity)) { | |||
val response = mainRepository.getSendOTPResponse(sendOTPRequest) | |||
getSendOTPMutableData.postValue(handleResponse(response)) | |||
} | |||
} | |||
val getSendOTPSaveEAgreementMutableData: MutableLiveData<Resource<JsonObject>?> = MutableLiveData() | |||
fun getSaveEAgreementSendOTP( | |||
sendOTPRequest: SendOTPRequest, | |||
token: String, | |||
activity: Activity | |||
) = viewModelScope.launch(handleError(activity)) { | |||
if (Common.isNetworkAvailable(activity)) { | |||
val response = mainRepository.getSendSaveEAgreementOTPResponse(sendOTPRequest) | |||
getSendOTPSaveEAgreementMutableData.postValue(handleResponse(response)) | |||
} | |||
} | |||
val getVerifyOTPMutableData: MutableLiveData<Resource<JsonObject>?> = MutableLiveData() | |||
fun getVerifyOTP( | |||
requestBody: RequestBody, | |||
activity: Activity | |||
) = viewModelScope.launch(handleError(activity)) { | |||
if (Common.isNetworkAvailable(activity)) { | |||
val response = mainRepository.getVerifyOTP(requestBody) | |||
getVerifyOTPMutableData.postValue(handleResponse(response)) | |||
} | |||
} | |||
val getAMFIDetailMutableData: MutableLiveData<Resource<JsonObject>?> = MutableLiveData() | |||
fun getAMFIDetail( | |||
requestBody: RequestBody, | |||
token: String, | |||
activity: Activity | |||
) = viewModelScope.launch(handleError(activity)) { | |||
if (Common.isNetworkAvailable(activity)) { | |||
val response = mainRepository.getAMFIDetailResponse(requestBody) | |||
getAMFIDetailMutableData.postValue(handleResponse(response)) | |||
} | |||
} | |||
val getPANDetailMutableData: MutableLiveData<Resource<JsonObject>?> = MutableLiveData() | |||
fun getPANDetail( | |||
requestBody: String, | |||
url: String, | |||
activity: Activity | |||
) = viewModelScope.launch(handleError(activity)) { | |||
if (Common.isNetworkAvailable(activity)) { | |||
val response = mainRepository.getPANDetailResponse(url,requestBody) | |||
getPANDetailMutableData.postValue(handleResponse(response)) | |||
} | |||
} | |||
val getDocumentTypeMutableData: MutableLiveData<Resource<JsonObject>?> = MutableLiveData() | |||
fun getDocumentType( | |||
value: String, | |||
type: String, | |||
url: String, | |||
activity: Activity | |||
) = viewModelScope.launch(handleError(activity)) { | |||
if (Common.isNetworkAvailable(activity)) { | |||
val response = mainRepository.getDocumentTypeResponse(url,value,type) | |||
getDocumentTypeMutableData.postValue(handleResponse(response)) | |||
} | |||
} | |||
val getDocumentUploadMutableData: MutableLiveData<Resource<JsonObject>?> = MutableLiveData() | |||
fun getDocumentUpload( | |||
multipartBody: List<MultipartBody.Part>, | |||
pc: Int, | |||
pr: Int, | |||
di: Int, | |||
activity: Activity | |||
) = viewModelScope.launch(handleError(activity)) { | |||
if (Common.isNetworkAvailable(activity)) { | |||
val response = mainRepository.getDocumentUploadResponse(multipartBody,pc,pr,di) | |||
getDocumentUploadMutableData.postValue(handleResponse(response)) | |||
} | |||
} | |||
val getSaveEAgreementMutableData: MutableLiveData<Resource<JsonObject>?> = MutableLiveData() | |||
fun getSaveEAgreement( | |||
requestBody: RequestBody, | |||
token: String, | |||
activity: Activity | |||
) = viewModelScope.launch(handleError(activity)) { | |||
if (Common.isNetworkAvailable(activity)) { | |||
val response = mainRepository.getSaveEAgreement(requestBody, token) | |||
getSaveEAgreementMutableData.postValue(handleResponse(response)) | |||
} | |||
} | |||
val getAllProductMutableData: MutableLiveData<Resource<JsonObject>?> = MutableLiveData() | |||
fun getAllProduct( | |||
url: String, | |||
activity: Activity | |||
) = viewModelScope.launch(handleError(activity)) { | |||
if (Common.isNetworkAvailable(activity)) { | |||
val response = mainRepository.getAllProduct(url) | |||
getAllProductMutableData.postValue(handleResponse(response)) | |||
} | |||
} | |||
} |
@ -0,0 +1,11 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:width="18dp" | |||
android:height="12dp" | |||
android:viewportWidth="18" | |||
android:viewportHeight="12"> | |||
<path | |||
android:fillColor="#ffffff" | |||
android:pathData="M18 5H3.83L7.41 1.41L6 0L0 6L6 12L7.41 10.59L3.83 7H18V5Z" /> | |||
</vector> |
@ -0,0 +1,12 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:width="14dp" | |||
android:height="14dp" | |||
android:viewportWidth="14" | |||
android:viewportHeight="14"> | |||
<path | |||
android:fillColor="#303030" | |||
android:fillType="evenOdd" | |||
android:pathData="M4 0.5V1H10V0.5C10 0.223858 10.2239 0 10.5 0C10.7761 0 11 0.223858 11 0.5V1H12C13.1046 1 14 1.89543 14 3V12C14 13.1046 13.1046 14 12 14H2C0.89543 14 0 13.1046 0 12V6V5V3C0 1.89543 0.895431 1 2 1H3V0.5C3 0.223858 3.22386 0 3.5 0C3.77614 0 4 0.223858 4 0.5ZM10 2V2.5C10 2.77614 10.2239 3 10.5 3C10.7761 3 11 2.77614 11 2.5V2H12C12.5523 2 13 2.44772 13 3V5H12H1V3C1 2.44772 1.44772 2 2 2H3V2.5C3 2.77614 3.22386 3 3.5 3C3.77614 3 4 2.77614 4 2.5V2H10ZM1 6V12C1 12.5523 1.44772 13 2 13H12C12.5523 13 13 12.5523 13 12V6H12H1Z" /> | |||
</vector> |
@ -0,0 +1,11 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:width="18dp" | |||
android:height="18dp" | |||
android:viewportWidth="18" | |||
android:viewportHeight="18"> | |||
<path | |||
android:fillColor="#ffffff" | |||
android:pathData="M3.54 2C3.6 2.89 3.75 3.76 3.99 4.59L2.79 5.79C2.38 4.59 2.12 3.32 2.03 2H3.54ZM13.4 14.02C14.25 14.26 15.12 14.41 16 14.47V15.96C14.68 15.87 13.41 15.61 12.2 15.21L13.4 14.02ZM4.5 0H1C0.45 0 0 0.45 0 1C0 10.39 7.61 18 17 18C17.55 18 18 17.55 18 17V13.51C18 12.96 17.55 12.51 17 12.51C15.76 12.51 14.55 12.31 13.43 11.94C13.33 11.9 13.22 11.89 13.12 11.89C12.86 11.89 12.61 11.99 12.41 12.18L10.21 14.38C7.38 12.93 5.06 10.62 3.62 7.79L5.82 5.59C6.1 5.31 6.18 4.92 6.07 4.57C5.7 3.45 5.5 2.25 5.5 1C5.5 0.45 5.05 0 4.5 0Z" /> | |||
</vector> |
@ -0,0 +1,290 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tool="http://schemas.android.com/tools" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:id="@+id/containerOTP" | |||
android:orientation="vertical"> | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="@dimen/margin_10" | |||
android:layout_marginEnd="@dimen/margin_10" | |||
android:paddingBottom="@dimen/margin_20" | |||
android:orientation="vertical" | |||
app:layout_constraintTop_toTopOf="parent"> | |||
<TextView | |||
android:id="@+id/txtSignUp" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:padding="@dimen/margin_5" | |||
android:text="@string/mobNoText" | |||
android:textColor="@color/black" | |||
android:textSize="@dimen/text_size_20" | |||
android:textStyle="bold" | |||
app:layout_constraintEnd_toEndOf="parent" | |||
app:layout_constraintStart_toStartOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" /> | |||
<TextView | |||
android:id="@+id/txtDigit" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="@dimen/margin_10" | |||
android:layout_marginTop="@dimen/margin_5" | |||
android:textColor="@color/black" | |||
app:layout_constraintEnd_toEndOf="parent" | |||
app:layout_constraintStart_toStartOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/txtSignUp" /> | |||
<TextView | |||
android:id="@+id/txtChangeNumber" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginEnd="@dimen/margin_20" | |||
android:layout_marginStart="@dimen/margin_10" | |||
android:layout_marginTop="@dimen/margin_5" | |||
android:gravity="end" | |||
android:text="@string/txtChange" | |||
android:textColor="@color/blue1" | |||
app:layout_constraintEnd_toEndOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/txtDigit" /> | |||
<TextView | |||
android:id="@+id/txtCode" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="@dimen/margin_10" | |||
android:layout_marginTop="@dimen/margin_5" | |||
android:text="@string/code" | |||
android:textColor="@color/black" | |||
app:layout_constraintStart_toStartOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/txtChangeNumber" /> | |||
<LinearLayout | |||
android:id="@+id/otpLayout" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:weightSum="6" | |||
android:gravity="center" | |||
android:orientation="horizontal" | |||
app:layout_constraintStart_toStartOf="parent" | |||
app:layout_constraintTop_toBottomOf="@+id/txtCode"> | |||
<com.google.android.material.textfield.TextInputLayout | |||
android:id="@+id/tlOTP1" | |||
android:layout_weight="1" | |||
android:gravity="center" | |||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense" | |||
android:layout_width="0dp" | |||
android:layout_marginEnd="@dimen/margin_2" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintStart_toStartOf="parent" | |||
app:layout_constraintTop_toTopOf="parent"> | |||
<com.google.android.material.textfield.TextInputEditText | |||
android:id="@+id/edtOTP1" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:gravity="center" | |||
android:inputType="number" | |||
android:textColor="@color/black" | |||
android:textColorHint="@color/greyColor2" | |||
android:textSize="@dimen/text_size_14" | |||
tool:ignore="TextContrastCheck,SpeakableTextPresentCheck" /> | |||
</com.google.android.material.textfield.TextInputLayout> | |||
<com.google.android.material.textfield.TextInputLayout | |||
android:id="@+id/tlOTP2" | |||
android:layout_weight="1" | |||
android:layout_marginEnd="@dimen/margin_2" | |||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense" | |||
android:layout_width="0dp" | |||
android:gravity="center" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintStart_toEndOf="@+id/tlOTP1" | |||
app:layout_constraintTop_toTopOf="parent"> | |||
<com.google.android.material.textfield.TextInputEditText | |||
android:id="@+id/edtOTP2" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:gravity="center" | |||
android:inputType="number" | |||
android:textColor="@color/black" | |||
android:textColorHint="@color/greyColor2" | |||
android:textSize="@dimen/text_size_14" | |||
tool:ignore="TextContrastCheck,SpeakableTextPresentCheck" /> | |||
</com.google.android.material.textfield.TextInputLayout> | |||
<com.google.android.material.textfield.TextInputLayout | |||
android:id="@+id/tlOTP3" | |||
android:layout_weight="1" | |||
android:layout_marginEnd="@dimen/margin_2" | |||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense" | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:gravity="center" | |||
app:layout_constraintStart_toEndOf="@+id/tlOTP2" | |||
app:layout_constraintTop_toTopOf="parent"> | |||
<com.google.android.material.textfield.TextInputEditText | |||
android:id="@+id/edtOTP3" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:gravity="center" | |||
android:inputType="number" | |||
android:textColor="@color/black" | |||
android:textColorHint="@color/greyColor2" | |||
android:textSize="@dimen/text_size_14" | |||
tool:ignore="TextContrastCheck,SpeakableTextPresentCheck" /> | |||
</com.google.android.material.textfield.TextInputLayout> | |||
<com.google.android.material.textfield.TextInputLayout | |||
android:id="@+id/tlOTP4" | |||
android:layout_weight="1" | |||
android:layout_marginEnd="@dimen/margin_2" | |||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense" | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:gravity="center" | |||
app:layout_constraintStart_toEndOf="@+id/tlOTP3" | |||
app:layout_constraintTop_toTopOf="parent"> | |||
<com.google.android.material.textfield.TextInputEditText | |||
android:id="@+id/edtOTP4" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:gravity="center" | |||
android:inputType="number" | |||
android:textColor="@color/black" | |||
android:textColorHint="@color/greyColor2" | |||
android:textSize="@dimen/text_size_14" | |||
tool:ignore="TextContrastCheck,SpeakableTextPresentCheck" /> | |||
</com.google.android.material.textfield.TextInputLayout> | |||
<com.google.android.material.textfield.TextInputLayout | |||
android:id="@+id/tlOTP5" | |||
android:layout_weight="1" | |||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense" | |||
android:layout_width="0dp" | |||
android:gravity="center" | |||
android:layout_marginEnd="@dimen/margin_2" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintStart_toEndOf="@+id/tlOTP4" | |||
app:layout_constraintTop_toTopOf="parent"> | |||
<com.google.android.material.textfield.TextInputEditText | |||
android:id="@+id/edtOTP5" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:gravity="center" | |||
android:inputType="number" | |||
android:textColor="@color/black" | |||
android:textSize="@dimen/text_size_14" | |||
tool:ignore="TextContrastCheck,SpeakableTextPresentCheck" /> | |||
</com.google.android.material.textfield.TextInputLayout> | |||
<com.google.android.material.textfield.TextInputLayout | |||
android:id="@+id/tlOTP6" | |||
android:layout_weight="1" | |||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense" | |||
android:layout_width="0dp" | |||
android:gravity="center" | |||
android:layout_marginEnd="@dimen/margin_2" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintStart_toEndOf="@+id/tlOTP5" | |||
app:layout_constraintTop_toTopOf="parent"> | |||
<com.google.android.material.textfield.TextInputEditText | |||
android:id="@+id/edtOTP6" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:gravity="center" | |||
android:inputType="number" | |||
android:textColor="@color/black" | |||
android:textSize="@dimen/text_size_14" | |||
tool:ignore="TextContrastCheck,SpeakableTextPresentCheck,TouchTargetSizeCheck" /> | |||
</com.google.android.material.textfield.TextInputLayout> | |||
</LinearLayout> | |||
<TextView | |||
android:id="@+id/txtTimer" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginTop="@dimen/margin_5" | |||
android:layout_marginEnd="@dimen/margin_20" | |||
android:gravity="end" | |||
android:text="(00:30)" | |||
android:textColor="@color/black" | |||
app:layout_constraintEnd_toEndOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/otpLayout" /> | |||
<com.google.android.material.button.MaterialButton | |||
android:id="@+id/btnSubmit" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="@dimen/margin_30" | |||
android:layout_marginTop="@dimen/margin_50" | |||
android:layout_marginEnd="@dimen/margin_30" | |||
android:text="@string/submit" | |||
android:textColor="@color/white" | |||
android:backgroundTint="@color/red" | |||
app:cornerRadius="@dimen/margin_15" | |||
app:layout_constraintEnd_toEndOf="parent" | |||
app:layout_constraintStart_toStartOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/otpLayout" /> | |||
<TextView | |||
android:id="@+id/txtTimerText" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="@dimen/margin_10" | |||
android:layout_marginTop="@dimen/margin_40" | |||
android:gravity="center" | |||
android:text="@string/secondsTimer" | |||
android:textColor="@color/black" | |||
app:layout_constraintEnd_toEndOf="parent" | |||
app:layout_constraintStart_toStartOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/btnSubmit" /> | |||
<TextView | |||
android:id="@+id/txtDidNotGetOTP" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="@dimen/margin_50" | |||
android:layout_marginTop="@dimen/margin_15" | |||
android:text="@string/didNotGetOTP" | |||
android:textColor="@color/black" | |||
android:textSize="@dimen/text_size_16" | |||
app:layout_constraintStart_toStartOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/txtTimerText" /> | |||
<TextView | |||
android:id="@+id/txtResendOTP" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginTop="@dimen/margin_15" | |||
android:text="@string/resendOTP" | |||
android:textColor="@color/lightBlue2" | |||
android:textSize="@dimen/text_size_16" | |||
android:textStyle="bold" | |||
app:layout_constraintEnd_toEndOf="parent" | |||
app:layout_constraintStart_toEndOf="@+id/txtDidNotGetOTP" | |||
app:layout_constraintTop_toBottomOf="@id/txtTimerText" /> | |||
</androidx.constraintlayout.widget.ConstraintLayout> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@ -0,0 +1,18 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical"> | |||
<include | |||
android:id="@+id/header" | |||
layout="@layout/header_eaggrement"/> | |||
<TextView | |||
android:id="@+id/tvMsg" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:padding="@dimen/margin_10"/> | |||
</LinearLayout> |
@ -0,0 +1,32 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical"> | |||
<include | |||
android:id="@+id/header" | |||
layout="@layout/header_eaggrement"/> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:padding="@dimen/margin_10" | |||
android:layout_below="@+id/header" | |||
android:layout_marginTop="@dimen/margin_10" | |||
android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."/> | |||
<com.google.android.material.button.MaterialButton | |||
android:id="@+id/btnAgree" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentBottom="true" | |||
android:layout_centerInParent="true" | |||
android:layout_marginStart="@dimen/margin_20" | |||
android:layout_marginEnd="@dimen/margin_20" | |||
android:layout_marginBottom="@dimen/margin_20" | |||
android:backgroundTint="@color/red" | |||
android:text="@string/agree" | |||
android:textColor="@color/white" /> | |||
</RelativeLayout> |
@ -0,0 +1,46 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
android:layout_width="match_parent" | |||
android:layout_height="?attr/actionBarSize" | |||
android:orientation="horizontal" | |||
android:gravity="center_vertical" | |||
android:background="@color/colorPrimary" | |||
android:padding="@dimen/margin_10"> | |||
<ImageView | |||
android:id="@+id/ivBack" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerVertical="true" | |||
android:src="@drawable/svg_back"/> | |||
<TextView | |||
android:id="@+id/tvTitle" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:textAllCaps="true" | |||
android:layout_marginStart="@dimen/margin_20" | |||
android:layout_marginTop="@dimen/margin_10" | |||
android:textSize="@dimen/text_size_18" | |||
android:layout_toEndOf="@+id/ivBack" | |||
android:layout_centerVertical="true" | |||
android:textColor="@color/white"/> | |||
<TextView | |||
android:id="@+id/tvHelpCall" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:textAllCaps="true" | |||
android:gravity="center" | |||
android:visibility="gone" | |||
android:layout_marginTop="@dimen/margin_2" | |||
android:layout_marginEnd="@dimen/margin_10" | |||
android:textSize="@dimen/text_size_15" | |||
android:text="Help" | |||
android:layout_alignParentEnd="true" | |||
android:textColor="@color/white" | |||
android:drawablePadding="@dimen/margin_10" | |||
app:drawableStartCompat="@drawable/svg_phone" /> | |||
</RelativeLayout> |
Powered by TurnKey Linux.