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

JetStream and Catalog updates #165

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

pflammertsma
Copy link
Member

@pflammertsma pflammertsma commented Apr 26, 2024

JetStream:

  • added adaptive banner

TV Material Catalog:

  • minor UI tweaks
  • resolved bug causing recomposition
  • remember and restore focus in HomeGrid

@pflammertsma pflammertsma changed the title added adaptive banner JetStream and Catalog updates Apr 26, 2024
)

val componentsPlanned = listOf(
Component.NavigationDrawer,
Copy link
Contributor

Choose a reason for hiding this comment

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

NavigationDrawer is part of Beta right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but this is just a placeholder and the implementation is not there yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it.

Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
Row(
horizontalArrangement = Arrangement.spacedBy(16.dp),
modifier = Modifier.padding(0.dp, 0.dp, 8.dp, 0.dp)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: While reading the code, It is hard to guess what side this padding is applied to. We could make use of named arguments like: Modifier.padding(bottom = 8.dp) or Modifier.padding(right = 8.dp) and this way, we won't have to set the other values to 0, explicitly.

)

val componentsPlanned = listOf(
Component.NavigationDrawer,
Copy link
Contributor

Choose a reason for hiding this comment

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

Got it.

Comment on lines +44 to +45
.focusRequester(focusRequester)
.focusRestorer(),
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need to make use of focusRequester modifier to save and restore focus when using focusRestorer modifier.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removing this gives me an exception:

 java.lang.IllegalStateException: 
    FocusRequester is not initialized. Here are some possible fixes:
 
    1. Remember the FocusRequester: val focusRequester = remember { FocusRequester() }
    2. Did you forget to add a Modifier.focusRequester() ?
    3. Are you attempting to request focus during composition? Focus requests should be made in
    response to some event. Eg Modifier.clickable { focusRequester.requestFocus() }

onClick = { navHostController.navigate(component.routeValue) },
Card(
onClick = {
onClick?.invoke()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: The following code can be simpler and easier to understand:

if(onClick != null) {
  onClick()
}

@Composable
fun ComponentsGridCard(
component: Component,
modifier: Modifier = Modifier
modifier: Modifier = Modifier,
onClick: (() -> Any)? = null
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you elaborate on this? I believe click event handler does not need to return value, so the type of onClick parameter should be as follows. The suggested code would simplify the code to call the callback:

onClick: () -> Unit = {}

@@ -1,13 +1,13 @@
[versions]
agp = "8.3.1"
agp = "8.3.2"
Copy link
Contributor

Choose a reason for hiding this comment

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

We should update AGP version to "8.4.0" as Android Studio Jellyfish became stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants