Skip to content

Commit

Permalink
fix(basis-sdk): Fixed custom localization setting
Browse files Browse the repository at this point in the history
  • Loading branch information
llevente committed Oct 16, 2024
1 parent 92ec8ea commit d33e50c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class PaymentComponentView(context: Context, attrs: AttributeSet?) : ConstraintL

private fun restoreBankPickerDefaultState() {
LOG.debug("Restoring bank picker default state")
context?.wrappedWithGiniPaymentThemeAndLocale(GiniInternalPaymentModule.getSDKLanguage(context)?.languageLocale())?.let { context ->
context?.wrappedWithGiniPaymentThemeAndLocale(paymentComponent?.getGiniPaymentLanguage())?.let { context ->
payInvoiceButton.visibility = View.GONE
paymentProviderAppIconHolder.root.visibility = View.GONE
selectBankButton.text = context.getString(R.string.gps_select_bank)
Expand All @@ -206,7 +206,7 @@ class PaymentComponentView(context: Context, attrs: AttributeSet?) : ConstraintL

private fun customizeBankPicker(paymentProviderApp: PaymentProviderApp) {
LOG.debug("Customizing bank picker for payment provider app: {}", paymentProviderApp.name)
context?.wrappedWithGiniPaymentThemeAndLocale(GiniInternalPaymentModule.getSDKLanguage(context)?.languageLocale())?.let { context ->
context?.wrappedWithGiniPaymentThemeAndLocale(paymentComponent?.getGiniPaymentLanguage())?.let { context ->
selectBankButton.apply {
text = if (paymentComponent?.bankPickerRows == BankPickerRows.SINGLE) "" else paymentProviderApp.name
setCompoundDrawablesWithIntrinsicBounds(
Expand Down Expand Up @@ -256,7 +256,7 @@ class PaymentComponentView(context: Context, attrs: AttributeSet?) : ConstraintL

private fun restorePayInvoiceButtonDefaultState() {
LOG.debug("Restoring pay invoice button default state")
context?.wrappedWithGiniPaymentThemeAndLocale(GiniInternalPaymentModule.getSDKLanguage(context)?.languageLocale())?.let { context ->
context?.wrappedWithGiniPaymentThemeAndLocale(paymentComponent?.getGiniPaymentLanguage())?.let { context ->
payInvoiceButton.apply {
setBackgroundTint(
ContextCompat.getColor(
Expand Down Expand Up @@ -301,11 +301,13 @@ class PaymentComponentView(context: Context, attrs: AttributeSet?) : ConstraintL
}

private fun initViews() {
selectBankButton = if (paymentComponent?.bankPickerRows == BankPickerRows.TWO) binding.gpsSelectBankPicker.gpsSelectBankButton else binding.gpsSingleRowBankSelection.gpsSelectBankButton
payInvoiceButton = if (paymentComponent?.bankPickerRows == BankPickerRows.TWO) binding.gpsPayInvoiceButtonTwoRows else binding.gpsSingleRowBankSelection.gpsPayInvoiceButton
paymentProviderAppIconHolder = if (paymentComponent?.bankPickerRows == BankPickerRows.TWO) binding.gpsSelectBankPicker.gpsPaymentProviderAppIconHolder else binding.gpsSingleRowBankSelection.gpsPaymentProviderAppIconHolder
context?.wrappedWithGiniPaymentThemeAndLocale(paymentComponent?.getGiniPaymentLanguage())?.let { context ->
selectBankButton = if (paymentComponent?.bankPickerRows == BankPickerRows.TWO) binding.gpsSelectBankPicker.gpsSelectBankButton else binding.gpsSingleRowBankSelection.gpsSelectBankButton
payInvoiceButton = if (paymentComponent?.bankPickerRows == BankPickerRows.TWO) binding.gpsPayInvoiceButtonTwoRows else binding.gpsSingleRowBankSelection.gpsPayInvoiceButton
paymentProviderAppIconHolder = if (paymentComponent?.bankPickerRows == BankPickerRows.TWO) binding.gpsSelectBankPicker.gpsPaymentProviderAppIconHolder else binding.gpsSingleRowBankSelection.gpsPaymentProviderAppIconHolder

payInvoiceButton.text = if (reviewFragmentWillBeShown) resources.getString(R.string.gps_continue_to_overview) else resources.getString(R.string.gps_pay_button)
payInvoiceButton.text = if (reviewFragmentWillBeShown) context.getString(R.string.gps_continue_to_overview) else context.getString(R.string.gps_pay_button)
}
}

fun getMoreInformationLabel() = binding.gpsMoreInformation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/gps_select_bank_button"
style="@style/GiniPaymentTheme.Widget.Button.PaymentProviderSelector"
android:layout_width="0dp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
app:layout_constraintBottom_toBottomOf="@id/gps_powered_by_gini_label"
app:layout_constraintStart_toEndOf="@id/gps_powered_by_gini_label"
app:layout_constraintTop_toTopOf="@id/gps_powered_by_gini_label"
app:srcCompat="@drawable/gps_gini_logo" />
android:src="@drawable/gps_gini_logo"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
tools:visibility="visible"/>
</FrameLayout>

<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/gps_pay_invoice_button_two_rows"
style="@style/GiniPaymentTheme.Widget.Button.OutlinedButton"
android:layout_width="0dp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
app:layout_constraintBottom_toBottomOf="@id/gps_select_bank_button"
/>

<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/gps_select_bank_button"
style="@style/GiniPaymentTheme.Widget.Button.PaymentProviderSelector"
android:layout_width="0dp"
Expand All @@ -42,7 +42,7 @@
app:layout_constraintTop_toTopOf="parent"
/>

<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/gps_pay_invoice_button"
style="@style/GiniPaymentTheme.Widget.Button.OutlinedButton"
android:layout_width="0dp"
Expand Down

0 comments on commit d33e50c

Please sign in to comment.