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

Fix focus when navigating across compose fields #5195

Merged
merged 8 commits into from
Jun 23, 2022
Merged

Conversation

brnunes-stripe
Copy link
Contributor

Summary

Recent dependency upgrades changed the order in which the UI elements take focus, so we need to explicitly set their next and previous focus direction.

Motivation

Fix focus order.

Testing

  • Added tests
  • Modified tests
  • Manually verified

@github-actions
Copy link
Contributor

github-actions bot commented Jun 22, 2022

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: none)
NEW: paymentsheet-example-release-pr.apk (signature: none)

          │           compressed           │          uncompressed          
          ├───────────┬───────────┬────────┼──────────┬──────────┬──────────
 APK      │ old       │ new       │ diff   │ old      │ new      │ diff     
──────────┼───────────┼───────────┼────────┼──────────┼──────────┼──────────
      dex │  14.8 MiB │  14.8 MiB │ +1 KiB │ 50.2 MiB │ 50.2 MiB │ +1.1 KiB 
     arsc │   1.7 MiB │   1.7 MiB │    0 B │  1.7 MiB │  1.7 MiB │      0 B 
 manifest │   3.6 KiB │   3.6 KiB │    0 B │ 16.4 KiB │ 16.4 KiB │      0 B 
      res │ 819.9 KiB │ 819.9 KiB │    0 B │  1.3 MiB │  1.3 MiB │      0 B 
   native │   2.5 MiB │   2.5 MiB │    0 B │  5.9 MiB │  5.9 MiB │      0 B 
    asset │     3 MiB │     3 MiB │  -13 B │    3 MiB │    3 MiB │    -13 B 
    other │  80.2 KiB │  80.2 KiB │    0 B │  155 KiB │  155 KiB │      0 B 
──────────┼───────────┼───────────┼────────┼──────────┼──────────┼──────────
    total │  22.9 MiB │  22.9 MiB │ +1 KiB │ 62.3 MiB │ 62.3 MiB │ +1.1 KiB 

         │          raw           │             unique             
         ├────────┬────────┬──────┼────────┬────────┬──────────────
 DEX     │ old    │ new    │ diff │ old    │ new    │ diff         
─────────┼────────┼────────┼──────┼────────┼────────┼──────────────
   files │      4 │      4 │    0 │        │        │              
 strings │ 235637 │ 235649 │  +12 │ 207475 │ 207482 │ +7 (+45 -38) 
   types │  41530 │  41530 │    0 │  38372 │  38372 │  0 (+2 -2)   
 classes │  35704 │  35704 │    0 │  35704 │  35704 │  0 (+2 -2)   
 methods │ 210739 │ 210743 │   +4 │ 203494 │ 203494 │  0 (+31 -31) 
  fields │ 155311 │ 155317 │   +6 │ 154313 │ 154319 │ +6 (+12 -6)  

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  292 │  292 │  0   
 entries │ 5795 │ 5795 │  0
APK
    compressed    │    uncompressed    │                               
─────────┬────────┼─────────┬──────────┤                               
 size    │ diff   │ size    │ diff     │ path                          
─────────┼────────┼─────────┼──────────┼───────────────────────────────
 2.7 MiB │ +1 KiB │ 8.5 MiB │ +1.1 KiB │ ∆ classes3.dex                
 7.1 KiB │  -13 B │   7 KiB │    -13 B │ ∆ assets/dexopt/baseline.prof 
─────────┼────────┼─────────┼──────────┼───────────────────────────────
 2.7 MiB │ +1 KiB │ 8.5 MiB │ +1.1 KiB │ (total)
