Skip to content

Rework AdaptiveLayoutView#148

Merged
kevinaboos merged 18 commits into
project-robius:mainfrom
yulnr:adaptive-view
Sep 21, 2024
Merged

Rework AdaptiveLayoutView#148
kevinaboos merged 18 commits into
project-robius:mainfrom
yulnr:adaptive-view

Conversation

@yulnr
Copy link
Copy Markdown
Contributor

@yulnr yulnr commented Sep 16, 2024

This PR introduces significant changes to our adaptive layout system, moving away from the previous DSL-heavy approach to a more flexible solution. It also introduces a new CachedWidget to optimize widget reuse across UI updates.

Key Changes

  1. Reworked AdaptiveViewLayout into AdaptiveView:

    • Simplified DSL usage
    • Introduced a variant selector mechanism for dynamic layout selection
    • Instead of having a single widget instance (of the widget to be adapted), we use separate DSL groups for each variant. This allows for a lot more flexibility when it comes to UI tree manipulation. However this implies having different widget instances by default for the different variants. This is important when considering live-resizing the application, where widgets will be reinitialized and their state management must be prepared for it. We plan on supporting state serialization which will take care of porting state between the widget instances without much manual intervention. For now, we're using CachedWidget to avoid re-initializing and porting state between instances.
    • Updated all existing usages of AdaptiveViewLayout to use the new AdaptiveView
  2. Introduced CachedWidget:

    • Allows reuse of complex widget instances across UI updates (wraps a widget in a singleton)
    • Particularly useful for maintaining state during live resizing
    • Implemented for RoomScreen and RoomsList to preserve their state
  3. Improved flexibility

    • AdaptiveView now uses a closure-based selector for determining layouts. This allows to define AdaptiveViews that for example adapt to their parent size instead of just the screen size.
    • Direct access to Cx provided in variant selectors for more control

Limitations and Future Work

  • Some limitations exist in the current implementation, particularly around widget finding and caching
  • Both AdaptiveView and CachedWidget will be ported to Makepad core soon, addressing current limitations
  • Detailed documentation and known limitations are provided in the code comments

Please refer to the inline documentation in adaptive_view.rs and cached_widget.rs for usage instructions and current limitations.

@yulnr yulnr marked this pull request as ready for review September 20, 2024 13:07
Comment thread src/home/rooms_list.rs
kevinaboos
kevinaboos previously approved these changes Sep 20, 2024
Copy link
Copy Markdown
Member

@kevinaboos kevinaboos left a comment

Choose a reason for hiding this comment

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

Phenomenal work, thanks! All looks good.

Comment thread src/app.rs Outdated
@kevinaboos kevinaboos self-requested a review September 21, 2024 20:15
@kevinaboos kevinaboos merged commit cd2f707 into project-robius:main Sep 21, 2024
alanpoon pushed a commit to alanpoon/robrix that referenced this pull request May 25, 2026
…project-robius#148)

* sync: backport upstream low-conflict fixes (batches 1-2)

* sync: backport upstream medium-conflict UI/event-source fixes (batch 3)

* sync: backport upstream room pill/cache/tooltip fixes (batch 4)

Backport upstream commits: 63f01d9, 22efa4f, c1a78b0, 6027ee2.\n\nIncludes full room_preview_cache integration, @room mention pill support,\nlink preview widget caching, blurhash decode cost reduction, and tooltip\naction handling shift to tooltip widget itself.

* sync: align packaging/icon pipeline with upstream robrix (batch 5)

Backport upstream packaging/icon behavior so Robrix2 uses the same app icon pipeline as Robrix, including makepad bundle env, icon assets, build.rs icon embedding, and packaging directory parity.

* sync: migrate upstream batch (badge/add-room/password-focus/tsp/verification settings)

* sync: migrate upstream app settings batch and zoom/view-mode parity
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.

2 participants