Coder Social home page Coder Social logo

Comments (10)

yschimke avatar yschimke commented on July 3, 2024 1

OK, I'll leave this API. That's basically by design.

So stick with the API you are using.

from horologist.

yschimke avatar yschimke commented on July 3, 2024 1

If you want square devices, then you probably want to control everything. A lot of these changes are only with round devices in mind.

So I'll keep that API for you. Hopefully everything else works automatically like RSB even if you control layout manually

from horologist.

yschimke avatar yschimke commented on July 3, 2024

Adding in here. #2088

I was tempted to mark this method as deprecated. But if you want to use the default ScalingLazyColumn API and also AppScaffold/ScreenScaffold then it's still useful.

Generally we want to encourage use or rememberResponsiveColumnState(padding) as it should give a better result across devices and content variants.

from horologist.

Digipom avatar Digipom commented on July 3, 2024

I just migrated from Horologist 0.5.6 to 0.5.22 so I also migrated from WearNavScaffold / scrollable to AppScaffold / SwipeDismissableNavHost / composable with columnState.

I'm still using scalingLazyColumnDefaults in two places:

  1. My media player:
    val columnState = rememberColumnState(
    factory = ScalingLazyColumnDefaults.scalingLazyColumnDefaults(
    initialCenterIndex = 0
    )
    )
  2. The main screen:
    ScalingLazyColumnDefaults.scalingLazyColumnDefaults(
    autoCentering = AutoCenteringParams(itemIndex = 0),
    initialCenterIndex = 0,
    userScrollEnabled = shouldUserScrollBeEnabled,
    )

Is the responsive layout able to replicate this behavior?

0.5.22 doesn't seem to have a "rememberResponsiveColumnState" but rememberColumnState takes a factory that defaults to ScalingLazyColumnDefaults.responsive().

from horologist.

yschimke avatar yschimke commented on July 3, 2024

0.5.23 has this API. We got internal guidance that we should adjust the padding based on the content.

See here for an example

https://github.com/android/wear-os-samples/blob/main/ComposeStarter/app/src/main/java/com/example/android/wearable/composestarter/presentation/MainActivity.kt#L136

You can see a diff here using it https://github.com/android/wear-os-samples/pull/1020/files including screenshots

from horologist.

Digipom avatar Digipom commented on July 3, 2024

@yschimke I tried it and it no longer centers the contents.

i.e.:

val columnState = rememberColumnState(
                        factory = ScalingLazyColumnDefaults.scalingLazyColumnDefaults(
                            initialCenterIndex = 0
                        )
                    )

vs
val columnState = rememberResponsiveColumnState()

imageimage

I tried adjusting verticalAlignment and contentPadding but to no avail. Should I just stay with scalingLazyColumnDefaults for now? If this behavior is not possible with the new APIs, then I would request to please not deprecate the old ones. Thank you.

from horologist.

Digipom avatar Digipom commented on July 3, 2024

I also noticed another regression where you can no longer scroll items to the centre of the screen on some lists; I have to investigate this one further.

from horologist.

Digipom avatar Digipom commented on July 3, 2024

@yschimke Just for more clarity, what am I missing by not using the rememberResponsiveColumnState() or rememberColumnState() that uses a responsive factory by default? I know the library is in active development but all of the different options are a little overwhelming. Thank you.

from horologist.

yschimke avatar yschimke commented on July 3, 2024

I also noticed another regression where you can no longer scroll items to the centre of the screen on some lists; I have to investigate this one further.

There is no guarantee that you can scroll items to the center the screen. If you want that you can use autoCentering. But the new APIs try to achieve the right amount of padding, so content isn't clipped.

You aren't missing anything if you are happy to control the layout how you want.

The aim in general is for APIs that neatly solve two problems

  • Most effectively using available space even as the content, device size and font scaling change
  • Avoid clipping that might cause play store rejections

The library and API is evolving with updating guidance from UX teams.

It started with

WearNavScaffold + rememberColumnState(Factory) and Factory was belowTimeText()

evolved to

WearNavScaffold + rememberColumnState(Factory) and Factory was responsive()

And now a much nicer IMHO API of

AppScaffold/ScreenScaffold + rememberResponsiveColumnState(... ItemType, ItemType ...)

Unfortunately Horologist will always be experimental as requirements change with the hope to get the right API to migrate to Wear Compose in future.

from horologist.

Digipom avatar Digipom commented on July 3, 2024

@yschimke Thanks, this helps a lot. Just as a reference, here's what I see as the bottom-most scroll position with the different options:

  1. Using the now-deprecated scrollable():
    imageimage

This can still be achieved by using val columnState = rememberColumnState(factory = ScalingLazyColumnDefaults.scalingLazyColumnDefaults()) in 0.5.22.

  1. rememberColumnState(factory = ScalingLazyColumnDefaults.belowTimeText())

imageimage

  1. val columnState = rememberColumnState()
image image
  1. val columnState = rememberResponsiveColumnState()
image image

To me, the terminal state of the square scroll does look like a bug but if we can still use val columnState = rememberColumnState(factory = ScalingLazyColumnDefaults.scalingLazyColumnDefaults()) then that's fine.

For rejections due to clipping, we had them due to Dialog behavior on round devices: https://issuetracker.google.com/issues/310112608

Thanks again for the details, it's much clearer for us now.

from horologist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.