-
-
Notifications
You must be signed in to change notification settings - Fork 12
Windowed folder #455
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
Open
JackEblan
wants to merge
6
commits into
master
Choose a base branch
from
windowed-folder
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Windowed folder #455
+725
−440
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit refactors the folder view from a full-screen implementation to a popup that appears on the home screen. The previous `FolderScreen` and `FolderDragScreen` composables have been removed from the main screen's navigation graph. A new `FolderPopup.kt` has been introduced, which is responsible for displaying the folder's contents in a popup layout. This popup is positioned relative to the folder icon that was tapped. ### Core Changes: * **`FolderPopup.kt`**: New file containing the `FolderPopup` composable that displays the folder grid. * **`HorizontalPagerScreen.kt`**: Now invokes `FolderPopup` when a folder item is tapped, passing the necessary position and size data to correctly place the popup. * **`HomeScreen.kt` & `HomeViewModel.kt`**: References and transitions to the dedicated `Folder` and `FolderDrag` screens have been removed. * **`FolderScreen.kt`**: Refactored to be displayed within a `Surface` and sized dynamically based on its content, removing the full-screen layout and back-handling logic. * **`InteractiveGridItem.kt`**: The `onTapFolderGridItem` callback now provides the `IntOffset` of the tapped item to position the new popup.
This commit refactors the folder popup and drag-and-drop functionality to improve positioning and coordinate calculations.
The vertical positioning logic for the folder popup in `Popup.kt` has been updated to `coerceIn` the available space, preventing it from rendering off-screen.
The drag calculation within a folder has been significantly improved. `DragGridItemHelper.kt` now receives a relative `dragIntOffset` (pre-adjusted for the folder's position), which simplifies the logic by removing the need to manually subtract the folder's offset and padding. This ensures more accurate item placement during drag operations inside a folder.
Finally, a page indicator has been added to the bottom of the folder view in `FolderDragScreen.kt`, and the layout calculations have been adjusted to correctly account for its height, ensuring the drag grid area is sized appropriately.
### Core Changes:
* **`Popup.kt`**:
* Simplified the `childY` calculation to ensure the folder popup always stays within the screen's vertical bounds.
* **`DragGridItemHelper.kt`**:
* Removed manual offset and padding calculations for `dragX` and `dragY`.
* Now uses a pre-calculated relative `dragIntOffset` for more reliable drag coordinate mapping within the folder's grid.
* The folder's grid dimensions (`folderGridWidth`, `folderGridHeight`) are now passed directly, simplifying cell size calculations.
* **`FolderDragScreen.kt` & `FolderScreen.kt`**:
* Added a `PageIndicator` to the folder view.
* Adjusted layout calculations to correctly handle the height of the new page indicator, ensuring the `HorizontalPager` containing the grid items is sized correctly.
* **`DropGridItemHelper.kt`**:
* Removed complex boundary checks, as the improved drag logic now handles drops more predictably.
This commit introduces two main changes: it ensures the folder popup resets correctly when an item is dragged out of it, and it refactors the logic for dragging items outside a folder's bounds. First, a new `resetFolder` function has been added to the `HomeViewModel`. This function clears the folder's internal state (`folderPopupType` and `foldersDataById`) and is now called when an item is moved out of a folder. This prevents the folder from incorrectly remaining open or displaying stale data after the drag operation. Second, the drag detection logic in `DragGridItemHelper` for folders has been enhanced. It now correctly identifies when an item is dragged beyond the folder's grid boundaries and triggers the `onMoveGridItemOutsideFolder` action. Previously, this was not handled, and items could get stuck. The logic for determining folder grid size in `FolderScreen` and `FolderDragScreen` has also been corrected to use `homeSettings.folderColumns` and `homeSettings.folderRows` instead of dynamically calculating the span, ensuring consistent grid dimensions. Additionally, the delay for auto-scrolling pages when dragging an item to the edge of the screen has been reduced from 1000ms to 500ms for a more responsive feel.
Owner
Author
|
Use flow row |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #453
Closes #448
This will remove widgets, shortcuts to be included in the folder. It will only accept 1x1 grid item.