DEX
STRINGS:

   old    │ new    │ diff         
  ────────┼────────┼──────────────
   207475 │ 207482 │ +7 (+45 -38) 
  + .
  
  ���
  
  ���
  
  ���
  
  ���
  
  �� 
  ���
  ���
  ���
  ����_���0�2�����0�2�����0�2�������0�2������
  ����0
  ��0	2�������0
  2������0
  2�������0
  H�ø�ø��¢���������
  ���
  ��¡�0�¨��
  + P
  
  ���
  
  �� 
  ���
  
  ���
  ���
  ���
  ���
  ���
  
  ���
  
  ���
  ���
  
  ���
  ���
  ���
  ���
  ���
  ����#���0�2��������0�0�2�����0�H�¢�����c����0�2��	��0
  2�����0�2����0
  2�������0�2�������������0�����0�0�2�������0�2�������0�H�ø�ø��¢������������0�2�������0�H�¢�����[����0�2��	��0
  2�������0�2
  ��������0�2����0
  2�����0�2�������������0�����0�0�H�ø�ø��¢����� ���!��0�2����0�2�����0�H�¢���#���
  ���
  ��¡�0�¨�_
  + _nextFocusDirection
  + _previousFocusDirection
  + (Lcom/stripe/android/ui/core/elements/TextFieldController;ZILandroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;IILandroidx/compose/runtime/Composer;II)V
  + (ZLcom/stripe/android/ui/core/elements/SectionFieldElement;Landroidx/compose/ui/Modifier;Ljava/util/List;Lcom/stripe/android/ui/core/elements/IdentifierSpec;IILandroidx/compose/runtime/Composer;II)V
  + C(TextField)P(6!1,1:c#ui.text.input.ImeAction!1,4,3:c#ui.focus.FocusDirection,5:c#ui.focus.FocusDirection)
  + Lcom/stripe/android/ui/core/elements/RowElementUIKt_RowElementUI_1_1_1_1;
  + Lcom/stripe/android/ui/core/elements/RowElementUIKt_RowElementUI_2;
  + SMAP
  RowElementUI.kt
  Kotlin
  *S Kotlin
  *F
  + 1 RowElementUI.kt
  com/stripe/android/ui/core/elements/RowElementUIKt
  + 2 _Collections.kt
  kotlin/collections/CollectionsKt___CollectionsKt
  + 3 Composables.kt
  androidx/compose/runtime/ComposablesKt
  + 4 Composer.kt
  androidx/compose/runtime/ComposerKt
  + 5 Dp.kt
  androidx/compose/ui/unit/DpKt
  + 6 Row.kt
  androidx/compose/foundation/layout/RowKt
  + 7 Layout.kt
  androidx/compose/ui/layout/LayoutKt
  + 8 CompositionLocal.kt
  androidx/compose/runtime/CompositionLocal
  *L
  1#1,73:1
  764#2:74
  855#2,2:75
  1858#2,2:118
  1860#2:128
  25#3:77
  460#3,13:104
  36#3:120
  473#3,3:129
  1057#4,3:78
  1060#4,3:82
  1057#4,6:121
  155#5:81
  175#5:127
  75#6,6:85
  81#6:117
  85#6:133
  75#7:91
  76#7,11:93
  89#7:132
  76#8:92
  *S KotlinDebug
  *F
  + 1 RowElementUI.kt
  com/stripe/android/ui/core/elements/RowElementUIKt
  *L
  27#1:74
  27#1:75,2
  33#1:118,2
  33#1:128
  28#1:77
  32#1:104,13
  53#1:120
  32#1:129,3
  28#1:78,3
  28#1:82,3
  53#1:121,6
  28#1:81
  65#1:127
  32#1:85,6
  32#1:117
  32#1:133
  32#1:91
  32#1:93,11
  32#1:132
  32#1:92
  *E
  
  + SMAP
  RowElementUI.kt
  Kotlin
  *S Kotlin
  *F
  + 1 RowElementUI.kt
  com/stripe/android/ui/core/elements/RowElementUIKt_RowElementUI_1_1_1_1
  + 2 Dp.kt
  androidx/compose/ui/unit/DpKt
  *L
  1#1,73:1
  175#2:74
  *S KotlinDebug
  *F
  + 1 RowElementUI.kt
  com/stripe/android/ui/core/elements/RowElementUIKt_RowElementUI_1_1_1_1
  *L
  55#1:74
  *E
  
  + SMAP
  TextFieldUI.kt
  Kotlin
  *S Kotlin
  *F
  + 1 TextFieldUI.kt
  com/stripe/android/ui/core/elements/TextFieldUIKt
  + 2 CompositionLocal.kt
  androidx/compose/runtime/CompositionLocal
  + 3 Composables.kt
  androidx/compose/runtime/ComposablesKt
  + 4 Composer.kt
  androidx/compose/runtime/ComposerKt
  + 5 Effects.kt
  androidx/compose/runtime/EffectsKt
  + 6 Effects.kt
  androidx/compose/runtime/EffectsKt_rememberCoroutineScope_1
  + 7 SnapshotState.kt
  androidx/compose/runtime/SnapshotStateKt__SnapshotStateKt
  *L
  1#1,284:1
  76#2:285
  36#3:286
  25#3:297
  1057#4,6:287
  1057#4,3:298
  1060#4,3:304
  473#5,4:293
  477#5,2:301
  481#5:307
  473#6:303
  76#7:308
  76#7:309
  76#7:310
  76#7:311
  76#7:312
  76#7:313
  76#7:314
  102#7,2:315
  76#7:317
  76#7:318
  76#7:319
  102#7,2:320
  76#7:322
  *S KotlinDebug
  *F
  + 1 TextFieldUI.kt
  com/stripe/android/ui/core/elements/TextFieldUIKt
  *L
  103#1:285
  160#1:286
  223#1:297
  160#1:287,6
  223#1:298,3
  223#1:304,3
  223#1:293,4
  223#1:301,2
  223#1:307
  223#1:303
  62#1:308
  104#1:309
  105#1:310
  106#1:311
  107#1:312
  108#1:313
  110#1:314
  110#1:315,2
  112#1:317
  115#1:318
  116#1:319
  116#1:320,2
  225#1:322
  *E
  
  + SMAP
  TextFieldUI.kt
  Kotlin
  *S Kotlin
  *F
  + 1 TextFieldUI.kt
  com/stripe/android/ui/core/elements/TextFieldUIKt_AnimatedIcons_target_2_1
  + 2 _Collections.kt
  kotlin/collections/CollectionsKt___CollectionsKt
  *L
  1#1,284:1
  1849#2,2:285
  *S KotlinDebug
  *F
  + 1 TextFieldUI.kt
  com/stripe/an
...✂

@brnunes-stripe brnunes-stripe changed the base branch from master to brnunes/testfix June 23, 2022 01:27
Base automatically changed from brnunes/testfix to master June 23, 2022 17:56
@brnunes-stripe brnunes-stripe merged commit 7a56828 into master Jun 23, 2022
@brnunes-stripe brnunes-stripe deleted the brnunes/card branch June 23, 2022 17:57
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