Skip to content

[Draft] feat/add-drag-drop : Add Drag & Drop Functionality #52

Open
prateekbatra-g wants to merge 1 commit intomainfrom
feat/add-drag-drop
Open

[Draft] feat/add-drag-drop : Add Drag & Drop Functionality #52
prateekbatra-g wants to merge 1 commit intomainfrom
feat/add-drag-drop

Conversation

@prateekbatra-g
Copy link
Contributor

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements drag and drop functionality for notes within the Cahier application. It enhances the user experience by allowing notes to be easily moved and reorganized. The changes include UI modifications to provide visual feedback during drag operations and updates to the underlying logic to handle the drag and drop events.

Highlights

  • Drag and Drop Functionality: This PR introduces drag and drop functionality to the Cahier app, allowing users to drag notes within the application.
  • UI Enhancements: The PR modifies the UI to support drag and drop interactions, including visual feedback during the drag operation.
  • Codebase Modernization: The PR updates dependencies and uses modern Compose APIs for implementing drag and drop.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces drag-and-drop functionality to open notes in a new window. The implementation of the drag source appears correct. However, I've identified a critical issue in MainActivity.kt concerning state management on the drop target. The current implementation will not trigger a UI update when a note is dropped. I've provided a code suggestion to resolve this. Additionally, there's a minor opportunity to improve code clarity, for which I've also included a suggestion.

Comment on lines 53 to 61
var noteId = intent.getLongExtra(AppArgs.NOTE_ID_KEY, -1)
var noteType = IntentCompat.getParcelableExtra(
intent,
AppArgs.NOTE_TYPE_KEY,
NoteType::class.java
)

setContent {
CahierAppTheme {
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The variables noteId and noteType are updated in the onDrop callback, but since they are not Compose State objects, updating them will not trigger a recomposition. The UI will not reflect the new note when an item is dropped. To fix this, you should declare noteId and noteType as state variables inside the setContent block using remember { mutableStateOf(...) }. This will ensure that Compose observes changes to these variables and recomposes the UI accordingly.

        setContent {
            var noteId by remember { mutableStateOf(intent.getLongExtra(AppArgs.NOTE_ID_KEY, -1)) }
            var noteType by remember {
                mutableStateOf(
                    IntentCompat.getParcelableExtra(
                        intent,
                        AppArgs.NOTE_TYPE_KEY,
                        NoteType::class.java
                    )
                )
            }
            CahierAppTheme {

Comment on lines +91 to +93
shouldStartDragAndDrop = accept@{
true
},
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The label accept@ in the shouldStartDragAndDrop lambda is unnecessary as there is no ambiguity. It can be removed for better readability.

                            shouldStartDragAndDrop = {
                                true
                            },

@prateekbatra-g prateekbatra-g force-pushed the feat/add-drag-drop branch 7 times, most recently from f7279b9 to 4c494b6 Compare March 20, 2026 18:43
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.

1 participant