-
Notifications
You must be signed in to change notification settings - Fork 130
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
Issue/11750 dashboard big screen support #13488
base: trunk
Are you sure you want to change the base?
Conversation
- Replace custom `WindowSizeClass` with `WindowWidthSizeClass` from `androidx.window.core.layout`. - Use `currentWindowAdaptiveInfo` instead custom extension that ignores screen width to calculate SizeClass - Update the number of columns in the Dashboard based on the Window Size Class. - Use a `Column` with vertical scrolling instead of `LazyColumn` when `numberOfColumns` is 1. - When multiple columns in a row instead of LazyVerticalStaggeredGrid that doesn't work well with nested scrolling interactions - Adds dependency to adaptiveAndroid
Generated by 🚫 Danger |
Project dependencies changesThe following changes in project dependencies were detected (configuration list
tree \--- androidx.preference:preference:1.2.1
\--- androidx.slidingpanelayout:slidingpanelayout:1.2.0
- \--- androidx.window:window:1.0.0
- +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.0 -> 2.1.10 (*)
- +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2 -> 1.8.1 (*)
- +--- androidx.annotation:annotation:1.2.0 -> 1.8.1 (*)
- +--- androidx.collection:collection:1.1.0 -> 1.4.0 (*)
- \--- androidx.core:core:1.3.2 -> 1.13.1 (*)
+ \--- androidx.window:window:1.0.0 -> 1.3.0
+ +--- androidx.annotation:annotation:1.3.0 -> 1.8.1 (*)
+ +--- androidx.collection:collection:1.1.0 -> 1.4.0 (*)
+ +--- androidx.core:core:1.8.0 -> 1.13.1 (*)
+ +--- androidx.window.extensions.core:core:1.0.0
+ | +--- androidx.annotation:annotation:1.6.0 -> 1.8.1 (*)
+ | \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.20 -> 2.1.10 (*)
+ +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.1.10 (*)
+ +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3 -> 1.8.1 (*)
+ \--- androidx.window:window-core:1.3.0 (c)
++--- androidx.compose:compose-bom:2024.09.01
+| \--- androidx.compose.material3.adaptive:adaptive-android:1.0.0 (c)
+\--- androidx.compose.material3.adaptive:adaptive-android:1.0.0
+ +--- androidx.annotation:annotation:1.1.0 -> 1.8.1 (*)
+ +--- androidx.annotation:annotation-experimental:1.4.0 -> 1.4.1 (*)
+ +--- androidx.compose.foundation:foundation:1.6.5 -> 1.7.1 (*)
+ +--- androidx.compose.ui:ui-geometry:1.6.5 -> 1.7.1 (*)
+ +--- androidx.window:window:1.3.0 (*)
+ +--- androidx.window:window-core:1.3.0
+ | \--- androidx.window:window-core-android:1.3.0
+ | +--- androidx.annotation:annotation:1.7.0 -> 1.8.1 (*)
+ | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.1.10 (*)
+ | \--- androidx.window:window:1.3.0 (c)
+ +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.1.10 (*)
+ \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.8.22 -> 2.1.10 (*) |
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
mainActivityViewModel: MainActivityViewModel, | ||
dashboardViewModel: DashboardViewModel, | ||
blazeCampaignCreationDispatcher: BlazeCampaignCreationDispatcher, | ||
widgetModifier: Modifier |
Check warning
Code scanning / Android Lint
Guidelines for Modifier parameters in a Composable function Warning
@@ -411,6 +411,7 @@ dependencies { | |||
implementation(libs.androidx.compose.material.icons.extended) | |||
implementation(libs.androidx.compose.ui.text.google.fonts) | |||
implementation(libs.androidx.navigation.compose) | |||
implementation(libs.androidx.adaptive.android) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this dependency to rely on official library to categorize screen size. We currently have a custom implmentation of WindowSizeClass but I think we should be using the official one. Also the custom implementation of WindowSizeClass
currently only exposes windowHeightSizeClass
but not windowWidthSizeClass
. So instead of manually adding windowWidthSizeClass
, I figured we could use the official size class library for it.
Setting the milestone to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that this fails:
> Task :WooCommerce:compileWasabiDebugAndroidTestKotlin FAILED
e: file:///Users/.../woocommerce-android/WooCommerce/src/androidTest/kotlin/com/woocommerce/android/e2e/screens/mystore/DashboardScreen.kt:17:37 Unresolved reference 'my_store_refresh_layout'.
Making tests execution impossible. This is caused by the removal of my_store_refresh_layout
from fragment_dashboard.xml
and probably can be fixed by replacing R.id.my_store_refresh_layout
in DashboardScreen.kt:17:37
by another component (ideally, unique), the presence of which can inform that we're on the Dashboard Screen.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #13488 +/- ##
============================================
- Coverage 37.89% 37.87% -0.02%
Complexity 8957 8957
============================================
Files 2050 2050
Lines 112100 112166 +66
Branches 14173 14187 +14
============================================
+ Hits 42476 42484 +8
- Misses 65745 65801 +56
- Partials 3879 3881 +2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JorgeMucientes I took a liberty of updating the missing reference in UI tests with 581d2e9, so tests-wise it's good to go now
Awesome @pachlava. Thanks so much for proactively taking a look into this 🥇 |
Closes: #13079
Description
Based on the changes I worked on here: pe5sF9-3si-p2 and resulting in this PR work, I've refactored the prior implementation to avoid using
LazyStaggeredGrid
to support big screen in the dashboard tab. Instead, this relies on a custom implementation that will manually add 2 or 3 columns to the dashboard based on the screen'scurrentWindowAdaptiveInfo().windowSizeClass
.Changes added:
NestedScrollView
. This was needed in order to add Composable colums with vertical scroll that work well/coordinate with the collapsing toolbar.There's one thing I'm not fully convinced. To determine the number of columns, I'm using windowSizeClass.windowWidthSizeClass.
This results in bigger phones showing 3 columns in landscape (see screen recordings below). I don't think it is a major issue, but I'd say two columns would look better. Let me know what you think, although I suspect it won't be straightforward to force two columns for mobile phones on landscape mode.
Testing information
Just run the app on the phone screen and tablet screen and check that the dashboard works as expected.
The tests that have been performed
The above ☝🏼
Images/gif
Tablet Experience
TablerLayout.mp4
Large phone Eexperience (Pixel 8 pro)
LargePhone.mp4
Smaller phone experience
smallerPhone.mp4
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: