Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Adyen SDK is overriding the custom App Theme in App. #1961

Open
AmitavSingh opened this issue Jan 14, 2025 · 9 comments
Open

Android Adyen SDK is overriding the custom App Theme in App. #1961

AmitavSingh opened this issue Jan 14, 2025 · 9 comments
Labels
Question Indicates issue only requires an answer to a question

Comments

@AmitavSingh
Copy link

Description

I notice that while using the latest Adyen sdk in Android v5.8.0 is overriding the customized App theme of the Android App.
For Example - My App doesn't use a toolbar, but when I updated the sdk from v4.13.X to v5.8.0, I see a toolbar in my app. On on investigating more I found that it is coming from Adyen sdk and the root cause is this line -

image

This line is the source of the bug of displaying the toolbar as it overrides the custom app theme.
It should be the other way round like this and its well implemented for AdyenCheckout -

<style name="Adyen" parent="AppTheme"/>

image

Steps to Reproduce

  1. I am able to consistently reproduce this issue: Yes
  2. Steps to reproduce the issue:
    1. Customize you app theme and hide the toolbar
    2. Update you Adyen adk to v5.8.0
    3. You will see a toolbar

Code Snippets

image
@AmitavSingh AmitavSingh added the Bug report Indicates that issue has been marked as a possible bug label Jan 14, 2025
@OscarSpruit
Copy link
Contributor

Hi @AmitavSingh, thank you for reaching out! This setup is designed this way on purpose. It provides a base styling in case AppTheme is not overridden. In your case could you try adding <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar" /> to see if that fixes the issue with the toolbars?

@OscarSpruit OscarSpruit added Question Indicates issue only requires an answer to a question and removed Bug report Indicates that issue has been marked as a possible bug labels Jan 14, 2025
@AmitavSingh
Copy link
Author

AmitavSingh commented Jan 14, 2025

Hi @OscarSpruit I tried your solution, it didn't work.
Screenshot 2025-01-14 at 17 55 41

Screenshot 2025-01-14 at 17 54 00

I don't think adding <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar" /> will work as adyen will override this.

@OscarSpruit
Copy link
Contributor

In our example app we use what I suggested before and also in other projects we have this applies the style correctly.

There are two things that I can think of that could be the cause:

  • In your AndroidManifest.xml, is there a different theme set from the one you intend to use?
  • Could you try to replace windowActionBar with android:windowActionBar?

@AmitavSingh
Copy link
Author

AmitavSingh commented Jan 15, 2025

Hi @OscarSpruit I replaced windowActionBar with android:windowActionBar, but that also failed to solve the issue.

image

If I use this <style name="Adyen" parent="@style/AppTheme" />, my application crashes because Adyen uses "Theme.MaterialComponents.Light" whereas my app uses "Theme.MaterialComponents.DayNight".

@OscarSpruit
Copy link
Contributor

<style name="Adyen" parent="@style/AppTheme" /> creates an infinite loop, because AppTheme depends on Adyen and vice versa. In the screenshot of your app you shared earlier we can see that the status bar is transparent, so it seems like the Adyen library is not overriding your theme.

I am trying to reproduce this issue in a test project with the below styling. However, there is no tool bar shown when using this.

<style name="AppThemeBase" parent="Theme.MaterialComponents.DayNight.NoActionBar">
    <item name="android:windowLightStatusBar">true</item>
</style>

<style name="AppTheme" parent="AppThemeBase">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

Few questions:

  1. When you exclude the Adyen library from your project, does the issue persist?
  2. What theme is defined in your AndroidManifest.xml?
  3. In your activity's layout or class, is there any mention of Toolbar or Actionbar?

@AmitavSingh
Copy link
Author

AmitavSingh commented Jan 16, 2025

Hi @OscarSpruit You can reproduce it if you choose a different theme in your test app. (Not the one used in Adyen SDK)
Infact it's not just about seeing a Toolbar, but some other properties also.

And Indeed Adyen library will override my AppTheme as per the screenshot I have shared above.

However, I tried with renaming my AppTheme to a custom one (TestAppTheme) and now Adyen can't override it, and I can see my UI properly.

image

But this is ofcourse not the ideal solution as Adyen forces me to rename my AppTheme.

@OscarSpruit
Copy link
Contributor

@AmitavSingh following your steps I still can't reproduce it. Could you please provide a reproducer project?

@AmitavSingh
Copy link
Author

Hi @OscarSpruit I fixed the issue on my side by Renaming my Theme. (Not using AppTheme anymore).

But my last question on this is why Adyen theme is getting added instead of AdyenCheckout, if you have any idea?

We are using below Adyen dependencies into our project.

const val adyen3ds2 = "com.adyen.checkout:3ds2:${Versions.Other.adyenAndroid}"
const val adyenGooglePay = "com.adyen.checkout:googlepay:${Versions.Other.adyenAndroid}"
const val adyenQrcode = "com.adyen.checkout:qr-code:${Versions.Other.adyenAndroid}"
const val adyenRedirect = "com.adyen.checkout:redirect:${Versions.Other.adyenAndroid}"
const val adyenWechat = "com.adyen.checkout:wechatpay:${Versions.Other.adyenAndroid}"

@OscarSpruit
Copy link
Contributor

This is a remnant from the past. The idea was that most projects already have AppTheme defined, so we would automatically use that to build on top off. Thus far it worked, but we learned here it doesn't always. For now we have to keep it for backwards compatibility, but we will improve styling and the way it works in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Indicates issue only requires an answer to a question
Projects
None yet
Development

No branches or pull requests

2 participants