diff --git a/README.md b/README.md index 02eb9275..09116e8a 100644 --- a/README.md +++ b/README.md @@ -315,13 +315,18 @@ The **Info** link at the end of the component will display a window containing m #### Configuring the Price Breakdown -Setting the `paymentBreakdown.introText` value will modify the opening word(s). -Options are in lowercase unless suffixed with `_TITLE` where they will be title case. -This can be set to any of the following where OR is default: +##### Intro Text +Setting `introText` is optional, will default to `OR` and must be of type `AfterpayIntroText`. +Can be any of `OR`, `OR_TITLE`, `MAKE`, `MAKE_TITLE`, `PAY`, `PAY_TITLE`, `IN`, `IN_TITLE`, `PAY_IN`, `PAY_IN_TITLE` or `EMPTY` (no intro text). +Intro text will be rendered lowercase unless using an option suffixed with `_TITLE` in which case title case will be rendered. + +```kotlin +let priceBreakdownView = PriceBreakdownView() +priceBreakdownView.introText = AfterpayIntroText.MAKE_TITLE ``` -paymentBreakdown.introText = AfterpayIntroText.OR|OR_TITLE|MAKE|MAKE_TITLE|PAY|PAY_TITLE|IN|IN_TITLE|PAY_IN|PAY_IN_TITLE|NONE -``` + +Given the above, the price breakdown text will be rendered `Make 4 interest-free payments of $##.##` ## Security diff --git a/afterpay/src/main/kotlin/com/afterpay/android/view/AfterpayIntroText.kt b/afterpay/src/main/kotlin/com/afterpay/android/view/AfterpayIntroText.kt index 26ba819e..3ad0cb68 100644 --- a/afterpay/src/main/kotlin/com/afterpay/android/view/AfterpayIntroText.kt +++ b/afterpay/src/main/kotlin/com/afterpay/android/view/AfterpayIntroText.kt @@ -3,7 +3,7 @@ package com.afterpay.android.view import com.afterpay.android.R enum class AfterpayIntroText(val resourceID: Int) { - NONE(R.string.afterpay_price_breakdown_intro_none), + EMPTY(R.string.afterpay_price_breakdown_intro_empty), MAKE_TITLE(R.string.afterpay_price_breakdown_intro_make_title), MAKE(R.string.afterpay_price_breakdown_intro_make), PAY_TITLE(R.string.afterpay_price_breakdown_intro_pay_title), diff --git a/afterpay/src/main/kotlin/com/afterpay/android/view/AfterpayPriceBreakdown.kt b/afterpay/src/main/kotlin/com/afterpay/android/view/AfterpayPriceBreakdown.kt index 8dfef7e1..3615d980 100644 --- a/afterpay/src/main/kotlin/com/afterpay/android/view/AfterpayPriceBreakdown.kt +++ b/afterpay/src/main/kotlin/com/afterpay/android/view/AfterpayPriceBreakdown.kt @@ -163,12 +163,12 @@ class AfterpayPriceBreakdown @JvmOverloads constructor( resources.getString(R.string.afterpay_price_breakdown_total_cost), resources.getString(introText.resourceID), afterpay.instalmentAmount - ), + ).trim(), description = String.format( resources.getString(R.string.afterpay_price_breakdown_total_cost_description), resources.getString(introText.resourceID), afterpay.instalmentAmount - ) + ).trim() ) is AfterpayInstalment.NotAvailable -> if (afterpay.minimumAmount != null) diff --git a/afterpay/src/main/res/values-en-rGB/strings.xml b/afterpay/src/main/res/values-en-rGB/strings.xml index 83ae57d5..fff79f31 100644 --- a/afterpay/src/main/res/values-en-rGB/strings.xml +++ b/afterpay/src/main/res/values-en-rGB/strings.xml @@ -6,7 +6,7 @@ Clear pay - %1$sfour interest free payments of %2$s with Clear pay + %1$s four interest free payments of %2$s with Clear pay Clear pay available for orders between %1$s – %2$s Clear pay available for orders up to %1$s Or pay with Clear pay diff --git a/afterpay/src/main/res/values/strings.xml b/afterpay/src/main/res/values/strings.xml index 05b1e675..55111df4 100644 --- a/afterpay/src/main/res/values/strings.xml +++ b/afterpay/src/main/res/values/strings.xml @@ -9,8 +9,8 @@ After pay - %1$s4 interest-free payments of %2$s with - %1$sfour interest free payments of %2$s with After pay + %1$s 4 interest-free payments of %2$s with + %1$s four interest free payments of %2$s with After pay available for orders between %1$s – %2$s After pay available for orders between %1$s – %2$s available for orders up to %1$s @@ -20,17 +20,17 @@ Info - - Make\u0020 - make\u0020 - Pay\u0020 - pay\u0020 - In\u0020 - in\u0020 - Or\u0020 - or\u0020 - Pay in\u0020 - pay in\u0020 + + Make + make + Pay + pay + In + in + Or + or + Pay in + pay in Pay now with After pay