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 SDK] Handle edge-to-edge for ApiFaker, AppSettings and MagicLink Activities #13599

Merged

Conversation

hichamboushaba
Copy link
Member

@hichamboushaba hichamboushaba commented Feb 20, 2025

Closes: #13350

Description

This PR handles the following changes:

  • Simplify the edge-to-edge handling for the Settings Activity by following the same approach that was used in this PR [Android SDK] Fix edge-to-edge support of MainActivity in API < 30 #13590 (ie: applying top padding to the app bar layout, and other paddings to the root layout). The simplification fixes few issues that I encountered like the lacking shadow in the Feedback screen, and simplifies handling for some other screens like the API Faker fragment.
  • Fix edge-to-edge handling for the API faker UI hint.
  • Handle edge-to-edge for the MagicLink intercept activity.

For the other cases, I didn't do any changes:

  • LoginActivity: I think the edge to edge handling that was added as part of the branding update works well, @irfano please let me know if I missed some cases.
  • Zendesk activities: we don't use those in the app.

Steps to reproduce

  • Test various screens from the AppSettings Activity.
  • Test the ApiFaker feature (from Developer Options).
  • Use a device with API 35 and a device with API 29 for the tests.

Testing information

  • Confirm the edge-to-edge handling works well across all devices.

The tests that have been performed

^

Images/gif


  • 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.

@hichamboushaba hichamboushaba added type: task An internally driven task. milestone-not-required Prevents the Milestone check to fail the build labels Feb 20, 2025
@hichamboushaba hichamboushaba changed the base branch from trunk to issue/edge-to-edge-fix-for-API-before-30 February 20, 2025 16:51
@hichamboushaba hichamboushaba changed the title [Android SDK] Handle edge-to-edge for AppSettings and MagicLink Activities [Android SDK] Handle edge-to-edge for ApiFaker, AppSettings and MagicLink Activities Feb 20, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Feb 20, 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
Commitdd745d8
Direct Downloadwoocommerce-wear-prototype-build-pr13599-dd745d8.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Feb 20, 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
Commitdd745d8
Direct Downloadwoocommerce-prototype-build-pr13599-dd745d8.apk

Comment on lines -74 to -78
.fillMaxSize()
.background(color = colorResource(id = R.color.color_toolbar))
.windowInsetsPadding(
WindowInsets.systemBars.only(WindowInsetsSides.Top)
)
Copy link
Member Author

Choose a reason for hiding this comment

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

With the new handling in AppSettingsActivity, we don't need this, and we achieve the same behavior.

Also, setting the background of the Scaffold to color_toolbar felt off, so IMO now it's cleaner.

@@ -59,7 +59,6 @@ theme across the entire app. Overridden versions should be added to the styles.x
AppBarLayout Style
-->
<style name="Woo.AppBarLayout" parent="Widget.MaterialComponents.AppBarLayout.Surface">
<item name="android:fitsSystemWindows">true</item>
Copy link
Member Author

Choose a reason for hiding this comment

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

Given that we handle the insets ourselves, we don't need this, and also when this is used, we end up with double the padding.

