🎨 Palette: Keyboard Accessibility and Smart Filename Extraction - #10
Conversation
Add proper ImeActions and matching KeyboardActions across the main screens. Implement auto-extraction of raw/blob GitHub filenames to simplify inputs. Co-authored-by: SayanthRock <202829406+SayanthRock@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Unable to trigger custom agent "Code Reviewer". You have run out of credits 😔 |
|
Unable to locate .performanceTestingBot config file |
🤖 CodeAnt AI — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
You've hit your review limit for the week, but don't worry you'll get some more next week! Contact us at hello@zenable.io if you want this rate limit to go away |
📝 WalkthroughWalkthroughChangesIME-driven form actions
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| onValueChange = { url -> | ||
| fileUrl = url | ||
| if (url.isNotBlank()) { | ||
| val cleanUrl = url.substringBefore("?").substringBefore("#") | ||
| val parts = cleanUrl.split('/') | ||
| val lastPart = parts.lastOrNull() | ||
| if (!lastPart.isNullOrBlank() && lastPart.contains('.')) { | ||
| fileName = lastPart | ||
| } | ||
| } | ||
| }, |
There was a problem hiding this comment.
Suggestion: Every nonblank URL edit overwrites fileName whenever the final URL segment contains a dot. If a user enters or pastes a URL and then intentionally changes the filename, any subsequent URL edit silently discards that custom value, and the overwritten name is passed to analyzeCode. Restrict auto-extraction to an untouched/default filename or otherwise preserve an explicitly edited filename. [logic error]
Severity Level: Major ⚠️
- ⚠️ Manual filename choices are lost during URL edits.
- ❌ Code analysis can target the wrong filename.
- ⚠️ Search submission passes the silently replaced value.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** app/src/main/java/com/sayanthrock/freeairock/MainActivity.kt
**Line:** 266:276
**Comment:**
*Logic Error: Every nonblank URL edit overwrites `fileName` whenever the final URL segment contains a dot. If a user enters or pastes a URL and then intentionally changes the filename, any subsequent URL edit silently discards that custom value, and the overwritten name is passed to `analyzeCode`. Restrict auto-extraction to an untouched/default filename or otherwise preserve an explicitly edited filename.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fixThere was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/src/main/java/com/sayanthrock/freeairock/MainActivity.kt`:
- Around line 266-276: Update the URL onValueChange handler to derive fileName
from any non-empty final URL segment, including extensionless GitHub filenames
such as LICENSE, README, and Dockerfile; remove the dot requirement. Reset
fileName when the URL is blank or ends with a slash, and preserve the existing
behavior for recognized raw/blob file URLs only.
- Around line 211-218: Update the KeyboardActions.onDone callback in the token
input to invoke defaultKeyboardAction(ImeAction.Done) after the existing save
logic, preserving token validation and confirmation behavior while restoring the
default keyboard dismissal.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d31061b0-bee3-4bbe-9a5a-a2d3aa5189cb
📒 Files selected for processing (3)
.Jules/palette.mdapp/src/main/java/com/sayanthrock/freeairock/MainActivity.ktapp/src/main/java/com/sayanthrock/freeairock/ui/ReviewScreen.kt
| keyboardActions = KeyboardActions( | ||
| onDone = { | ||
| if (githubToken.isNotBlank()) { | ||
| onSave(githubToken) | ||
| savedMessage = "Saved securely on this device" | ||
| } | ||
| } | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n \
'2024\.06\.00|compose-bom|androidx\.compose|KeyboardActionScope|defaultKeyboardAction' \
--glob 'build.gradle*' \
--glob 'settings.gradle*' \
--glob 'libs.versions.toml' \
--glob 'gradle.properties' \
--glob '*.kt' . || trueRepository: SayanthRock/FREE-AI-ROCK-
Length of output: 20047
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== MainActivity import and keyboard section =="
sed -n '1,50p;160,235p' app/src/main/java/com/sayanthrock/freeairock/MainActivity.kt | cat -n
echo
echo "== KeyboardActions usages =="
rg -n "KeyboardActions|defaultKeyboardAction|LocalSoftwareKeyboardController|dismiss|ImeAction" app/src/main/java -S || trueRepository: SayanthRock/FREE-AI-ROCK-
Length of output: 7683
🌐 Web query:
Android Jetpack Compose KeyboardActions defaultKeyboardAction ImeAction Done source documentation
💡 Result:
In Jetpack Compose, defaultKeyboardAction is a function provided within the KeyboardActionScope interface [1]. It is designed to trigger the system's default behavior associated with a specific ImeAction [1]. When you invoke defaultKeyboardAction(ImeAction.Done), it executes the standard implementation for the "Done" action, which is to close the software keyboard [2]. Key technical details include: - KeyboardActionScope: This interface provides the context for executing custom keyboard actions [1]. Within its scope, you can call defaultKeyboardAction(imeAction) to trigger the default behavior for any given ImeAction [1]. - ImeAction.Done: This constant represents the "Done" action, signaling that the user has finished providing input to a field or a group of fields [3]. When used with defaultKeyboardAction, it specifically invokes the platform-level implementation that hides the software keyboard [2]. - Default Behavior: If you provide a custom lambda for an action (e.g., onDone in KeyboardActions), the default behavior is overridden [4]. To execute the default behavior while still performing custom logic, you can manually call defaultKeyboardAction(ImeAction.Done) inside your custom callback [1]. This mechanism ensures that developers can maintain standard platform expectations—such as keyboard dismissal upon completion—while still having the flexibility to implement custom application-specific logic [4][5].
Citations:
- 1: https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardActionScope
- 2: https://android.googlesource.com/platform/frameworks/support/+/24a6748531285076b5e1bde530eea2860411ceed
- 3: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/ImeAction
- 4: https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/KeyboardActions
- 5: https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/input/KeyboardActionHandler
Restore the default Done action after saving the token.
KeyboardActions.onDone overrides the default IME action. The custom callback saves the token but does not hide the keyboard, so the confirmation text can remain covered by the software keyboard. Run defaultKeyboardAction(ImeAction.Done) after saving to keep the normal Done behavior.
Proposed fix
if (githubToken.isNotBlank()) {
onSave(githubToken)
savedMessage = "Saved securely on this device"
+ defaultKeyboardAction(ImeAction.Done)
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| keyboardActions = KeyboardActions( | |
| onDone = { | |
| if (githubToken.isNotBlank()) { | |
| onSave(githubToken) | |
| savedMessage = "Saved securely on this device" | |
| } | |
| } | |
| ) | |
| keyboardActions = KeyboardActions( | |
| onDone = { | |
| if (githubToken.isNotBlank()) { | |
| onSave(githubToken) | |
| savedMessage = "Saved securely on this device" | |
| defaultKeyboardAction(ImeAction.Done) | |
| } | |
| } | |
| ) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/src/main/java/com/sayanthrock/freeairock/MainActivity.kt` around lines
211 - 218, Update the KeyboardActions.onDone callback in the token input to
invoke defaultKeyboardAction(ImeAction.Done) after the existing save logic,
preserving token validation and confirmation behavior while restoring the
default keyboard dismissal.
| onValueChange = { url -> | ||
| fileUrl = url | ||
| if (url.isNotBlank()) { | ||
| val cleanUrl = url.substringBefore("?").substringBefore("#") | ||
| val parts = cleanUrl.split('/') | ||
| val lastPart = parts.lastOrNull() | ||
| if (!lastPart.isNullOrBlank() && lastPart.contains('.')) { | ||
| fileName = lastPart | ||
| } | ||
| } | ||
| }, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Extract names for extensionless GitHub files.
The lastPart.contains('.') check excludes valid files such as LICENSE, README, and Dockerfile. For these URLs, fileName remains MainActivity.kt or a previous value, so onAnalyze(fileName, fileUrl) receives the wrong filename. A URL that is cleared or ends with / can also leave the previous filename in place. Parse a non-empty final segment for recognized raw/blob file URLs and reset the derived name when no filename exists.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/src/main/java/com/sayanthrock/freeairock/MainActivity.kt` around lines
266 - 276, Update the URL onValueChange handler to derive fileName from any
non-empty final URL segment, including extensionless GitHub filenames such as
LICENSE, README, and Dockerfile; remove the dot requirement. Reset fileName when
the URL is blank or ends with a slash, and preserve the existing behavior for
recognized raw/blob file URLs only.
User description
🎨 Palette: Keyboard Accessibility and Smart Filename Extraction
💡 What:
ImeActionoptions (ImeAction.Next,ImeAction.Done,ImeAction.Search) and matchingKeyboardActionsacross the input forms onCodeAnalyzerScreen(inMainActivity.kt) andReviewScreen(inReviewScreen.kt).CodeAnalyzerScreen, the app automatically parses and populates theFile namefield, saving manual typing or copy-pasting.🎯 Why:
♿ Accessibility:
PR created automatically by Jules for task 5395884347639882127 started by @SayanthRock
CodeAnt-AI Description
Streamline keyboard-based code analysis and PR review
What Changed
Impact
✅ Fewer taps to submit forms✅ Faster code analysis and PR reviews✅ Less manual file-name entry💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.
Summary by CodeRabbit
New Features
Accessibility