Rewards on First Investment (#4962)
* [PS] added rewards on fund details, payment start, and fund buy screen * [PS] added rewards widget on dashborad * [PS] design changes * [PS] added bottom sheet dismissal on pdf * [PS] design changes * [PS] design changes * [PS] design changes
This commit is contained in:
committed by
GitHub Enterprise
parent
70d6a7a96f
commit
d11e802a21
@@ -47,6 +47,7 @@ class AmcCommonBottomSheet : BaseBottomSheet() {
|
||||
|
||||
private fun onSpanClick(actionData: ActionData?) {
|
||||
listener?.buttonClick(actionData)
|
||||
safelyDismissDialog()
|
||||
}
|
||||
|
||||
override val screenName: String
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName
|
||||
import com.navi.amc.fundbuy.models.AmcHeaderData
|
||||
import com.navi.amc.fundbuy.models.BankDetailsData
|
||||
import com.navi.amc.fundbuy.models.LabelData
|
||||
import com.navi.amc.fundbuy.models.RewardsData
|
||||
import com.navi.design.textview.model.TextWithStyle
|
||||
|
||||
data class OptionCardData(
|
||||
@@ -19,7 +20,8 @@ data class OptionCardLayoutData(
|
||||
@SerializedName("fundHeader") val fundHeader: AmcHeaderData? = null,
|
||||
@SerializedName("options") val options: List<OptionCardData>? = null,
|
||||
@SerializedName("bankDetails") val bankDetails: BankDetailsData? = null,
|
||||
@SerializedName("note") val note: InformationCardData? = null
|
||||
@SerializedName("note") val note: InformationCardData? = null,
|
||||
@SerializedName("rewards") val rewards: RewardsData? = null
|
||||
)
|
||||
|
||||
data class OptionCardMetaData(
|
||||
|
||||
@@ -57,10 +57,10 @@ import com.navi.common.ui.fragment.SingleSelectionBottomSheet
|
||||
import com.navi.common.utils.SPACE
|
||||
import com.navi.common.utils.getDateWithSuffix
|
||||
import com.navi.common.utils.observeNonNull
|
||||
import com.navi.design.utils.parseColorSafe
|
||||
import com.navi.design.utils.setSpannableString
|
||||
import com.navi.design.utils.*
|
||||
import com.navi.naviwidgets.base.InputWidgetModel
|
||||
import com.navi.naviwidgets.callbacks.WidgetCallback
|
||||
import com.navi.naviwidgets.extensions.showWhenDataIsAvailable
|
||||
import com.navi.naviwidgets.models.SingleSelectionBottomSheetData
|
||||
import com.navi.naviwidgets.widgets.textwithsearch.TextSearchClickAction
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
@@ -246,6 +246,20 @@ class FundBuyingFragment : AmcBaseFragment(), WidgetCallback {
|
||||
binding.autopayCheckbox.checkbox.isChecked.not()
|
||||
}
|
||||
}
|
||||
binding.rewards.root.isVisible = it.rewards?.let { rewards ->
|
||||
binding.rewards.title.setSpannableString(rewards.title)
|
||||
binding.rewards.icon.showWhenDataIsAvailable(rewards.icon)
|
||||
binding.rewards.label.setSpannableString(rewards.label?.title)
|
||||
binding.rewards.label.background = getNaviDrawable(
|
||||
radii = CornerRadius(
|
||||
leftBottom = dpToPx(8)
|
||||
), backgroundColor = rewards.label?.bgColor.parseColorSafe()
|
||||
)
|
||||
binding.rewards.root.setBackgroundColor(rewards.bgColor.parseColorSafe())
|
||||
true
|
||||
} ?: run {
|
||||
false
|
||||
}
|
||||
initUI(it.fundInvestmentType.defaultChecked.equals(SIP))
|
||||
}
|
||||
|
||||
|
||||
@@ -41,8 +41,7 @@ import com.navi.common.downloader.DownloadUtil
|
||||
import com.navi.common.listeners.FragmentInterchangeListener
|
||||
import com.navi.common.listeners.HeaderInteractionListener
|
||||
import com.navi.common.utils.observeNonNull
|
||||
import com.navi.design.utils.parseColorSafe
|
||||
import com.navi.design.utils.setSpannableString
|
||||
import com.navi.design.utils.*
|
||||
import com.navi.naviwidgets.extensions.showWhenDataIsAvailable
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import java.net.URI
|
||||
@@ -116,6 +115,20 @@ class FundDetailsFragment : AmcBaseFragment() {
|
||||
hideDivider()
|
||||
}
|
||||
parentContainer.apply {
|
||||
rewards.root.isVisible = fundDetailScreenData?.content?.rewards?.let {
|
||||
binding.rewards.title.setSpannableString(it.title)
|
||||
binding.rewards.icon.showWhenDataIsAvailable(it.icon)
|
||||
binding.rewards.label.setSpannableString(it.label?.title)
|
||||
binding.rewards.label.background = getNaviDrawable(
|
||||
radii = CornerRadius(
|
||||
leftBottom = dpToPx(8)
|
||||
), backgroundColor = it.label?.bgColor.parseColorSafe()
|
||||
)
|
||||
binding.rewards.root.setBackgroundColor(it.bgColor.parseColorSafe())
|
||||
true
|
||||
} ?: run {
|
||||
false
|
||||
}
|
||||
fundDetailScreenData?.content?.amcHeaderData?.let {
|
||||
binding.header.setProperties(it)
|
||||
}
|
||||
|
||||
@@ -44,8 +44,7 @@ import com.navi.common.listeners.HeaderInteractionListener
|
||||
import com.navi.design.font.FontWeightEnum
|
||||
import com.navi.design.textview.model.NaviSpan
|
||||
import com.navi.design.textview.model.TextWithStyle
|
||||
import com.navi.design.utils.parseColorSafe
|
||||
import com.navi.design.utils.setSpannableString
|
||||
import com.navi.design.utils.*
|
||||
import com.navi.naviwidgets.extensions.showWhenDataIsAvailable
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import java.text.DecimalFormat
|
||||
@@ -206,6 +205,20 @@ class PaymentSummaryFragment : AmcBaseFragment() {
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.rewards.root.isVisible = it.content?.rewards?.let {
|
||||
binding.rewards.title.setSpannableString(it.title)
|
||||
binding.rewards.icon.showWhenDataIsAvailable(it.icon)
|
||||
binding.rewards.label.setSpannableString(it.label?.title)
|
||||
binding.rewards.label.background = getNaviDrawable(
|
||||
radii = CornerRadius(
|
||||
leftBottom = dpToPx(8)
|
||||
), backgroundColor = it.label?.bgColor.parseColorSafe()
|
||||
)
|
||||
binding.rewards.root.setBackgroundColor(it.bgColor.parseColorSafe())
|
||||
true
|
||||
} ?: run {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
viewModel.paymentInitiateData.observe(viewLifecycleOwner) {
|
||||
|
||||
@@ -30,7 +30,8 @@ data class FundBuyData(
|
||||
@SerializedName("fundInvestmentType") val fundInvestmentType: FundInvestmentType? = null,
|
||||
@SerializedName("note") val note: InformationCardData? = null,
|
||||
@SerializedName("sipBottomSheet") val sipBottomSheet: GenericErrorResponse? = null,
|
||||
@SerializedName("calendar") val calendarData: CalendarData? = null
|
||||
@SerializedName("calendar") val calendarData: CalendarData? = null,
|
||||
@SerializedName("rewards") val rewards: RewardsData? = null
|
||||
)
|
||||
|
||||
data class FundInvestmentType(
|
||||
|
||||
@@ -28,5 +28,7 @@ data class FundDetailScreenData(
|
||||
@SerializedName("fundGraphDetails")
|
||||
val fundGraphDetails: FundGraphDetails? = null,
|
||||
@SerializedName("note")
|
||||
val note : InformationCardData ?= null
|
||||
val note : InformationCardData ?= null,
|
||||
@SerializedName("rewards")
|
||||
val rewards: RewardsData? = null
|
||||
)
|
||||
@@ -22,16 +22,18 @@
|
||||
|
||||
<com.navi.design.textview.NaviTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginBottom="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:lineSpacingExtra="@dimen/dp_4"
|
||||
app:layout_constraintBottom_toTopOf="@id/divider"
|
||||
app:layout_constraintStart_toEndOf="@id/icon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Win instant ₹100 cashback\non completing KYC" />
|
||||
app:layout_constraintEnd_toStartOf="@id/label"
|
||||
tools:text="Win instant ₹100 cashback on completing KYC" />
|
||||
|
||||
<com.navi.design.textview.NaviTextView
|
||||
android:id="@+id/label"
|
||||
|
||||
@@ -17,17 +17,24 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:paddingBottom="@dimen/dp_40">
|
||||
|
||||
<include
|
||||
android:id="@+id/rewards"
|
||||
layout="@layout/amc_fund_list_reward"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginBottom="@dimen/dp_16"/>
|
||||
|
||||
<com.navi.amc.fundbuy.views.AmcHeaderView
|
||||
android:id="@+id/header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@id/rewards" />
|
||||
|
||||
<com.navi.amc.common.view.SwitchView
|
||||
android:id="@+id/switch_view"
|
||||
|
||||
@@ -22,6 +22,13 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include
|
||||
android:id="@+id/rewards"
|
||||
layout="@layout/amc_fund_list_reward"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_8"/>
|
||||
|
||||
<com.navi.amc.fundbuy.views.AmcHeaderView
|
||||
android:id="@+id/header"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -20,6 +20,14 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include
|
||||
android:id="@+id/rewards"
|
||||
layout="@layout/amc_fund_list_reward"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginBottom="@dimen/dp_8"/>
|
||||
|
||||
<com.navi.amc.fundbuy.views.AmcHeaderView
|
||||
android:id="@+id/header"
|
||||
android:layout_width="match_parent"
|
||||
@@ -27,7 +35,7 @@
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@id/rewards" />
|
||||
|
||||
<include
|
||||
android:id="@+id/amount"
|
||||
|
||||
@@ -56,6 +56,7 @@ class DashboardHolderFactoryImpl<T : NaviBaseAdapterModel> : ViewHolderTypeFacto
|
||||
private val PRODUCT_CLICK_CARD_CAROUSAL_WIDGET = R.layout.product_click_card_carousal_widget
|
||||
|
||||
private val FREE_INSURANCE_SUCCESS_WIDGET = R.layout.free_insurance_success_widget
|
||||
private val REWARDS_INFO_WIDGET = R.layout.layout_rewards_info
|
||||
}
|
||||
|
||||
override fun type(item: NaviBaseAdapterModel?): Int =
|
||||
@@ -91,6 +92,7 @@ class DashboardHolderFactoryImpl<T : NaviBaseAdapterModel> : ViewHolderTypeFacto
|
||||
is UrgentActionWidget -> URGENT_ACTION_WIDGET
|
||||
is ProductClickCardCarousalWidget -> PRODUCT_CLICK_CARD_CAROUSAL_WIDGET
|
||||
is GenericWidgetDataInfo -> GENERIC_WIDGET
|
||||
is RewardsInfoWidget -> REWARDS_INFO_WIDGET
|
||||
else -> {
|
||||
NaviTrackEvent.trackEvent(
|
||||
WIDGET_NOT_HANDLED_BY_APP,
|
||||
@@ -134,6 +136,7 @@ class DashboardHolderFactoryImpl<T : NaviBaseAdapterModel> : ViewHolderTypeFacto
|
||||
PRODUCT_CLICK_CARD_CAROUSAL_WIDGET -> ProductClickCardCarousalWidgetVH(parent)
|
||||
URGENT_ACTION_WIDGET -> UrgentActionWidgetVH(parent)
|
||||
GENERIC_WIDGET -> UnknownWidgetVH(parent)
|
||||
REWARDS_INFO_WIDGET -> RewardsInfoWidgetVH(parent)
|
||||
|
||||
else -> UnknownWidgetVH(parent)
|
||||
}
|
||||
|
||||
@@ -51,11 +51,16 @@ class TopProductHorizontalListLayout @JvmOverloads constructor(
|
||||
this.widgetPosition = position
|
||||
this.lifecycle = widgetCallback.getLifeCycle()
|
||||
lifecycle?.addObserver(this)
|
||||
setProperties()
|
||||
setProperties(position)
|
||||
}
|
||||
|
||||
private fun setProperties() {
|
||||
private fun setProperties(position: Int) {
|
||||
binding.apply {
|
||||
val lp = binding.root.layoutParams as? MarginLayoutParams
|
||||
if (lp != null && position > 0) {
|
||||
lp.topMargin = dpToPxInInt(24)
|
||||
binding.root.layoutParams = lp
|
||||
}
|
||||
widgetData.widgetData?.items?.forEachIndexed { index, topProductItem ->
|
||||
bindItem(topProductItem, index, widgetData.widgetData?.items?.size ?: 0)
|
||||
}
|
||||
|
||||
@@ -18,16 +18,18 @@
|
||||
|
||||
<com.navi.design.textview.NaviTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginBottom="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:lineSpacingExtra="@dimen/dp_4"
|
||||
app:layout_constraintBottom_toTopOf="@id/divider"
|
||||
app:layout_constraintStart_toEndOf="@id/icon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Win instant ₹100 cashback\non completing KYC" />
|
||||
app:layout_constraintEnd_toStartOf="@id/label"
|
||||
tools:text="Win instant ₹100 cashback on completing KYC" />
|
||||
|
||||
<com.navi.design.textview.NaviTextView
|
||||
android:id="@+id/label"
|
||||
|
||||
@@ -35,11 +35,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_38"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:layout_marginBottom="@dimen/dp_16"
|
||||
android:lineSpacingExtra="@dimen/dp_4"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/tvTag"
|
||||
app:layout_constraintStart_toEndOf="@id/ivIcon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Win rewards upto ₹5000 on every loan" />
|
||||
|
||||
Reference in New Issue
Block a user