val systemInsets = insets.getInsets(
WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()
)
binding.root.doOnApplyWindowInsets(consumeInsets = true) { insets ->
Copy link
Member Author

@hichamboushaba hichamboushaba Feb 20, 2025

Choose a reason for hiding this comment

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

There is no change here, I just simplified the code by using the new extension that was added in this PR.

@hichamboushaba hichamboushaba force-pushed the issue/13350-edge-to-edge-kiwi branch from e8cfdb0 to 2d0b4c0 Compare February 20, 2025 17:38
@hichamboushaba hichamboushaba added the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Feb 20, 2025
@hichamboushaba hichamboushaba force-pushed the issue/13350-edge-to-edge-kiwi branch from 2d0b4c0 to a24d748 Compare February 20, 2025 17:45
@hichamboushaba hichamboushaba marked this pull request as ready for review February 20, 2025 17:48
Base automatically changed from issue/edge-to-edge-fix-for-API-before-30 to 13270-android-sdk-update-target-sdk-to-35 February 21, 2025 11:44
@hichamboushaba hichamboushaba removed the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Feb 21, 2025
@irfano irfano self-assigned this Feb 24, 2025
@irfano
Copy link
Contributor

irfano commented Feb 24, 2025

@hichamboushaba, I have two points:

  • Should we support Android 15's edge-to-edge feature, should we focus solely on fixing layout issues without fully supporting it? We previously discussed this here. I see that this PR is aimed at fixing layout issues rather than supporting edge-to-edge.
  • I noticed some issues on API 28 and API 35 devices when 3-button navigation is enabled. I'm listing the images below, could you take a look?



@hichamboushaba
Copy link
Member Author

Should we support Android 15's edge-to-edge feature, should we focus solely on fixing layout issues without fully supporting it? We previously discussed this #13469 (comment). I see that this PR is aimed at fixing layout issues rather than supporting edge-to-edge.

IMO fixing the layout issues should be enough for this task, supporting edge-to-edge fully would require more effort and ideally should be validated by a designer.

But, still, if we revisit the points you mentioned in this comment, I think that the fixes shipped in this PR satisfies most of them (I'm speaking specifically about the SettingsActivity, the LoginActivity is a different storey which I'll discuss below):

  • We set the status bar color to the same color as the application bar.
  • We make sure the content doesn't overlap with cutouts.

I think the only point that's missing is having scrollable content expanding below the navigation bar, and this will require considerable changes given how fragmented our screens, we have fragments that still use the view system and we have Composable fragments, so if we want to achieve this, we'll need to disable handling the inset at the activity level, and handle it on each fragment, which IMO should be outside of the scope here, please let me know what you think.

I noticed some issues on API 28 and API 35 devices when 3-button navigation is enabled. I'm listing the images below, could you take a look?

Thanks for sharing these, it appears these issues happen in the LoginActivity, I assumed we correctly handled the screen as part of the brand updates project, but it seems there are still some issues, I'll take a look at these and try to fix them in this PR.

The Help&Support screenshot is from the HelpActivity which is not in the scope of this PR, @kidinov I see that you were planning to work on this screen, are you are aware of the above issues?

@kidinov
Copy link
Contributor

kidinov commented Feb 25, 2025

@hichamboushaba 👋

I think this PR breaks it. It looks fine on the target branch

image image

@hichamboushaba
Copy link
Member Author

I think this PR breaks it. It looks fine on the target branch

Thanks for checking @kidinov and sorry for the noise, I'll check what changed.

@hichamboushaba
Copy link
Member Author

@irfano the last changes should have fixed all the issues that were raised:

API 35 API 28
Screenshot_20250225_121953 Screenshot_20250225_125314
Screenshot_20250225_122001 Screenshot_20250225_125323
Screenshot_20250225_122009 Screenshot_20250225_125333
Screenshot_20250225_122016 Screenshot_20250225_125339
Screenshot_20250225_122023 Screenshot_20250225_125346
Screenshot_20250225_122028 Screenshot_20250225_125351
Screenshot_20250225_122546 Screenshot_20250225_133909
Screenshot_20250225_122552 Screenshot_20250225_133919
Screenshot_20250225_134135 Screenshot_20250225_134150
Screenshot_20250225_134143 Screenshot_20250225_134156

As discussed, I will create a separate PR to fix the prologue carousel issue in trunk.

And the issue with DialogFragments that you noticed in the login screen impacts the MainActivity as well, so we should spend some time auditing and fixing them. The cause here is that the DialogFragments use their own Window, so the Acitivity's enableEdgeToEdge doesn't have an effect for them.
An example:

cc @kidinov

Copy link

coderabbitai bot commented Feb 26, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@irfano irfano left a comment

Choose a reason for hiding this comment

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

Great job, @hichamboushaba! It’s well-handled across all screens. LGTM! 👍🏻

@irfano irfano merged commit 101343e into 13270-android-sdk-update-target-sdk-to-35 Feb 26, 2025
14 of 18 checks passed
@irfano irfano deleted the issue/13350-edge-to-edge-kiwi branch February 26, 2025 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
milestone-not-required Prevents the Milestone check to fail the build type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants