feat: Apply orientation to UI too, move setting to Display#499
feat: Apply orientation to UI too, move setting to Display#499maeveynot wants to merge 1 commit intocrosspoint-reader:masterfrom
Conversation
c733abc to
0fc2ba0
Compare
|
I removed the visual change where the continue-reading book tile expanded to fill available space, and kept it at half the screen size as before--we just limit the height if that's needed. By doing this we can eliminate another max height check later on. I'm absolutely open to better dimension or a side-by-side cover and text continue-reading tile, but that can be decided later. |
1857a4f to
da0f3f6
Compare
da0f3f6 to
4295820
Compare
|
I originally included some stuff about image orientation in the boot/sleep activity here, but I broke that out into #557 .
|
4295820 to
92eddc6
Compare
## Summary This was originally a comment in #499, but I'm making it its own PR, because it doesn't depend on anything there and then I can base that PR on this one. Currently, `drawBitmap` is used for covers and sleep wallpaper, and `drawImage` is used for the boot logo. `drawBitmap` goes row by row and pixel by pixel, so it respects the renderer orientation. `drawImage` just calls the `EInkDisplay`'s `drawImage`, which works in the eink panel's native display orientation. `drawImage` rotates the x,y coordinates where it's going to draw the image, but doesn't account for the fact that the northwest corner in portrait orientation becomes, the southwest corner of the image rectangle in the native orientation. The boot and sleep activities currently work around this by calculating the north*east* corner of where the image should go, which becomes the northwest corner after `rotateCoordinates`. I think this wasn't really apparent because the CrossPoint logo is rotationally symmetrical. The `EInkDisplay` `drawImage` always draws the image in native orientation, but that looks the same for the "X" image. If we rotate the origin coordinate in `GfxRenderer`'s `drawImage`, we can use a much clearer northwest corner coordinate in the boot and sleep activities. (And then, in #499, we can actually rotate the boot screen to the user's preferred orientation). This does *not* yet rotate the actual bits in the image; it's still displayed in native orientation. This doesn't affect the rotationally-symmetric logo, but if it's ever changed, we will probably want to allocate a new `u8int[]` and transpose rows and columns if necessary. ## Additional Context I've created an additional branch on top of this to demonstrate by replacing the logo with a non-rotationally-symmetrical image: <img width="128" height="128" alt="Cat-in-a-pan-128-bw" src="https://github.com/user-attachments/assets/d0b239bc-fe75-4ec8-bc02-9cf9436ca65f" /> master...maeveynot:rotated-cat (many thanks to https://notisrac.github.io/FileToCArray/) As you can see, it is always drawn in native orientation, which makes it sideways (turned clockwise) in portrait. --- ### AI Usage No Co-authored-by: Maeve Andrews <[email protected]>
0948b8f to
fdd4b0c
Compare
|
Conflicts resolved and rebased on |
843f41c to
5234ff3
Compare
5234ff3 to
ba700ee
Compare
|
I have updated this to essentially undo #637 since we provide space here for the hints to be drawn. @daveallie could you let me know if it's worth continuing to do this or if you'd like to move in the direction of themeing systems instead? It seems like UI rotation will be a lot more complicated there since both the theme engine and the themes themselves would need to support it. |
|
Hi @maeveynot, I wrote the UI theme PR #528, I really dig the work you've done here to make the UI more "responsive". With the introduction of themes it will actually be easier to do this, since we're migrating to a components architecture rather than rendering hardcoded primitives on every screen. Every component is drawn using a Rect{x, y, w, h} frame parameter and layout constants are centralized in each theme. We could work together on implementing your changes into this system if you'd like. |
## Summary This was originally a comment in crosspoint-reader#499, but I'm making it its own PR, because it doesn't depend on anything there and then I can base that PR on this one. Currently, `drawBitmap` is used for covers and sleep wallpaper, and `drawImage` is used for the boot logo. `drawBitmap` goes row by row and pixel by pixel, so it respects the renderer orientation. `drawImage` just calls the `EInkDisplay`'s `drawImage`, which works in the eink panel's native display orientation. `drawImage` rotates the x,y coordinates where it's going to draw the image, but doesn't account for the fact that the northwest corner in portrait orientation becomes, the southwest corner of the image rectangle in the native orientation. The boot and sleep activities currently work around this by calculating the north*east* corner of where the image should go, which becomes the northwest corner after `rotateCoordinates`. I think this wasn't really apparent because the CrossPoint logo is rotationally symmetrical. The `EInkDisplay` `drawImage` always draws the image in native orientation, but that looks the same for the "X" image. If we rotate the origin coordinate in `GfxRenderer`'s `drawImage`, we can use a much clearer northwest corner coordinate in the boot and sleep activities. (And then, in crosspoint-reader#499, we can actually rotate the boot screen to the user's preferred orientation). This does *not* yet rotate the actual bits in the image; it's still displayed in native orientation. This doesn't affect the rotationally-symmetric logo, but if it's ever changed, we will probably want to allocate a new `u8int[]` and transpose rows and columns if necessary. ## Additional Context I've created an additional branch on top of this to demonstrate by replacing the logo with a non-rotationally-symmetrical image: <img width="128" height="128" alt="Cat-in-a-pan-128-bw" src="https://github.com/user-attachments/assets/d0b239bc-fe75-4ec8-bc02-9cf9436ca65f" /> crosspoint-reader/crosspoint-reader@master...maeveynot:rotated-cat (many thanks to https://notisrac.github.io/FileToCArray/) As you can see, it is always drawn in native orientation, which makes it sideways (turned clockwise) in portrait. --- ### AI Usage No Co-authored-by: Maeve Andrews <[email protected]>
|
@CaptainFrito thanks! I'll take a look at what needs to be done or not now that #528 is merged, and see what I can reimplement... maybe this PR as is should be abandoned. |
## Summary This was originally a comment in crosspoint-reader#499, but I'm making it its own PR, because it doesn't depend on anything there and then I can base that PR on this one. Currently, `drawBitmap` is used for covers and sleep wallpaper, and `drawImage` is used for the boot logo. `drawBitmap` goes row by row and pixel by pixel, so it respects the renderer orientation. `drawImage` just calls the `EInkDisplay`'s `drawImage`, which works in the eink panel's native display orientation. `drawImage` rotates the x,y coordinates where it's going to draw the image, but doesn't account for the fact that the northwest corner in portrait orientation becomes, the southwest corner of the image rectangle in the native orientation. The boot and sleep activities currently work around this by calculating the north*east* corner of where the image should go, which becomes the northwest corner after `rotateCoordinates`. I think this wasn't really apparent because the CrossPoint logo is rotationally symmetrical. The `EInkDisplay` `drawImage` always draws the image in native orientation, but that looks the same for the "X" image. If we rotate the origin coordinate in `GfxRenderer`'s `drawImage`, we can use a much clearer northwest corner coordinate in the boot and sleep activities. (And then, in crosspoint-reader#499, we can actually rotate the boot screen to the user's preferred orientation). This does *not* yet rotate the actual bits in the image; it's still displayed in native orientation. This doesn't affect the rotationally-symmetric logo, but if it's ever changed, we will probably want to allocate a new `u8int[]` and transpose rows and columns if necessary. ## Additional Context I've created an additional branch on top of this to demonstrate by replacing the logo with a non-rotationally-symmetrical image: <img width="128" height="128" alt="Cat-in-a-pan-128-bw" src="https://github.com/user-attachments/assets/d0b239bc-fe75-4ec8-bc02-9cf9436ca65f" /> crosspoint-reader/crosspoint-reader@master...maeveynot:rotated-cat (many thanks to https://notisrac.github.io/FileToCArray/) As you can see, it is always drawn in native orientation, which makes it sideways (turned clockwise) in portrait. --- ### AI Usage No Co-authored-by: Maeve Andrews <[email protected]>
Summary
As a landscape-orientation reader, I would prefer to not have to physically rotate my device to use some (but not all) other parts of the UI. This PR moves the orientation setting from the Reader category to the Device category, and applies orientation to all activities, not just the reader.
Rather than setting the orientation in the reader activity and setting it back, we change the orientation only:
We introduce some code into the base Activity class to handle both this and the concept of "margins", which in many cases were kind of hard-coded into other activities with the assumption of portrait. With a place for some code there I then refactored menus a bit by collecting duplicated code for the calculation of number of menu items on screen. This work could be continued further to actually drawing the menu items, but I'm hoping for feedback first.
Finer-grained breakdown of changes:
60and30. (also, instead of 60 it's now the top margin + 45.)480was hardcoded; use the screen width instead so that the QR code is still centered in landscape.Visual problems that still exist at this point:
Random other notes:
Additional Context
There may be unpolished spots here but since this will affect and conflict with other menu work (EDIT: there are now PRs: #528, #548) I want to get it up here and under discussion (and hopefully merged) as soon as possible, with improvements to follow.
I don't use every feature of CrossPoint, so I may have missed testing some things. I'm prioritizing attention to usability in Portrait and Landscape CCW orientations.
If we want to go in this direction, I would like to follow up with opening a discussion about remapping buttons in the new my-library activity, because I really strongly don't like the current ones. For me the outer side of the button should always be "next page or menu item" and the inner side of the button should always be "previous page or menu item" and now they switch between tabs and I have to use the side button to scroll. I am not changing this new behavior here since discussion of what mapping settings to add is needed.
AI Usage
No