Skip to content

Adding new embedded theming token types to Android SDK#12695

Merged
mirandajiang-stripe merged 20 commits into
masterfrom
new-tokens-android
Apr 6, 2026
Merged

Adding new embedded theming token types to Android SDK#12695
mirandajiang-stripe merged 20 commits into
masterfrom
new-tokens-android

Conversation

@mirandajiang-stripe

@mirandajiang-stripe mirandajiang-stripe commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

r? @stripe/mx-mobile-reviewers
r? @stripe/android-sdk-reviewers

Summary

In this PR, the mappings of Android SDK names to the web ConnectJS names of the new theming tokens for embedded components were added. This change allows platforms to customize embedded components on Android as well, ensuring a consistent experience across mobile and web.

Additionally, a new testing interface for the theming tokens was added in connect-example. This allows for easier testing of the new tokens since users can granularly change the values. Previously, we could only see a difference in theme by changing a preset theme, which would make it difficult to see the effects the changes would have and catch any bugs with testing.

Some parameters were deprecated due to the addition of the new classes Form and Action. The deprecated parameters were moved out of the Colors class if it was a token that affected Form or Action components since it is better categorized there.

Motivation

Platforms requested more granular theming to ensure the embedded UI matches their native UI. New tokens that allow finer control over padding, font, and color for components have been implemented on ConnectJS behind the enable_new_embedded_theming_tokens flag. The last phase of implementation is to bring this to mobile SDKs.

For more context: Adding additional theming functionality for embedded components

Testing

Testing was done locally with the Android Simulator. A screen recording is provided below

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Screen.Recording.2026-03-30.at.9.39.26.AM.mov

Changelog

@github-actions

github-actions Bot commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Diffuse output:

OLD: identity-example-release-base.apk (signature: V1, V2)
NEW: identity-example-release-pr.apk (signature: V1, V2)

          │          compressed          │         uncompressed         
          ├───────────┬───────────┬──────┼───────────┬───────────┬──────
 APK      │ old       │ new       │ diff │ old       │ new       │ diff 
──────────┼───────────┼───────────┼──────┼───────────┼───────────┼──────
      dex │   2.2 MiB │   2.2 MiB │  0 B │   4.6 MiB │   4.6 MiB │  0 B 
     arsc │   1.2 MiB │   1.2 MiB │  0 B │   1.2 MiB │   1.2 MiB │  0 B 
 manifest │   2.3 KiB │   2.3 KiB │  0 B │     8 KiB │     8 KiB │  0 B 
      res │   298 KiB │   298 KiB │  0 B │ 447.6 KiB │ 447.6 KiB │  0 B 
   native │  18.6 MiB │  18.6 MiB │  0 B │  18.6 MiB │  18.6 MiB │  0 B 
    asset │   7.9 KiB │   7.9 KiB │  0 B │   7.7 KiB │   7.7 KiB │  0 B 
    other │ 110.1 KiB │ 110.1 KiB │  0 B │ 235.1 KiB │ 235.1 KiB │  0 B 
──────────┼───────────┼───────────┼──────┼───────────┼───────────┼──────
    total │  22.4 MiB │  22.4 MiB │  0 B │    25 MiB │    25 MiB │  0 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 22058 │ 22058 │ 0 (+0 -0) 
   types │  6589 │  6589 │ 0 (+0 -0) 
 classes │  5318 │  5318 │ 0 (+0 -0) 
 methods │ 32267 │ 32267 │ 0 (+0 -0) 
  fields │ 18595 │ 18595 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  158 │  158 │  0   
 entries │ 3979 │ 3979 │  0
APK
   compressed    │  uncompressed   │                     
──────────┬──────┼──────────┬──────┤                     
 size     │ diff │ size     │ diff │ path                
──────────┼──────┼──────────┼──────┼─────────────────────
 29.3 KiB │ +3 B │   65 KiB │  0 B │ ∆ META-INF/CERT.SF  
  1.2 KiB │ -3 B │  1.2 KiB │  0 B │ ∆ META-INF/CERT.RSA 
──────────┼──────┼──────────┼──────┼─────────────────────
 30.5 KiB │  0 B │ 66.2 KiB │  0 B │ (total)

@jaynewstrom-stripe jaynewstrom-stripe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can fix the build errors by running ./gradlew detektFormat --no-configuration-cache locally.

You can make sure there won't be any build/CI issues by running CI=true ./gradlew :connect:compileDebugKotlin locally.

