[Modal Layout Picker] Create Layout Picker category bar UI using static data#12573
[Modal Layout Picker] Create Layout Picker category bar UI using static data#12573
Conversation
|
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
|
You can test the changes on this Pull Request by downloading the APK here. |
04acaf7 to
fc54662
Compare
|
Hello @iamthomasbishop 👋 , I have a question regarding the expected behavior when the user selected layout is filtered out (Selection dark gif above). Should we just hide it or also clear the user selection? Thank you in advance for your feedback 🙇 cc @chipsnyder |
IMO if the selection is filtered out then we should treat it as being deselected. |
I have a counter to @chipsnyder's opinion 😃 I would actually keep the selection, because:
Some of the early designs tried a couple of treatments/call-outs for the "selected" one, but in the end decided to keep it super simple and understood the trade-off would be exactly this situation (when filters toggle the row a selected item is in). |
…tegories # Conflicts: # WordPress/src/main/java/org/wordpress/android/ui/mlp/ModalLayoutPickerAdapter.kt # WordPress/src/main/java/org/wordpress/android/ui/mlp/ModalLayoutPickerFragment.kt
…tegories # Conflicts: # WordPress/src/main/java/org/wordpress/android/viewmodel/mlp/ModalLayoutPickerViewModel.kt
# Conflicts: # WordPress/src/main/java/org/wordpress/android/ui/mlp/LayoutSelectionListener.kt # WordPress/src/main/java/org/wordpress/android/ui/mlp/LayoutsAdapter.kt # WordPress/src/main/java/org/wordpress/android/ui/mlp/ModalLayoutPickerAdapter.kt # WordPress/src/main/java/org/wordpress/android/ui/mlp/ModalLayoutPickerFragment.kt # WordPress/src/main/java/org/wordpress/android/ui/mlp/ModalLayoutPickerListItem.kt # WordPress/src/main/java/org/wordpress/android/ui/mlp/ModalLayoutPickerViewHolder.kt # WordPress/src/main/java/org/wordpress/android/viewmodel/mlp/ModalLayoutPickerViewModel.kt # WordPress/src/main/res/values/colors.xml # WordPress/src/main/res/values/dimens.xml # WordPress/src/test/java/org/wordpress/android/viewmodel/mlp/ModalLayoutPickerViewModelTest.kt
Generated by 🚫 dangerJS |
WordPress/src/main/java/org/wordpress/android/ui/mlp/CategoryViewHolder.kt
Outdated
Show resolved
Hide resolved
| ) | ||
| category.setTextColor( | ||
| parent.context.getColorFromAttribute( | ||
| if (selected) attr.categoriesButtonTextSelected else attr.categoriesButtonText |
There was a problem hiding this comment.
Can we pass selected state values from the ViewModal itself instead of adding this logic in the ViewHolder?
Also instead of creating our own layouts to filter content, we can use pre-built material filter-chips. These can be added in a ChipGroup and put into a single line using singleLine. This is just a suggestion, feel free to ignore it 🙂.
There was a problem hiding this comment.
That's a good suggestion. I've moved the state values to UiState with 52cbeff.
Using the material filter-chips looks like a good improvement. I suggest to leave this to be revisited along with design feedback. Wdyt?
There was a problem hiding this comment.
I suggest to leave this to be revisited along with design feedback. Wdyt?
Sounds good 👍
WordPress/src/main/res/drawable/modal_layout_picker_category_background.xml
Outdated
Show resolved
Hide resolved
| <item name="categoriesButtonText">@color/white</item> | ||
| <item name="categoriesButtonBackground">@color/mlp_categories_button_background_dark</item> | ||
| <item name="categoriesButtonTextSelected">@color/black</item> | ||
| <item name="categoriesButtonBackgroundSelected">@color/mlp_categories_button_background_selected_dark</item> | ||
| <item name="categoriesButtonCheckIconColor">@color/black</item> | ||
| <item name="mlpDividerColor">@color/mlp_divider_dark</item> | ||
| <item name="categoriesBackground">@color/mlp_categories_background_dark</item> |
There was a problem hiding this comment.
Instead of using separate colors in values-night/styles.xml and values/styles.xml we can use color attributes from the Material Design theme.
e.g.
For categoriesButtonText which is
<item name="categoriesButtonText">@color/white</item> in dark mode
and
<item name="categoriesButtonText">@color/black</item> in light mode
we can use colorOnSurface which gives the same output and we need not add additional style attributes specially for Modal Layout Picker. Lmkwyt.
I myself get confused when to use new style or use these existing color attributes 🙂 but in the end find that we can eliminate most of such styles.
There was a problem hiding this comment.
Thank you! Wondering if we can eliminate remaining ones as well 🤔. These use different shades of grey:
categoriesBackground
categoriesButtonBackground
categoriesButtonBackgroundSelected
mlpDividerColor
Is it possible that we combine emphasis or alpha values with color attributes like colorSurface to get that shade? We can address it in design review. Feel free to ignore it here.
WordPress/src/main/java/org/wordpress/android/ui/mlp/ModalLayoutPickerFragment.kt
Outdated
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/viewmodel/mlp/ModalLayoutPickerViewModel.kt
Outdated
Show resolved
Hide resolved
Yes we can. Thank you for suggesting this :) |
Fixes: wordpress-mobile/gutenberg-mobile#2437
Related PRs:
Description
This PR implements the category bar in the header of the Starter Page Template Picker for new pages.
To test:
Layout Picker should show when creating a new page from My Site or Site Pages the Modal Layout Picker appears.
Note: For demo/testing purposes, the categories repeat the same layout 30 times because the static data only has one layout per category.
Select a Category
Select Multiple-Categories
Selecting a Layout then filter on the same category
Selecting a Layout then filter on the same category deselect layout
Selecting a Layout then filter on a different category
Selecting a Layout then filter on a different category select a different layout
Screenshots:
PR submission checklist:
RELEASE-NOTES.txtif necessary.