feat: Enable panel resizing on tablets and foldable devices#2884
feat: Enable panel resizing on tablets and foldable devices#2884Elouan1411 wants to merge 18 commits intomainfrom
Conversation
c717b1e to
fffad91
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a draggable separator to allow users to resize the two-pane UI on tablets and foldable devices, and persists the chosen pane ratio across sessions.
Changes:
- Add a drag separator UI (line + handle) to two-pane layouts (thread list and search).
- Implement touch-driven resizing logic in
TwoPaneFragment, with persistence viaLocalSettings/TwoPaneViewModel. - Adjust a few layouts for better responsiveness (empty state width handling, message date truncation).
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/res/values/dimens.xml | Adds new sizing dimens for min pane widths and drag separator visuals. |
| app/src/main/res/layout/view_empty_state.xml | Makes empty state content adapt better to wider containers. |
| app/src/main/res/layout/item_message.xml | Adds single-line truncation behavior for the message date. |
| app/src/main/res/layout/fragment_thread_list.xml | Adds the draggable separator view between list and thread panes. |
| app/src/main/res/layout/fragment_search.xml | Adds the draggable separator view between results list and thread pane. |
| app/src/main/res/drawable/item_vertical_drag_handle.xml | Adds selector drawable for the drag handle. |
| app/src/main/res/drawable/item_drag_line.xml | Adds selector drawable for the separator line. |
| app/src/main/java/com/infomaniak/mail/ui/main/search/SearchFragment.kt | Exposes the separator view to TwoPaneFragment. |
| app/src/main/java/com/infomaniak/mail/ui/main/folder/TwoPaneViewModel.kt | Stores/restores the left pane ratio and persists it. |
| app/src/main/java/com/infomaniak/mail/ui/main/folder/TwoPaneFragment.kt | Implements drag-to-resize and updated two-pane width computation. |
| app/src/main/java/com/infomaniak/mail/ui/main/folder/ThreadListFragment.kt | Exposes the separator view to TwoPaneFragment. |
| app/src/main/java/com/infomaniak/mail/data/LocalSettings.kt | Adds a persisted leftPaneRatio preference. |
Comments suppressed due to low confidence (1)
app/src/main/res/layout/item_message.xml:117
shortMessageDateis constrained start/end in a ConstraintLayout, but still useslayout_width="wrap_content". For ellipsizing to reliably work (as you already do forexpeditorName), it should be width0dp(match constraints) or setapp:layout_constrainedWidth="true"; otherwise it can measure beyond constraints and never ellipsize.
<TextView
android:id="@+id/shortMessageDate"
style="@style/Label.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/marginStandardSmall"
android:ellipsize="end"
android:lines="1"
app:layout_constraintBaseline_toBaselineOf="@id/expeditorName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/scheduleSendIcon"
tools:text="9 déc 2021 à 11:00" />
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ec33deb to
a803108
Compare
9dd1035 to
a045ea1
Compare
…ble pressed state styling
a045ea1 to
4eacb3e
Compare
|
| updateSeparatorAppearance(separatorView, lineSeparator, true, widthSelected) | ||
| true | ||
| } | ||
|
|
There was a problem hiding this comment.
Remove spaces between when clauses
| separatorView: View, | ||
| lineSeparator: View?, | ||
| isPressed: Boolean, | ||
| lineWidth: Int |
There was a problem hiding this comment.
| lineWidth: Int | |
| lineWidth: Int, |
| currentRawX: Float, | ||
| leftPane: View, | ||
| rightPane: View, | ||
| parentGroup: ViewGroup |
There was a problem hiding this comment.
| parentGroup: ViewGroup | |
| parentGroup: ViewGroup, |
| val maxLeftWidth = availableWidth - minRightWidthPx | ||
| val safeMaxLeftWidth = maxOf(minLeftWidthPx, maxLeftWidth) | ||
|
|
||
| val newLeftWidth = (dragStartLeftWidth + deltaX).coerceIn( |
| return if (isTabletOrFoldable()) { | ||
| (leftPaneWidthRatio * widthPixels).toInt() to (rightPaneWidthRatio * widthPixels).toInt() | ||
| val ratio = twoPaneViewModel.leftPaneRatio | ||
|
|
| ) { | ||
| val deltaX = (currentRawX - dragStartX).toInt() | ||
| val parentWidth = parentGroup.width | ||
|
|
There was a problem hiding this comment.
Remove empty lines between variables




No description provided.