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

Fix search list #68

Closed
wants to merge 28 commits into from
Closed

Fix search list #68

wants to merge 28 commits into from

Conversation

imashnake0
Copy link
Owner

@imashnake0 imashnake0 commented Nov 15, 2022

Padding is still a mess but this works better than the current implementation. As @boswelja suggested, we should probably use custom layouts to automatically apply padding.

Summary of changes:

1. This is only to test the new Search component, we probably won't merge this since padding in Home is a goddamn mess, i.e., I concede to @boswelja's awful Scaffold refactor.
2. Let's refactor to a Scaffold somehow and bring in this new component.

  1. Renamed component to Search since it is not necessarily a "bar".
  2. Stop making a network request when clearing the search 💀.
  3. Made the container occupy the entire screen and added a nice animation to it's alpha.
  4. Added imePadding().
  5. Added imeNestedScroll().
  6. Drew "behind" the search bar.

Tested changes:

:heh:

Renamed to `Search` because the list is included ⇒ not a "bar".
The container looks better now.
Removed code from #25.
This a hack to some extent, we should probably change this after we start using Scaffolds.
@imashnake0 imashnake0 added the wontfix This will not be worked on label Nov 15, 2022
@imashnake0 imashnake0 requested a review from boswelja November 15, 2022 21:30
@imashnake0 imashnake0 added enhancement Enhancement and removed wontfix This will not be worked on labels Nov 15, 2022
@imashnake0 imashnake0 marked this pull request as ready for review November 15, 2022 21:43
@imashnake0 imashnake0 changed the title Fix search list draft Fix search list Nov 15, 2022
This was linked to issues Nov 15, 2022
@imashnake0 imashnake0 marked this pull request as draft November 15, 2022 21:48
The list is drawn behind the search bar now. The "best" result is at the top by default so I set padding to make the list start from just below the status bar.
FQ R class was used.
@imashnake0 imashnake0 marked this pull request as ready for review November 16, 2022 01:49
start = dimensionResource(R.dimen.large_padding),
end = dimensionResource(R.dimen.large_padding)
),
navController = navController
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we lift navController out of SearchBar while we're here? Passing a lambda can achieve the same thing while making it slightly easier to change nav framework in the future

The ripple has a pill shape now.
@imashnake0 imashnake0 requested a review from boswelja November 16, 2022 09:36
@@ -11,7 +11,9 @@ class MediaRepository @Inject constructor(
) {
suspend fun fetchMedia(id: Int?, mediaType: MediaType): MediaQuery.Media? {
// TODO: Is there a better way to "wait for animations to complete"?
delay(100)
// searchBarBottomPadding's animateDpAsState has a finishedListener, how do I propagate
Copy link
Collaborator

Choose a reason for hiding this comment

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

When you're faced with strange and complex logic like this, it usually means you need to rethink your approach to whatever you're doing in general
Of course, there are cases where complex logic is needed, but I don't think it's this :P
Why do we need to wait for animations to complete before navigating?

@@ -177,9 +215,7 @@ fun ExpandedSearchBar(viewModel: SearchViewModel = viewModel()) {
IconButton(
onClick = {
text = ""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does text not update based on VM state automatically? Maybe we can do something about that

},
modifier = Modifier
.align(Alignment.End)
.wrapContentSize(),
.wrapContentWidth()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does wrapContentWidth make a difference here?

@imashnake0 imashnake0 closed this Nov 19, 2022
@imashnake0 imashnake0 reopened this Nov 19, 2022
@imashnake0 imashnake0 closed this Dec 1, 2022
@imashnake0 imashnake0 reopened this Dec 2, 2022
@@ -62,7 +62,7 @@ import com.imashnake.animite.R as Res
)
@Composable
fun SearchFrontDrop(
modifier: Modifier,
modifier: Modifier = Modifier,
Copy link
Collaborator

@boswelja boswelja Dec 5, 2022

Choose a reason for hiding this comment

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

Default parameters should be last in the list, bring navController up (or remove it as per my last comment).

Copy link
Owner Author

Choose a reason for hiding this comment

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

o7

@imashnake0 imashnake0 closed this Dec 19, 2022
@imashnake0 imashnake0 deleted the fix-search-list branch December 19, 2022 06:17
@imashnake0 imashnake0 mentioned this pull request Jan 7, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search list goes beyond the screen Jittery keyboard launch
3 participants