Browse Source

added bank in list

PankajBranch
Hemant Khadase 2 years ago
parent
commit
dba9f6658b
7 changed files with 71 additions and 7 deletions
  1. +1
    -1
      app/src/main/java/com/nivesh/production/bajajfd/adapter/BankListAdapter.kt
  2. +35
    -0
      app/src/main/java/com/nivesh/production/bajajfd/api/ApiCallback.kt
  3. +19
    -0
      app/src/main/java/com/nivesh/production/bajajfd/api/TokenAuthenticator.kt
  4. +6
    -1
      app/src/main/java/com/nivesh/production/bajajfd/ui/activity/BajajFdMainActivity.kt
  5. +2
    -3
      app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepTwoBajajFDFragment.kt
  6. +5
    -1
      app/src/main/res/layout/fragment_bajajfd_step_four.xml
  7. +3
    -1
      app/src/main/res/layout/fragment_bajajfd_step_two.xml

+ 1
- 1
app/src/main/java/com/nivesh/production/bajajfd/adapter/BankListAdapter.kt View File

@ -28,7 +28,7 @@ class BankListAdapter(
viewType: Int viewType: Int
): BankListViewHolder { ): BankListViewHolder {
val view = LayoutInflater.from(parent.context) val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_bank_list_preview, parent, false)
.inflate(R.layout.item_bank_list_preview, parent, false);
view.layoutParams = width?.div(1.35) view.layoutParams = width?.div(1.35)
?.let { ViewGroup.LayoutParams(it.toInt(), ViewGroup.LayoutParams.WRAP_CONTENT) } ?.let { ViewGroup.LayoutParams(it.toInt(), ViewGroup.LayoutParams.WRAP_CONTENT) }
return BankListViewHolder(view) return BankListViewHolder(view)


+ 35
- 0
app/src/main/java/com/nivesh/production/bajajfd/api/ApiCallback.kt View File

@ -0,0 +1,35 @@
package com.nivesh.production.bajajfd.api
import com.nivesh.production.bajajfd.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 {
// 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)
}
}

+ 19
- 0
app/src/main/java/com/nivesh/production/bajajfd/api/TokenAuthenticator.kt View File

@ -0,0 +1,19 @@
package com.nivesh.production.bajajfd.api
import okhttp3.Authenticator
import okhttp3.Request
import okhttp3.Response
import okhttp3.Route
class TokenAuthenticator {
// override fun authenticate(route: Route?, response: Response): Request? {
//// newAccessToken = service.refreshToken();
////
//// // Add new header to rejected request and retry it
//// return response.request().newBuilder()
//// .header(AUTHORIZATION, newAccessToken)
//// .build();
//
//
// }
}

+ 6
- 1
app/src/main/java/com/nivesh/production/bajajfd/ui/activity/BajajFdMainActivity.kt View File

@ -88,6 +88,8 @@ class BajajFdMainActivity : BaseActivity() {
val fdStepsCount = FDStepsCountRequest() val fdStepsCount = FDStepsCountRequest()
fdStepsCount.FDProvider = getString(R.string.bajaj) fdStepsCount.FDProvider = getString(R.string.bajaj)
fdStepsCount.NiveshClientCode = "8872" fdStepsCount.NiveshClientCode = "8872"
//hemant client code =8872 /60476
viewModel.getStepsCount(fdStepsCount, token, this) viewModel.getStepsCount(fdStepsCount, token, this)
viewModel.getStepsCountMutableData.observe(this) { response -> viewModel.getStepsCountMutableData.observe(this) { response ->
when (response) { when (response) {
@ -142,8 +144,11 @@ class BajajFdMainActivity : BaseActivity() {
getClientDetailsRequest.AppOrWeb = getString(R.string.app) getClientDetailsRequest.AppOrWeb = getString(R.string.app)
getClientDetailsRequest.sub_broker_code = "1038" getClientDetailsRequest.sub_broker_code = "1038"
//hemant 8872/1038
val userRequest = UserRequest() val userRequest = UserRequest()
userRequest.UID = 19060
userRequest.UID = 0
userRequest.IPAddress = "" userRequest.IPAddress = ""
userRequest.Source = getString(R.string.source) userRequest.Source = getString(R.string.source)
userRequest.AppOrWeb = getString(R.string.app) userRequest.AppOrWeb = getString(R.string.app)


+ 2
- 3
app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepTwoBajajFDFragment.kt View File

@ -907,10 +907,9 @@ class StepTwoBajajFDFragment : BaseFragment() {
if (binding.tvAcVerify.visibility == View.GONE) { if (binding.tvAcVerify.visibility == View.GONE) {
binding.tvAcVerify.visibility = View.VISIBLE binding.tvAcVerify.visibility = View.VISIBLE
} }
when (code) { when (code) {
200 -> { 200 -> {
if (getBankValidationApiResponse.Message == "Account verified") {
if (getBankValidationApiResponse.Message.equals("Account Verified")) {
val clientBankList = ClientBanklist() val clientBankList = ClientBanklist()
clientBankList.AccountNumber = bankAccount clientBankList.AccountNumber = bankAccount
clientBankList.AccountType = "sb" clientBankList.AccountType = "sb"
@ -1462,7 +1461,7 @@ class StepTwoBajajFDFragment : BaseFragment() {
) )
binding.spOccupation.setAdapter(adapter) binding.spOccupation.setAdapter(adapter)
binding.spOccupation.setText( binding.spOccupation.setText(
adapter.getItem(0)?.Value,
adapter.getItem(0)?.Label,
false false
) )
} }


+ 5
- 1
app/src/main/res/layout/fragment_bajajfd_step_four.xml View File

@ -220,7 +220,11 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvTerms" android:id="@+id/rvTerms"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
tools:listitem="@layout/item_customer_list_preview"
/>
</LinearLayout> </LinearLayout>


+ 3
- 1
app/src/main/res/layout/fragment_bajajfd_step_two.xml View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/constraintLayout" android:id="@+id/constraintLayout"


Loading…
Cancel
Save

Powered by TurnKey Linux.