Comment thread connect/src/main/java/com/stripe/android/connect/appearance/Colors.kt Outdated
@Poko
@PreviewConnectSDK
class Action private constructor(
@ColorInt internal val colorText: Int? = null,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a need for the default here?

Suggested change
@ColorInt internal val colorText: Int? = null,
@ColorInt internal val colorText: Int?,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This same comment applies to nearly all the new things. I think you can get rid of them all.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was following the same pattern as the existing classes. They all have <type>? = null. Should I be changing it for the new classes? Or follow that same pattern?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these all should have builders, there shouldn't be a need for defaults (and it just bloats the code, as the kotlin compiler generates additional code for this pattern).

Comment thread connect/src/main/java/com/stripe/android/connect/appearance/Badge.kt Outdated
@mirandajiang-stripe mirandajiang-stripe marked this pull request as ready for review March 30, 2026 16:47
@mirandajiang-stripe mirandajiang-stripe requested review from a team as code owners March 30, 2026 16:47
@mirandajiang-stripe

Copy link
Copy Markdown
Contributor Author

The bitrise check is failing and I'm not too sure why. It would be great if I could have some help figuring out what the issue is!

Comment thread connect/api/connect.api
Comment thread connect/api/connect.api
@Poko
@PreviewConnectSDK
class Action private constructor(
@ColorInt internal val colorText: Int? = null,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these all should have builders, there shouldn't be a need for defaults (and it just bloats the code, as the kotlin compiler generates additional code for this pattern).

Comment thread connect/src/main/java/com/stripe/android/connect/appearance/Colors.kt Outdated
Comment thread connect/src/main/java/com/stripe/android/connect/appearance/Colors.kt Outdated
Comment thread connect/src/main/java/com/stripe/android/connect/appearance/BadgeDefaults.kt Outdated
Comment thread connect/src/main/java/com/stripe/android/connect/appearance/ButtonDefaults.kt Outdated

@gimenete-stripe gimenete-stripe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! I left a few comments.

Would be also good to add some tests.

Comment thread connect/src/main/java/com/stripe/android/connect/appearance/Colors.kt Outdated
Comment thread connect/api/connect.api Outdated
public final class com/stripe/android/connect/appearance/BadgeDefaults : android/os/Parcelable {
public static final field $stable I
public static final field CREATOR Landroid/os/Parcelable$Creator;
public fun <init> (Ljava/lang/Float;Ljava/lang/Float;Lcom/stripe/android/connect/appearance/Typography$Style;)V

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constructor should be private/internal.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it private now but ./gradlew apiDump still generates it with public final class which is the pattern that all the classes follow in this file.

Comment thread connect/api/connect.api Outdated
public final class com/stripe/android/connect/appearance/ButtonDefaults : android/os/Parcelable {
public static final field $stable I
public static final field CREATOR Landroid/os/Parcelable$Creator;
public fun <init> (Ljava/lang/Float;Ljava/lang/Float;Lcom/stripe/android/connect/appearance/Typography$Style;)V

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constructor should be private/internal.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing with my comment from above

Comment thread connect/api/connect.api
@mirandajiang-stripe

mirandajiang-stripe commented Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

Looking good! I left a few comments.

Would be also good to add some tests.

Thanks for the feedback! I added some tests to check that the new tokens are mapping properly and serializes to the correct values. I also added tests to check the deprecated parameters don't cause a breaking change. It still works if the parameters in Form and Action aren't defined, but when they are defined, then the value within the Form and Action classes are used.

gimenete-stripe
gimenete-stripe previously approved these changes Apr 2, 2026

@gimenete-stripe gimenete-stripe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving since my feedback has been addressed! Great work!

Not sure about the constructors being private/internal. I'm not a Kotlin expert.

@mirandajiang-stripe

Copy link
Copy Markdown
Contributor Author

Approving since my feedback has been addressed! Great work!

Not sure about the constructors being private/internal. I'm not a Kotlin expert.

Thank you! I had to make some new changes because the bitrise check was failing but I just had to rebase and it's passing now. Could I get it approved again?

@gimenete-stripe gimenete-stripe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@samer-stripe samer-stripe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mirandajiang-stripe mirandajiang-stripe merged commit a30e29c into master Apr 6, 2026
19 checks passed
@mirandajiang-stripe mirandajiang-stripe deleted the new-tokens-android branch April 6, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants