Issue/11119 search in set parent page#11269
Conversation
… to handle search
Generated by 🚫 dangerJS |
…119-search-in-set-parent-page Merged with upstream feature/master-search-in-set-parent-page
malinajirka
left a comment
There was a problem hiding this comment.
Thanks @zwarm, great job;)!
I've reviewed the code and tested the app and I encountered a couple of issues.
- Search state gets lost on configuration change
- Open Page list
- Click on Set Page
- Click on Search icon in the Toolbar
- Enter a query
- Rotate the device and observe the state gets lost
- Save button state gets lost on configuration change (This might not be related to this PR. In case it isn't related, please create a new issue on GitHub)
- Open Page list
- Click on Set Page
- Select one of the pages -> notice "Save" button appears
- Click on Search icon
- Click on the Up button
- Notice "Save" button is invisible even though the page is still selected
this implementation separates the search into a PageParentSearchFragment
and PageParentSearchVieModel
Have you considered filtering the items directly in PageParentViewModel/PageParentFragment? I'm not saying the approach you took isn't good. I understand you decided to prefer consistency. I'd just love to know your thoughts about it.
WordPress/src/main/java/org/wordpress/android/viewmodel/pages/PageParentViewModel.kt
Outdated
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/ui/pages/PageParentFragment.kt
Outdated
Show resolved
Hide resolved
WordPress/src/test/java/org/wordpress/android/viewmodel/pages/PageParentSearchViewModelTest.kt
Outdated
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/viewmodel/pages/PageParentViewModel.kt
Outdated
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/ui/pages/PageParentSearchViewModel.kt
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/viewmodel/pages/PageParentViewModel.kt
Outdated
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/viewmodel/pages/PageParentViewModel.kt
Outdated
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/ui/pages/PageParentFragment.kt
Show resolved
Hide resolved
Yes I did, I had coded both solutions and in the end decided to PR this one to maintain consistency. I can just as easily kill this PR & submit the other instead. lmk |
…other view models
|
I need some clarification around expected behavior upon searching .... Thanks!
Scenario 1
Scenario 2
Scenario 3
Scenario 4
Scenario 5 (Happens in production)
|
… = true for filtering on query text
|
Thanks for all the improvements @zwarm ! The changes look great. I haven't tested the code as I wasn't sure if you plan to make changes to the Save button behavior.
Ohh nice ;). I don't want you to replace the solution, I like it. I was just curious how did you make the decision. It's all clear now :). Thanks Thanks for listing the different scenarios! ;)
I think Save should be gone.
I think Save should be gone.
I think Save should be gone.
I agree with you. Could you please fill a bug report. Thanks! To summarize it. I think Save should be visible when a non-initial item is selected and visible on the screen (Save should be also visible when the selected item is not visible due to a different scroll position). SideNote:
Wdyt? |
|
@malinajirka - Still have one open question regarding "text" ... leave as is or needs to be something custom? |
👍 - thanks for letting me know, will definitely follow this guideline from this point forward. This will be adjusted as part of the Save button visibility changes for searching - can't really avoid fixing it if the logic is changing. Do you still want a separate ticket for it?
Thanks for all the comments. :) |
Ohh sorry, I forgot about that. I've discussed it with a designer and it's ok to keep it as it is.
Nope, no need to create a separate ticket. If you expect it'll require more changes, feel free to open a new PR against this PR. |
|
@malinajirka I think should take care of everything you wanted done. Please let me know if there is a scenario I have not accounted for. Thanks. For quick reference, this is what was implemented for the behavior Scenario 1 Scenario 2 Scenario 3 Scenario 4 **Scenario 5 ** **Note: If a value is selected while in search, that value remains selected when search is closed. |
There was a problem hiding this comment.
Thanks for all the changes @zwarm! The code looks good. I've two more scenarios about which I'm not sure about. Let me know what you think about them:).
- Select a parent (eg "Test page")
- Tap on search
- Type "Test"
- Notice "Test Page" is visible and selected, but the SAVE button isn't (Should it be selected? Should the Save button be visible? Wdyt?)
- Tap on search
- Type something so there is at least one result
- Rotate your device
- Click on "Clear search"
- Notice the results didn't disappear
I don't expect a real user will encounter either of the scenarios, wdyt?
WordPress/src/main/java/org/wordpress/android/ui/pages/PageParentFragment.kt
Show resolved
Hide resolved
@malinajirka - 1) - If an item is selected, it should stay selected. I can go either way on the save button. It sounds like that would be a designer/behavior decision. 2) Not a scenario I had thought of, but if you did then it's absolutely possible that customer may. |
|
Thanks for the reply ;)!
I don't wont to delay the trial on such minor issues about which we are not even sure how to proceed. Could you please create GitHub issues for them. I'll add a low priority label to both of them and "needs design" label to the second one. Thank you 🙇 The only remaining thing before I merge this PR is this comment - https://github.com/wordpress-mobile/WordPress-Android/pull/11269/files#r377068726. I'd rather avoid changing the Project.xml, wdyt? SideNot: |
|
Oops on the "pound" sign - didn't even cross my mind it would link out. I edited my post. I see the other comment, I'll revert it back. |
|
@malinajirka #d4000c0 Reverted back the .idea/codeStyles/Project.xml file to the commit before mine. Obviously I needed to make a new commit reverting the file back to that state. I can’t just change history because it’s already been pushed. You know, editing history throws off everyone else’s stuff. |
No worries ;)
👍 Yeah, revert is fine. Thanks! LGTM 🚢 |
401a294
into
wordpress-mobile:feature/master-search-in-set-parent-page
Fixes #: #11119
Description:
This PR adds search capabilities to the Set Parent page. It is 95% complete. Following along with the
pattern in Site Pages, this implementation separates the search into a
PageParentSearchFragmentand
PageParentSearchVieModel, both of which have been added to the necc. dagger modules. A new layout file (page_parent_fragment.xml) was introduced forPageParentFragmentto hold the FrameLayout for the search and page_parent_menu.xml was expanded to hold a new SearchView. The searching takes advantage of LiveData, ViewModels and observability to provide the user with a clean UI experience.While this PR is 95% complete, there are still a few lingering questions that may require action.
1 - Does the text need to be adjusted when showing the suggestion or empty results? Right now that
text is shared as ...
No pages matching your search
Search pages
If changes are necessary, two new string would be required + any language translations required.
2 - As of this PR submittal, the search is locally performed on the parent page options during page load. It is unclear if the search needs to be performed against the database each and every time. If so, then the search logic will need to be updated to reflect that.
Testing instructions:
Test starting prompt is shown
Test search text found
Test search text found
PR submission checklist:
RELEASE-NOTES.txtif necessary.