stripe / stripe-android

Stripe Android SDK
https://stripe.com/docs/mobile/android
MIT License
1.29k stars 648 forks source link

Fix `Card Brand Choice` animations when nested in bottom sheet. #9509

Closed samer-stripe closed 3 weeks ago

samer-stripe commented 3 weeks ago

Summary

Fix Card Brand Choice animations when nested in bottom sheet.

Motivation

Resolves https://github.com/stripe/stripe-android/issues/9130

Testing

Video

Before After
github-actions[bot] commented 3 weeks ago

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: V1, V2)
NEW: paymentsheet-example-release-pr.apk (signature: V1, V2)

          │          compressed           │          uncompressed          
          ├───────────┬───────────┬───────┼───────────┬───────────┬────────
 APK      │ old       │ new       │ diff  │ old       │ new       │ diff   
──────────┼───────────┼───────────┼───────┼───────────┼───────────┼────────
      dex │   4.1 MiB │   4.1 MiB │ +91 B │   8.9 MiB │   8.9 MiB │ +436 B 
     arsc │   2.3 MiB │   2.3 MiB │   0 B │   2.3 MiB │   2.3 MiB │    0 B 
 manifest │   5.1 KiB │   5.1 KiB │   0 B │  25.6 KiB │  25.6 KiB │    0 B 
      res │ 933.7 KiB │ 933.7 KiB │ -26 B │   1.5 MiB │   1.5 MiB │  -52 B 
   native │   2.6 MiB │   2.6 MiB │   0 B │     6 MiB │     6 MiB │    0 B 
    asset │   2.9 MiB │   2.9 MiB │ -24 B │   2.9 MiB │   2.9 MiB │  -24 B 
    other │ 201.3 KiB │ 201.3 KiB │ +12 B │ 443.4 KiB │ 443.4 KiB │    0 B 
──────────┼───────────┼───────────┼───────┼───────────┼───────────┼────────
    total │    13 MiB │    13 MiB │ +53 B │  22.1 MiB │  22.1 MiB │ +360 B 

 DEX     │ old   │ new   │ diff         
─────────┼───────┼───────┼──────────────
   files │     1 │     1 │  0           
 strings │ 43014 │ 43014 │  0 (+1 -1)   
   types │ 14527 │ 14527 │  0 (+0 -0)   
 classes │ 12112 │ 12112 │  0 (+0 -0)   
 methods │ 62506 │ 62509 │ +3 (+57 -54) 
  fields │ 41095 │ 41095 │  0 (+0 -0)   

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  242 │  242 │  0   
 entries │ 6274 │ 6274 │  0
APK ``` compressed │ uncompressed │ ──────────┬───────┼───────────┬────────┤ size │ diff │ size │ diff │ path ──────────┼───────┼───────────┼────────┼─────────────────────────────── 4.1 MiB │ +91 B │ 8.9 MiB │ +436 B │ ∆ classes.dex 460 B │ -26 B │ 824 B │ -52 B │ ∆ res/e-.xml 8.1 KiB │ -24 B │ 8 KiB │ -24 B │ ∆ assets/dexopt/baseline.prof 53.7 KiB │ +6 B │ 119.2 KiB │ 0 B │ ∆ META-INF/CERT.SF 50.5 KiB │ +6 B │ 119.1 KiB │ 0 B │ ∆ META-INF/MANIFEST.MF ──────────┼───────┼───────────┼────────┼─────────────────────────────── 4.2 MiB │ +53 B │ 9.1 MiB │ +360 B │ (total) ```
DEX ``` STRINGS: old │ new │ diff ───────┼───────┼─────────── 43014 │ 43014 │ 0 (+1 -1) + ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"6516fb8","r8-mode":"full","version":"8.5.35"} - ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"0d3a4e4","r8-mode":"full","version":"8.5.35"} METHODS: old │ new │ diff ───────┼───────┼────────────── 62506 │ 62509 │ +3 (+57 -54) + I2.D A(View) + I2.D B() + I2.D C(v) → x + I2.D E(View) + I2.D F() + I2.D G(long, long) + I2.D H(long) + I2.D I(b) + I2.D J(TimeInterpolator) + I2.D K(e) + I2.D L() + I2.D M(long) + I2.D O(String) → String + I2.D P(x) + I2.D Q(int) → x + I2.D o(ViewGroup) + I2.D v() → boolean + I2.f P(G) + I2.f s() → String[] + I2.f v() → boolean + I2.h P(G) + I2.h Q(View, float, float) → ObjectAnimator + I2.h R(G, float) → float + I2.h S(G, G) → T + I2.h s() → String[] + I2.h v() → boolean + I2.h w(G, G) → boolean + I2.x A(View) + I2.x B() + I2.x C(v) → x + I2.x E(View) + I2.x F() + I2.x G(long, long) + I2.x H(long) + I2.x I(b) + I2.x J(TimeInterpolator) + I2.x K(e) + I2.x L() + I2.x M(long) + I2.x N() + I2.x O(String) → String + I2.x o(ViewGroup) + I2.x p(View, boolean) → G + I2.x q() → x + I2.x r() → e + I2.x s() → String[] + I2.x t(View, boolean) → G + I2.x v() → boolean + I2.x w(G, G) → boolean + I2.x x(View) → boolean + I2.x y(G, G, String) → boolean + I2.x z(x, w, boolean) + com.stripe.android.view.CardBrandView a(ViewGroup) + com.stripe.android.view.CardBrandView b() → H0 + com.stripe.android.view.CardBrandView c() + com.stripe.android.view.CardBrandView d() → w1 + com.stripe.android.view.CardBrandView f() - I2.D A() - I2.D B(v) → x - I2.D C(View) - I2.D E() - I2.D F(long, long) - I2.D G(long) - I2.D H(b) - I2.D I(TimeInterpolator) - I2.D J(e) - I2.D K() - I2.D L(long) - I2.D N(String) → String - I2.D O(x) - I2.D P(int) → x - I2.D t() → boolean - I2.D z(View) - I2.f O(G) - I2.f r() → String[] - I2.f u() → boolean - I2.h O(G) - I2.h P(View, float, float) → ObjectAnimator - I2.h Q(G, float) → float - I2.h R(G, G) → T - I2.h r() → String[] - I2.h u() → boolean - I2.h v(G, G) → boolean - I2.x A() - I2.x B(v) → x - I2.x C(View) - I2.x E() - I2.x F(long, long) - I2.x G(long) - I2.x H(b) - I2.x I(TimeInterpolator) - I2.x J(e) - I2.x K() - I2.x L(long) - I2.x M() - I2.x N(String) → String - I2.x o(View, boolean) → G - I2.x p() → x - I2.x q() → e - I2.x r() → String[] - I2.x s(View, boolean) → G - I2.x t() → boolean - I2.x v(G, G) → boolean - I2.x w(View) → boolean - I2.x x(G, G, String) → boolean - I2.x y(x, w, boolean) - I2.x z(View) - com.stripe.android.view.CardBrandView a() → H0 - com.stripe.android.view.CardBrandView b() - com.stripe.android.view.CardBrandView c() → w1 - com.stripe.android.view.CardBrandView d() ```
samer-stripe commented 3 weeks ago

Couldn't figure out a way to test this behavior. Open to ideas on what we can do here.

samer-stripe commented 3 weeks ago

The other thing I don't like here is the animation canceling after quickly entering and deleting the 8 digits required to show the card brand choice chevron. I also couldn't find a good way to stop and reverse the animations.