Skip to content

[WOOPRD-470][Woo POS][Product search] Implement animation of navigating to the search #13993

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

Open
wants to merge 20 commits into
base: trunk
Choose a base branch
from

Conversation

kidinov
Copy link
Contributor

@kidinov kidinov commented Apr 30, 2025

Closes: #WOOPRD-470

Description

  • Animation of the closing and opening of the search
  • Transition to the coupons, search states
  • Also I fixed a bug related to the padding on the empty query search state (check the second video). Before it was scrolling up to the saerch input itself, not aligned with the rest of the lists

Figma link in the issue

Steps to reproduce

  • Open the POS
  • Click on the search
  • Click on the coupons
  • Notice the animations

In debug builds, it's slower, so to test properly, use release build with FFs ON

@malinajirka your feedback is welcome here!

The tests that have been performed

Above

Images/gif

05-01--11-43.mp4
05-01--12-02.mp4
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

@dangermattic
Copy link
Collaborator

dangermattic commented Apr 30, 2025

1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Apr 30, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commita5975eb
Direct Downloadwoocommerce-wear-prototype-build-pr13993-a5975eb.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Apr 30, 2025

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commita5975eb
Direct Downloadwoocommerce-prototype-build-pr13993-a5975eb.apk

@kidinov kidinov marked this pull request as draft May 1, 2025 05:56
@kidinov kidinov requested a review from samiuelson May 1, 2025 09:44
@kidinov kidinov marked this pull request as ready for review May 1, 2025 09:50
@kidinov kidinov added this to the 22.4 milestone May 1, 2025
@samiuelson samiuelson self-assigned this May 1, 2025
@samiuelson samiuelson requested a review from Copilot May 5, 2025 08:24
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements new animations and transitions for the POS product search, including refined padding adjustments and state transitions between search, product, and coupon screens. Key changes include:

  • Reordering of the padding and scroll modifiers for the empty search query state.
  • Updated toolbar transitions using Box, fadeIn/fadeOut animations, and a dedicated animation duration constant.
  • Replacement of conditional Composables with a Crossfade transition in the items screen and refactoring of animation logic in the search input component.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
WooPosItemsEmptySearchQueryStateScreen.kt Adjusted modifier chaining to fix padding alignment for the empty search state.
WooPosItemsToolbar.kt Modified layout structure and refined search state animation transitions.
WooPosItemsScreen.kt Introduced Crossfade to switch between product, search, and coupon screens.
WooPosSearchInput.kt Rewritten animation logic, replacing custom transitions with AnimatedVisibility and focus-based animations.
Comments suppressed due to low confidence (3)

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/common/composeui/component/WooPosSearchInput.kt:218

  • [nitpick] Ensure that combining focusRequester with onFocusChanged in the Modifier chain does not introduce unintended side effects with the component's animations.
.onFocusChanged { focusState -> isFocused = focusState.isFocused }

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/search/WooPosItemsEmptySearchQueryStateScreen.kt:62

  • Confirm that reordering .verticalScroll() and .padding() is intended, as the change in modifier order could affect the layout's scroll behavior.
.padding(top = WooPosSpacing.Large.value.toAdaptivePadding())

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/WooPosItemsScreen.kt:112

  • [nitpick] Verify that the Crossfade transition with a 300ms tween duration provides smooth performance on lower-spec devices, given that it replaces multiple conditional Composables.
Crossfade(

@codecov-commenter
Copy link

codecov-commenter commented May 5, 2025

Codecov Report

Attention: Patch coverage is 0.95238% with 208 lines in your changes missing coverage. Please review.

Project coverage is 38.28%. Comparing base (ca8123a) to head (a5975eb).
Report is 8 commits behind head on trunk.

Files with missing lines Patch % Lines
...os/common/composeui/component/WooPosSearchInput.kt 1.21% 162 Missing ⚠️
...android/ui/woopos/home/items/WooPosItemsToolbar.kt 0.00% 46 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #13993      +/-   ##
============================================
- Coverage     38.29%   38.28%   -0.01%     
  Complexity     9496     9496              
============================================
  Files          2118     2118              
  Lines        116436   116446      +10     
  Branches      14937    14927      -10     
============================================
+ Hits          44585    44586       +1     
- Misses        67774    67783       +9     
  Partials       4077     4077              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@samiuelson samiuelson left a comment

Choose a reason for hiding this comment

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

👋 @kidinov, the app is crashing on config change with the following error:

java.lang.IllegalStateException: MutableState(value=Open(input=Hint(hint=Search products), isLoading=false, hasAnimationPlayed=true))@83275281 cannot be saved using the current SaveableStateRegistry. The default implementation only supports types which can be stored inside the Bundle. Please consider implementing a custom Saver for this class and pass it to rememberSaveable().

Steps to repro:

  1. Go to POS
  2. Click Search
  3. Switch theme mode

This seems to be introduced in this PR.

kidinov added 3 commits May 5, 2025 14:23
…-implement-animation-of-navigating-to' into wooprd-470-woo-posproduct-search-implement-animation-of-navigating-to
@kidinov
Copy link
Contributor Author

kidinov commented May 5, 2025

@samiuelson Good catch!

Fixed that here

50d54a1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants