Add bottomsheet for payment
This commit is contained in:
@@ -16,7 +16,7 @@ buildscript {
|
||||
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.3'
|
||||
classpath 'com.android.tools.build:gradle:7.2.1'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
|
||||
classpath 'com.google.gms:google-services:4.3.10'
|
||||
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.4.2'
|
||||
@@ -27,7 +27,7 @@ buildscript {
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
|
||||
classpath 'com.google.firebase:perf-plugin:1.4.1'
|
||||
|
||||
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.38.1'
|
||||
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.40.1'
|
||||
classpath 'in.juspay:hypersdk-asset-plugin:1.0.3'
|
||||
classpath "com.newrelic.agent.android:agent-gradle-plugin:6.5.0"
|
||||
classpath 'org.codehaus.groovy:groovy-json:3.0.7'
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Thu May 19 19:17:36 IST 2022
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -13,8 +13,6 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 8
|
||||
versionName "1.0.8"
|
||||
multiDexEnabled = true
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@@ -26,13 +24,9 @@ android {
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
debuggable false
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug {
|
||||
debuggable true
|
||||
}
|
||||
}
|
||||
packagingOptions {
|
||||
exclude 'META-INF'
|
||||
|
||||
@@ -9,8 +9,6 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
|
||||
@@ -12,8 +12,6 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
|
||||
@@ -12,8 +12,6 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
|
||||
@@ -9,8 +9,6 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
|
||||
@@ -16,8 +16,6 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode VERSION_CODE
|
||||
versionName VERSION_NAME
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled true
|
||||
resValue "string", "google_maps_key", 'AIzaSyDXTb0mpKvY8MPtdxllfmtEwZEM8aAC49Y'
|
||||
@@ -36,11 +34,7 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
versionNameSuffix "-debug"
|
||||
}
|
||||
release {
|
||||
debuggable false
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
|
||||
@@ -10,11 +10,10 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewStub
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.gson.JsonPrimitive
|
||||
import com.navi.common.extensions.orFalse
|
||||
import com.navi.insurance.R
|
||||
import com.navi.insurance.analytics.InsuranceAnalyticsConstants
|
||||
import com.navi.insurance.common.GiBaseBottomSheet
|
||||
@@ -28,6 +27,7 @@ import com.navi.insurance.common.widgets.replaceLayout
|
||||
import com.navi.insurance.databinding.BottomSheetPaymentModesBinding
|
||||
import com.navi.insurance.health.viewmodel.PaymentModesBottomSheetVM
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.android.synthetic.main.policy_selection_radio_button.view.*
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
@@ -39,6 +39,8 @@ class PaymentModesBottomSheet: GiBaseBottomSheet() {
|
||||
private var callback: Callback? = null
|
||||
private var actionCalled: Boolean = false
|
||||
|
||||
private var showButton: Boolean = false
|
||||
|
||||
@Inject
|
||||
lateinit var idProvider: IdProvider
|
||||
|
||||
@@ -55,7 +57,7 @@ class PaymentModesBottomSheet: GiBaseBottomSheet() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
showButton = arguments?.getBoolean(ARG_SHOW_BUTTON).orFalse()
|
||||
arguments?.getParcelable<NaviWidget>(ARG_WIDGET_DATA)?.widgetData?.let {
|
||||
updateContainer(it, binding.content)
|
||||
}
|
||||
@@ -63,14 +65,30 @@ class PaymentModesBottomSheet: GiBaseBottomSheet() {
|
||||
|
||||
private fun updateContainer(naviWidgetData: NaviWidgetData, container: ViewGroup) {
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
val binding = container.replaceLayout(idProvider.getNaviWidgetLayoutId(naviWidgetData))
|
||||
(binding?.root as? BaseNaviWidgetView)?.updateLayout(binding, naviWidgetData, { action ->
|
||||
val policySelectionBinding = container.replaceLayout(idProvider.getNaviWidgetLayoutId(naviWidgetData))
|
||||
(policySelectionBinding?.root as? BaseNaviWidgetView)?.updateLayout(policySelectionBinding, naviWidgetData, { action ->
|
||||
if (naviWidgetData is RadioOptionsWithHeaderViewData) {
|
||||
if (actionCalled) {
|
||||
callback?.onPaymentModeSelected(arguments?.getString(ARG_POLICY_ID), action.metaData as? String?)
|
||||
safelyDismissDialog()
|
||||
} else {
|
||||
actionCalled = true
|
||||
if (showButton.not()) {
|
||||
if (actionCalled) {
|
||||
callback?.onPaymentModeSelected(arguments?.getString(ARG_POLICY_ID), action.metaData as? String?)
|
||||
safelyDismissDialog()
|
||||
}
|
||||
else {
|
||||
actionCalled = true
|
||||
}
|
||||
}
|
||||
else {
|
||||
binding.paymentEmiPrepayment.width = policySelectionBinding.root.container.width
|
||||
binding.paymentEmiPrepayment.visibility = 0
|
||||
naviWidgetData.options?.forEach {
|
||||
while (it.checked==true){
|
||||
binding.paymentEmiPrepayment.text = String.format("Pay ₹%.2f", it.data as? Double?)
|
||||
}
|
||||
}
|
||||
binding.paymentEmiPrepayment.setOnClickListener {
|
||||
callback?.onPaymentModeSelected(arguments?.getString(ARG_POLICY_ID), action.metaData as? String?)
|
||||
safelyDismissDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -89,11 +107,13 @@ class PaymentModesBottomSheet: GiBaseBottomSheet() {
|
||||
const val ARG_WIDGET_DATA = "widgetData"
|
||||
const val ARG_POLICY_ID = "policyId"
|
||||
const val TAG = "PaymentModesBottomSheet"
|
||||
const val ARG_SHOW_BUTTON = "showBottomSheetButton"
|
||||
|
||||
fun newInstance(policyId: String?, naviWidget: NaviWidget) = PaymentModesBottomSheet().apply {
|
||||
fun newInstance(policyId: String?, naviWidget: NaviWidget, showButton: Boolean=false) = PaymentModesBottomSheet().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString(ARG_POLICY_ID, policyId)
|
||||
putParcelable(ARG_WIDGET_DATA, naviWidget)
|
||||
putBoolean(ARG_SHOW_BUTTON, showButton)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,8 @@ class PolicySelectionFragment: BaseFragment(), PaymentModesBottomSheet.Callback
|
||||
policy.subscription?.paymentModes?.paymentModeWidget?.let { widget ->
|
||||
val bottomSheet = PaymentModesBottomSheet.newInstance(
|
||||
policy.policyId,
|
||||
widget
|
||||
widget,
|
||||
true
|
||||
)
|
||||
bottomSheet.setCallback(callback)
|
||||
bottomSheet.show(fragmentManager, PaymentModesBottomSheet.TAG)
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
~ All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
@@ -18,12 +18,34 @@
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:layout_height="@dimen/dp_200"
|
||||
android:layout_marginBottom="@dimen/dp_24"/>
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
tools:layout_height="@dimen/dp_200" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/payment_emi_prepayment"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_48"
|
||||
android:layout_gravity="start"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginVertical="@dimen/dp_24"
|
||||
android:background="@drawable/button_with_state_8dp_radius"
|
||||
android:clipToPadding="false"
|
||||
android:fontFamily="@font/navi_semi_bold"
|
||||
android:gravity="center"
|
||||
android:text="@string/pay_amount_title"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:visibility="visible"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
|
||||
@@ -10,15 +10,12 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
debuggable false
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user