|
@ -1,8 +1,10 @@ |
|
|
package com.nivesh.production.bajajfd.ui.activity |
|
|
package com.nivesh.production.bajajfd.ui.activity |
|
|
|
|
|
|
|
|
import android.graphics.drawable.Drawable |
|
|
import android.graphics.drawable.Drawable |
|
|
import android.os.Bundle |
|
|
import android.os.Bundle |
|
|
import android.util.Log |
|
|
import android.util.Log |
|
|
import androidx.appcompat.app.AppCompatActivity |
|
|
import androidx.appcompat.app.AppCompatActivity |
|
|
|
|
|
import androidx.fragment.app.Fragment |
|
|
import androidx.lifecycle.ViewModelProvider |
|
|
import androidx.lifecycle.ViewModelProvider |
|
|
import androidx.viewpager.widget.ViewPager |
|
|
import androidx.viewpager.widget.ViewPager |
|
|
import com.google.gson.Gson |
|
|
import com.google.gson.Gson |
|
@ -10,7 +12,6 @@ import com.nivesh.production.bajajfd.adapter.SectionsPagerAdapter |
|
|
import com.nivesh.production.bajajfd.api.ApiClient |
|
|
import com.nivesh.production.bajajfd.api.ApiClient |
|
|
import com.nivesh.production.bajajfd.databinding.ActivityBajajFdBinding |
|
|
import com.nivesh.production.bajajfd.databinding.ActivityBajajFdBinding |
|
|
import com.nivesh.production.bajajfd.interfaces.BajajFDInterface |
|
|
import com.nivesh.production.bajajfd.interfaces.BajajFDInterface |
|
|
import com.nivesh.production.bajajfd.interfaces.SendData |
|
|
|
|
|
import com.nivesh.production.bajajfd.model.* |
|
|
import com.nivesh.production.bajajfd.model.* |
|
|
import com.nivesh.production.bajajfd.repositories.MainRepository |
|
|
import com.nivesh.production.bajajfd.repositories.MainRepository |
|
|
import com.nivesh.production.bajajfd.ui.fragment.* |
|
|
import com.nivesh.production.bajajfd.ui.fragment.* |
|
@ -25,7 +26,7 @@ import com.nivesh.production.bajajfd.util.Resource |
|
|
import com.nivesh.production.bajajfd.viewModel.* |
|
|
import com.nivesh.production.bajajfd.viewModel.* |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface ,SendData{ |
|
|
|
|
|
|
|
|
class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface { |
|
|
lateinit var binding: ActivityBajajFdBinding |
|
|
lateinit var binding: ActivityBajajFdBinding |
|
|
private lateinit var viewModel: BajajFDViewModel |
|
|
private lateinit var viewModel: BajajFDViewModel |
|
|
|
|
|
|
|
@ -46,8 +47,8 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface ,SendData{ |
|
|
var getClientDetailsResponse: getClientDetailsResponse |
|
|
var getClientDetailsResponse: getClientDetailsResponse |
|
|
|
|
|
|
|
|
private var stepCount: Int = 0 |
|
|
private var stepCount: Int = 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private lateinit var sectionsPagerAdapter : SectionsPagerAdapter |
|
|
|
|
|
private lateinit var fragments: Array<Fragment> |
|
|
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) { |
|
|
override fun onCreate(savedInstanceState: Bundle?) { |
|
|
super.onCreate(savedInstanceState) |
|
|
super.onCreate(savedInstanceState) |
|
@ -221,17 +222,28 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface ,SendData{ |
|
|
// steps setting |
|
|
// steps setting |
|
|
setBackground(selectedShape(), defaultShape(), defaultShape(), defaultShape()) |
|
|
setBackground(selectedShape(), defaultShape(), defaultShape(), defaultShape()) |
|
|
|
|
|
|
|
|
|
|
|
if (stepCount == 3) { |
|
|
|
|
|
fragments = arrayOf( |
|
|
|
|
|
StepOneBajajFDFragment.getInstance(this), |
|
|
|
|
|
StepTwoBajajFDFragment.getInstance(this), |
|
|
|
|
|
StepFourBajajFDFragment.getInstance(this), |
|
|
|
|
|
StepFiveBajajFDFragment.getInstance(this) |
|
|
|
|
|
) |
|
|
|
|
|
} else if (stepCount == 4) { |
|
|
|
|
|
fragments = arrayOf( |
|
|
|
|
|
StepOneBajajFDFragment.getInstance(this), |
|
|
|
|
|
StepTwoBajajFDFragment.getInstance(this), |
|
|
|
|
|
StepThreeBajajFDFragment.getInstance(this), |
|
|
|
|
|
StepFourBajajFDFragment.getInstance(this), |
|
|
|
|
|
StepFiveBajajFDFragment.getInstance(this) |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// set viewPager |
|
|
// set viewPager |
|
|
val sectionsPagerAdapter = |
|
|
|
|
|
SectionsPagerAdapter(this@BajajFdMainActivity, supportFragmentManager) |
|
|
|
|
|
|
|
|
sectionsPagerAdapter = |
|
|
|
|
|
SectionsPagerAdapter(supportFragmentManager, fragments, stepsCount) |
|
|
val viewPager: ViewPager = binding.viewPager |
|
|
val viewPager: ViewPager = binding.viewPager |
|
|
sectionsPagerAdapter.addFragment(StepOneBajajFDFragment.getInstance(this@BajajFdMainActivity)) |
|
|
|
|
|
sectionsPagerAdapter.addFragment(StepTwoBajajFDFragment.getInstance(this@BajajFdMainActivity)) |
|
|
|
|
|
if (stepsCount == 4) { |
|
|
|
|
|
sectionsPagerAdapter.addFragment(StepThreeBajajFDFragment.getInstance(this@BajajFdMainActivity)) |
|
|
|
|
|
} |
|
|
|
|
|
sectionsPagerAdapter.addFragment(StepFourBajajFDFragment.getInstance(this@BajajFdMainActivity)) |
|
|
|
|
|
sectionsPagerAdapter.addFragment(StepFiveBajajFDFragment.getInstance(this@BajajFdMainActivity)) |
|
|
|
|
|
|
|
|
|
|
|
viewPager.adapter = sectionsPagerAdapter |
|
|
viewPager.adapter = sectionsPagerAdapter |
|
|
|
|
|
|
|
|
viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { |
|
|
viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { |
|
@ -308,7 +320,7 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface ,SendData{ |
|
|
getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_PAN |
|
|
getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_PAN |
|
|
checkFDKYCRequest.NiveshClientCode = |
|
|
checkFDKYCRequest.NiveshClientCode = |
|
|
getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE.toString() |
|
|
getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE.toString() |
|
|
stepOneBajajFDViewModel.checkFDKYC( checkFDKYCRequest, token) |
|
|
|
|
|
|
|
|
stepOneBajajFDViewModel.checkFDKYC(checkFDKYCRequest, token) |
|
|
stepOneBajajFDViewModel.getFDKYCMutableData.observe(this) { response -> |
|
|
stepOneBajajFDViewModel.getFDKYCMutableData.observe(this) { response -> |
|
|
when (response) { |
|
|
when (response) { |
|
|
is Resource.Success -> { |
|
|
is Resource.Success -> { |
|
@ -413,14 +425,11 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface ,SendData{ |
|
|
when (code) { |
|
|
when (code) { |
|
|
200 -> { |
|
|
200 -> { |
|
|
binding.viewPager.currentItem = currentItem |
|
|
binding.viewPager.currentItem = currentItem |
|
|
StepFourBajajFDFragment.getInstance(this) |
|
|
|
|
|
.getFDData(createFDApplicationResponse ,this) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sendDataFragment("yaha data dalo") |
|
|
|
|
|
|
|
|
StepFourBajajFDFragment.getInstance(this).displayReceivedData(createFDApplicationResponse) |
|
|
|
|
|
val stepFourFDFragment: StepFourBajajFDFragment = |
|
|
|
|
|
sectionsPagerAdapter.getRegisteredFragment(stepCount - 1) as StepFourBajajFDFragment |
|
|
|
|
|
stepFourFDFragment.displayReceivedData(createFDApplicationResponse) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 650 -> refreshToken() |
|
|
// 650 -> refreshToken() |
|
|
else -> { |
|
|
else -> { |
|
|
showDialogValidation( |
|
|
showDialogValidation( |
|
@ -442,21 +451,6 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface ,SendData{ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun sendDataFragment(message: String?) { |
|
|
|
|
|
val tag = "android:switcher:" + com.nivesh.production.bajajfd.R.id.viewPager.toString() + ":" + 1 |
|
|
|
|
|
val f: StepFourBajajFDFragment? = supportFragmentManager.findFragmentByTag(tag) as StepFourBajajFDFragment? |
|
|
|
|
|
if (f != null) { |
|
|
|
|
|
if (message != null) { |
|
|
|
|
|
f.displayReceivedData(message) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |