|
@ -6,6 +6,7 @@ import android.graphics.Bitmap |
|
|
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 android.view.View |
|
|
import android.view.WindowManager |
|
|
import android.view.WindowManager |
|
|
import android.webkit.WebView |
|
|
import android.webkit.WebView |
|
|
import android.webkit.WebViewClient |
|
|
import android.webkit.WebViewClient |
|
@ -29,6 +30,9 @@ import com.nivesh.production.bajajfd.util.Common.Companion.getDate |
|
|
import com.nivesh.production.bajajfd.util.Common.Companion.selectedShape |
|
|
import com.nivesh.production.bajajfd.util.Common.Companion.selectedShape |
|
|
import com.nivesh.production.bajajfd.util.Common.Companion.showDialogValidation |
|
|
import com.nivesh.production.bajajfd.util.Common.Companion.showDialogValidation |
|
|
import com.nivesh.production.bajajfd.util.Constants.Companion.token |
|
|
import com.nivesh.production.bajajfd.util.Constants.Companion.token |
|
|
|
|
|
import com.nivesh.production.bajajfd.util.ProgressUtil |
|
|
|
|
|
import com.nivesh.production.bajajfd.util.ProgressUtil.hideLoading |
|
|
|
|
|
import com.nivesh.production.bajajfd.util.ProgressUtil.showLoading |
|
|
import com.nivesh.production.bajajfd.util.Resource |
|
|
import com.nivesh.production.bajajfd.util.Resource |
|
|
import com.nivesh.production.bajajfd.viewModel.* |
|
|
import com.nivesh.production.bajajfd.viewModel.* |
|
|
|
|
|
|
|
@ -53,7 +57,7 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
var nomineeGuardianDetails: NomineeGuardianDetails = NomineeGuardianDetails() |
|
|
var nomineeGuardianDetails: NomineeGuardianDetails = NomineeGuardianDetails() |
|
|
var getClientDetailsResponse: getClientDetailsResponse = getClientDetailsResponse() |
|
|
var getClientDetailsResponse: getClientDetailsResponse = getClientDetailsResponse() |
|
|
var uniqueId: String = "" |
|
|
var uniqueId: String = "" |
|
|
private var stepCount: Int = 0 |
|
|
|
|
|
|
|
|
var stepCount: Int = 0 |
|
|
private lateinit var sectionsPagerAdapter: SectionsPagerAdapter |
|
|
private lateinit var sectionsPagerAdapter: SectionsPagerAdapter |
|
|
private lateinit var fragments: Array<Fragment> |
|
|
private lateinit var fragments: Array<Fragment> |
|
|
var dialogWebView: Dialog? = null |
|
|
var dialogWebView: Dialog? = null |
|
@ -106,6 +110,9 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
when (code) { |
|
|
when (code) { |
|
|
200 -> { |
|
|
200 -> { |
|
|
stepCount = stepsCountResponse.Response.StepsCount |
|
|
stepCount = stepsCountResponse.Response.StepsCount |
|
|
|
|
|
if (stepCount == 3) { |
|
|
|
|
|
binding.llStep4.visibility = View.GONE |
|
|
|
|
|
} |
|
|
getClientDetailsApi(stepsCountResponse.Response.StepsCount) |
|
|
getClientDetailsApi(stepsCountResponse.Response.StepsCount) |
|
|
} |
|
|
} |
|
|
650 -> "" |
|
|
650 -> "" |
|
@ -159,6 +166,7 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
userRequest.deviceInfo = deviceInfo |
|
|
userRequest.deviceInfo = deviceInfo |
|
|
getClientDetailsRequest.UserRequest = userRequest |
|
|
getClientDetailsRequest.UserRequest = userRequest |
|
|
Log.e("getClientDetail ", " Request -->" + Gson().toJson(getClientDetailsRequest)) |
|
|
Log.e("getClientDetail ", " Request -->" + Gson().toJson(getClientDetailsRequest)) |
|
|
|
|
|
showLoading(this@BajajFdMainActivity) |
|
|
viewModel.getClientDetails(getClientDetailsRequest, token, this) |
|
|
viewModel.getClientDetails(getClientDetailsRequest, token, this) |
|
|
viewModel.getClientDetailsMutableData.observe(this) { response -> |
|
|
viewModel.getClientDetailsMutableData.observe(this) { response -> |
|
|
when (response) { |
|
|
when (response) { |
|
@ -189,7 +197,7 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
is Resource.Loading -> { |
|
|
is Resource.Loading -> { |
|
|
|
|
|
|
|
|
|
|
|
hideLoading() |
|
|
} |
|
|
} |
|
|
is Resource.DataError -> { |
|
|
is Resource.DataError -> { |
|
|
|
|
|
|
|
@ -201,7 +209,7 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
|
|
|
|
|
|
private fun setViewPager(stepsCount: Int) { |
|
|
private fun setViewPager(stepsCount: Int) { |
|
|
// steps setting |
|
|
// steps setting |
|
|
setBackground(selectedShape(), defaultShape(), defaultShape(), defaultShape()) |
|
|
|
|
|
|
|
|
setBackground(selectedShape(), defaultShape(), defaultShape(), defaultShape(), stepsCount) |
|
|
|
|
|
|
|
|
if (stepCount == 3) { |
|
|
if (stepCount == 3) { |
|
|
fragments = arrayOf( |
|
|
fragments = arrayOf( |
|
@ -221,15 +229,15 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// set viewPager |
|
|
// set viewPager |
|
|
sectionsPagerAdapter = SectionsPagerAdapter(supportFragmentManager, fragments, stepsCount) |
|
|
|
|
|
|
|
|
sectionsPagerAdapter = SectionsPagerAdapter(supportFragmentManager, fragments) |
|
|
val viewPager: DisableAdapter = binding.viewPager |
|
|
val viewPager: DisableAdapter = binding.viewPager |
|
|
viewPager.adapter = sectionsPagerAdapter |
|
|
viewPager.adapter = sectionsPagerAdapter |
|
|
viewPager.setPagingEnabled(false) |
|
|
viewPager.setPagingEnabled(false) |
|
|
// if (sectionsPagerAdapter.count > 1) { |
|
|
|
|
|
viewPager.offscreenPageLimit = stepCount - 1 |
|
|
|
|
|
// } else { |
|
|
|
|
|
// viewPager.offscreenPageLimit = 1 |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
if (sectionsPagerAdapter.count > 1) { |
|
|
|
|
|
viewPager.offscreenPageLimit = stepCount |
|
|
|
|
|
} else { |
|
|
|
|
|
viewPager.offscreenPageLimit = 1 |
|
|
|
|
|
} |
|
|
viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { |
|
|
viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { |
|
|
override fun onPageScrolled( |
|
|
override fun onPageScrolled( |
|
|
position: Int, |
|
|
position: Int, |
|
@ -245,7 +253,8 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape() |
|
|
|
|
|
|
|
|
defaultShape(), |
|
|
|
|
|
stepsCount |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
1 -> { |
|
|
1 -> { |
|
@ -253,7 +262,8 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape() |
|
|
|
|
|
|
|
|
defaultShape(), |
|
|
|
|
|
stepsCount |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
2 -> { |
|
|
2 -> { |
|
@ -261,7 +271,8 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape() |
|
|
|
|
|
|
|
|
defaultShape(), |
|
|
|
|
|
stepsCount |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
3 -> { |
|
|
3 -> { |
|
@ -269,7 +280,8 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
defaultShape() |
|
|
|
|
|
|
|
|
defaultShape(), |
|
|
|
|
|
stepsCount |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
4 -> { |
|
|
4 -> { |
|
@ -277,7 +289,8 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape() |
|
|
|
|
|
|
|
|
selectedShape(), |
|
|
|
|
|
stepsCount |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -352,12 +365,16 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
drawable: Drawable?, |
|
|
drawable: Drawable?, |
|
|
drawable1: Drawable?, |
|
|
drawable1: Drawable?, |
|
|
drawable2: Drawable?, |
|
|
drawable2: Drawable?, |
|
|
drawable3: Drawable? |
|
|
|
|
|
|
|
|
drawable3: Drawable?, |
|
|
|
|
|
stepsCount: Int |
|
|
) { |
|
|
) { |
|
|
binding.stepOne.background = drawable |
|
|
binding.stepOne.background = drawable |
|
|
binding.stepTwo.background = drawable1 |
|
|
binding.stepTwo.background = drawable1 |
|
|
binding.stepThree.background = drawable2 |
|
|
binding.stepThree.background = drawable2 |
|
|
binding.stepFour.background = drawable3 |
|
|
|
|
|
|
|
|
if (stepsCount == 4) { |
|
|
|
|
|
binding.stepFour.background = drawable3 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// step 1 response |
|
|
// step 1 response |
|
@ -430,6 +447,7 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
paymentReQueryRequest.UniqueId = uniqueId |
|
|
paymentReQueryRequest.UniqueId = uniqueId |
|
|
paymentReQueryRequest.NiveshClientCode = |
|
|
paymentReQueryRequest.NiveshClientCode = |
|
|
getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE |
|
|
getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE |
|
|
|
|
|
ProgressUtil.showLoading(this@BajajFdMainActivity) |
|
|
viewModel.getPaymentReQuery(paymentReQueryRequest, token, this) |
|
|
viewModel.getPaymentReQuery(paymentReQueryRequest, token, this) |
|
|
viewModel.getPaymentReQueryMutableData.observe(this) { response -> |
|
|
viewModel.getPaymentReQueryMutableData.observe(this) { response -> |
|
|
when (response) { |
|
|
when (response) { |
|
@ -460,7 +478,7 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
is Resource.Loading -> { |
|
|
is Resource.Loading -> { |
|
|
|
|
|
|
|
|
|
|
|
hideLoading() |
|
|
} |
|
|
} |
|
|
is Resource.DataError -> { |
|
|
is Resource.DataError -> { |
|
|
|
|
|
|
|
|