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

Wear OS ListView items don't hug the edge of the screen (circular watch face) #6

Open
finger563 opened this issue Mar 18, 2019 · 4 comments

Comments

@finger563
Copy link

Instead they follow a linear path between the center of the left side of the screen and the middle of the top or bottom of the screen. The WearOS app list view has each item following an arc that makes the items hug the side of the screen

@finger563
Copy link
Author

I think this is because of this line which manually moves the children over using a linear function. Based on the wear os documentation I think WearableRecyclerView::setEdgeItemsCenteringEnabled(boolean) should be used instead?

@finger563
Copy link
Author

Looking further - maybe not :/ see this post about needing a custom function

@finger563
Copy link
Author

After much fiddling I've found that the code below allows you to control how much the items hug the side of the screen and that the value below of curveFactor = 0.5 approximately matches the behavior of the wearOS app menu when scaling is not applied, and curveFactor = 1.5 approximately matches the behavior of the wearOS app menu when scaling is applied

var middle = parent.getWidth() / 2.0;
var curveFactor = 0.5;
var start = 1.0 - curveFactor * Math.abs(yRelativeToCenterOffset - 0.5);
var x = (start - Math.sin(yRelativeToCenterOffset * Math.PI)) * middle;
child.setX(x);

@Erudition
Copy link

I noticed this linear path too. Would love for this to be PR'd

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

No branches or pull requests

2 participants