Add new credit card and bank transfer glyphs.

This commit is contained in:
Alex Hart
2023-10-10 11:59:48 -03:00
committed by Cody Henthorne
parent 8425bb4f59
commit 5f7099184d
10 changed files with 127 additions and 70 deletions

View File

@@ -58,7 +58,7 @@ class BecomeASustainerFragment : DSLSettingsBottomSheetFragment() {
space(DimensionUnit.DP.toPixels(32f).toInt())
tonalButton(
tonalWrappedButton(
text = DSLSettingsText.from(
R.string.BecomeASustainerMegaphone__become_a_sustainer
),

View File

@@ -16,7 +16,6 @@ import org.thoughtcrime.securesms.components.settings.DSLSettingsAdapter
import org.thoughtcrime.securesms.components.settings.DSLSettingsBottomSheetFragment
import org.thoughtcrime.securesms.components.settings.DSLSettingsIcon
import org.thoughtcrime.securesms.components.settings.DSLSettingsText
import org.thoughtcrime.securesms.components.settings.NO_TINT
import org.thoughtcrime.securesms.components.settings.app.subscription.DonationPaymentComponent
import org.thoughtcrime.securesms.components.settings.app.subscription.donate.DonateToSignalType
import org.thoughtcrime.securesms.components.settings.app.subscription.models.GooglePayButton
@@ -106,7 +105,7 @@ class GatewaySelectorBottomSheet : DSLSettingsBottomSheetFragment() {
primaryButton(
text = DSLSettingsText.from(R.string.GatewaySelectorBottomSheet__credit_or_debit_card),
icon = DSLSettingsIcon.from(R.drawable.credit_card, NO_TINT),
icon = DSLSettingsIcon.from(R.drawable.credit_card, R.color.signal_colorOnPrimary),
onClick = {
findNavController().popBackStack()
val response = GatewayResponse(GatewayResponse.Gateway.CREDIT_CARD, args.request)
@@ -118,9 +117,9 @@ class GatewaySelectorBottomSheet : DSLSettingsBottomSheetFragment() {
if (state.isSEPADebitAvailable) {
space(8.dp)
primaryButton(
tonalButton(
text = DSLSettingsText.from(R.string.GatewaySelectorBottomSheet__bank_transfer),
icon = DSLSettingsIcon.from(R.drawable.credit_card, NO_TINT), // TODO [sepa] -- Final icon
icon = DSLSettingsIcon.from(R.drawable.bank_transfer),
onClick = {
findNavController().popBackStack()
val response = GatewayResponse(GatewayResponse.Gateway.SEPA_DEBIT, args.request)

View File

@@ -177,10 +177,21 @@ class DSLConfiguration {
fun tonalButton(
text: DSLSettingsText,
icon: DSLSettingsIcon? = null,
isEnabled: Boolean = true,
onClick: () -> Unit
) {
val preference = Button.Model.Tonal(text, null, isEnabled, onClick)
val preference = Button.Model.Tonal(text, icon, isEnabled, onClick)
children.add(preference)
}
fun tonalWrappedButton(
text: DSLSettingsText,
icon: DSLSettingsIcon? = null,
isEnabled: Boolean = true,
onClick: () -> Unit
) {
val preference = Button.Model.TonalWrapped(text, icon, isEnabled, onClick)
children.add(preference)
}

View File

@@ -16,6 +16,7 @@ object Button {
mappingAdapter.registerFactory(Model.Primary::class.java, LayoutFactory({ ViewHolder(it) }, R.layout.dsl_button_primary))
mappingAdapter.registerFactory(Model.PrimaryWrapped::class.java, LayoutFactory({ ViewHolder(it) }, R.layout.dsl_button_primary_wrapped))
mappingAdapter.registerFactory(Model.Tonal::class.java, LayoutFactory({ ViewHolder(it) }, R.layout.dsl_button_tonal))
mappingAdapter.registerFactory(Model.TonalWrapped::class.java, LayoutFactory({ ViewHolder(it) }, R.layout.dsl_button_tonal_wrapped))
mappingAdapter.registerFactory(Model.SecondaryNoOutline::class.java, LayoutFactory({ ViewHolder(it) }, R.layout.dsl_button_secondary))
}
@@ -56,6 +57,13 @@ object Button {
onClick: () -> Unit
) : Model<Tonal>(title, icon, isEnabled, onClick)
class TonalWrapped(
title: DSLSettingsText?,
icon: DSLSettingsIcon?,
isEnabled: Boolean,
onClick: () -> Unit
) : Model<TonalWrapped>(title, icon, isEnabled, onClick)
class SecondaryNoOutline(
title: DSLSettingsText?,
icon: DSLSettingsIcon?,