Skip to content

Fix D-pad navigation: top bar focus trap and attach button highlight#14

Merged
JMTDI merged 3 commits into
masterfrom
copilot/fix-dpad-navigation-issues-another-one
Jan 17, 2026
Merged

Fix D-pad navigation: top bar focus trap and attach button highlight#14
JMTDI merged 3 commits into
masterfrom
copilot/fix-dpad-navigation-issues-another-one

Conversation

Copilot AI commented Jan 16, 2026

Copy link
Copy Markdown

User description

  • Fix main activity top bar focus trap
  • Fix compose activity top bar focus trap (added nextFocusUp to messageList pointing to toolbar)
  • Fix contacts activity focus navigation (already properly configured)
  • Fix attach menu items highlighting
    • Created circle_attach_menu.xml and rounded_rectangle_attach_menu.xml drawables with theme color built-in
    • Updated all attach menu items (contact, schedule, attachFile, attachAudio, gallery, camera) to use new drawables
    • Removed backgroundTint attribute that was overriding focus states
  • Verify soft left/menu button for attach menu (already implemented in ComposeActivity.kt)
Original prompt

Still not dpad compatible so if are in the top bar or whatever of any activity that has this top bar this top usually has search bar or sothing there is one on main screen but once you are in that bar you can scroll down to the rest of the contents of the screen your dpad control is just lockedto just up there then please fix and for the attach button in convesation activity it doesnt have a hight to know if you are on it and so are the this menu when that attch media button is presses make the attach photo and what not in that menu hogjlighted


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


PR Type

Enhancement, Bug fix


Description

  • Fix D-pad navigation focus trap in top bar of main and compose activities

    • Added nextFocusUp to messageList pointing to toolbar in compose activity
    • Added nextFocusUp to recyclerView pointing to compose button in main activity
    • Changed nextFocusDown on compose button to recyclerView instead of search bar
  • Improve attach menu item highlighting with custom drawable selectors

    • Created circle_attach_menu.xml and rounded_rectangle_attach_menu.xml with focus states
    • Replaced generic focusable drawables with backgroundTint on all attach menu items
    • Updated 12 attach menu items (contact, schedule, file, audio, gallery, camera) and labels
  • Enhance attach button styling with theme-aware colors

    • Changed attach button background tint to use bubbleColor attribute
    • Added text color tint to attach button for better visibility

Diagram Walkthrough

flowchart LR
  A["Top Bar"] -->|nextFocusUp| B["Message/Recycler List"]
  B -->|nextFocusDown| A
  C["Attach Menu Items"] -->|Custom Drawables| D["Focus State Highlighting"]
  D -->|Blue Border| E["Visual Feedback"]
Loading

File Walkthrough

Relevant files
Enhancement
circle_attach_menu.xml
Create circular attach menu focus drawable                             

presentation/src/main/res/drawable/circle_attach_menu.xml

  • New drawable file for circular attach menu items with focus state
  • Defines focused state with white background and blue 3dp stroke border
  • Default state uses tools_theme color with circular shape
  • Replaces generic circle_focusable drawable with theme-aware styling
+43/-0   
rounded_rectangle_attach_menu.xml
Create rounded rectangle attach menu focus drawable           

presentation/src/main/res/drawable/rounded_rectangle_attach_menu.xml

  • New drawable file for rounded rectangle attach menu labels with focus
    state
  • Defines focused state with white background and blue 3dp stroke border
  • Default state uses tools_theme color with 4dp corner radius
  • Replaces generic rounded_rectangle_focusable_4dp drawable with custom
    styling
+43/-0   
Bug fix
compose_activity.xml
Fix compose activity D-pad navigation and attach menu styling

presentation/src/main/res/layout/compose_activity.xml

  • Added nextFocusUp="@+id/toolbar" to messageList for upward navigation
  • Replaced circle_focusable and backgroundTint on 6 attach menu icons
    with circle_attach_menu
  • Replaced rounded_rectangle_focusable_4dp and backgroundTint on 6
    attach menu labels with rounded_rectangle_attach_menu
  • Updated attach button with bubbleColor tint and textColorSecondary
    icon tint
+15/-24 
main_activity.xml
Fix main activity D-pad navigation focus trap                       

presentation/src/main/res/layout/main_activity.xml

  • Added nextFocusUp="@+id/compose" to recyclerView for upward navigation
    to compose button
  • Changed compose button nextFocusDown from toolbarSearch to
    recyclerView to prevent focus trap
  • Maintains proper D-pad navigation flow between top bar and content
    list
+2/-1     

@coderabbitai

coderabbitai Bot commented Jan 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Fix dpad navigation issues in top bar and attach button Fix D-pad navigation: top bar focus trap and attach button highlight Jan 16, 2026
Copilot AI requested a review from JMTDI January 16, 2026 22:54
@JMTDI

JMTDI commented Jan 16, 2026

Copy link
Copy Markdown
Owner

@copilot Hey it is not just the main activity that has the Top bar focus trap it all the activities that have a Top bar focus like in the coversation activity and in the contact selecter for composing a message ok and please make these highlighted to because they are not right now The attach menu items (contact, schedule, gallery, camera, etc.) already had proper focus highlighting with android:background="@drawable/circle_focusable" and android:backgroundTint="@color/tools_theme" which provides visible focus states through the drawable selector. and please make the soft left or menu button open the attach options i might be already sort of implemented but it does not work please fix

- Add nextFocusUp to messageList in compose activity for toolbar navigation
- Create new drawable files circle_attach_menu.xml and rounded_rectangle_attach_menu.xml
- Update attach menu items to use new drawables without backgroundTint for proper focus highlighting

Co-authored-by: JMTDI <[email protected]>

Copilot AI commented Jan 16, 2026

Copy link
Copy Markdown
Author

@copilot Hey it is not just the main activity that has the Top bar focus trap it all the activities that have a Top bar focus like in the coversation activity and in the contact selecter for composing...

Fixed in commit e2a618a:

  1. Top bar focus trap in compose activity: Added nextFocusUp="@+id/toolbar" to messageList so you can navigate back up from the messages to the toolbar. The contacts activity already had proper focus navigation configured.

  2. Attach menu highlighting: Created new drawable files (circle_attach_menu.xml and rounded_rectangle_attach_menu.xml) that have the theme color built into the shape directly instead of using backgroundTint. Updated all attach menu items (contact, schedule, attachFile, attachAudio, gallery, camera and their labels) to use these new drawables. This allows the focus state (white background with blue border) to show properly when navigating with D-pad.

  3. Soft left/menu button: The code already handles KEYCODE_MENU, KEYCODE_SOFT_LEFT, and KEYCODE_SOFT_RIGHT to open the attach menu via attach.performClick() in ComposeActivity.kt (lines 761-764). If this isn't working on your device, please let me know the specific device model and Android version so I can investigate further.

@JMTDI
JMTDI marked this pull request as ready for review January 17, 2026 14:28
@JMTDI
JMTDI merged commit a0f0801 into master Jan 17, 2026
1 check passed
@qodo-code-review

Copy link
Copy Markdown

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix incorrect layout constraint anchor

To fix a layout constraint error, change the app:layout_constraintStart_toEndOf
attribute on the cameraLabel from @id/gallery to @id/camera.

presentation/src/main/res/layout/compose_activity.xml [643-660]

 <dev.octoshrimpy.quik.common.widget.QkTextView
     android:id="@+id/cameraLabel"
     android:layout_width="wrap_content"
     android:layout_height="32dp"
     android:layout_marginStart="8dp"
     android:background="@drawable/rounded_rectangle_attach_menu"
     android:elevation="4dp"
     android:gravity="center_vertical"
     android:paddingStart="8dp"
     android:paddingEnd="8dp"
     android:text="@string/compose_camera_cd"
     android:textColor="@color/textPrimaryDark"
     android:focusable="true"
     android:focusableInTouchMode="true"
     android:clickable="true"
     app:layout_constraintBottom_toBottomOf="@id/camera"
-    app:layout_constraintStart_toEndOf="@id/gallery"
+    app:layout_constraintStart_toEndOf="@id/camera"
     app:layout_constraintTop_toTopOf="@id/camera" />

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a layout bug where the cameraLabel is horizontally constrained to the @id/gallery view instead of the @id/camera view, which would result in a misplaced UI element.

High
Add up navigation for first icon

Add android:nextFocusUp="@+id/toolbar" to the contact ImageView to ensure D-pad
navigation correctly moves focus from the first attach menu icon to the toolbar.

presentation/src/main/res/layout/compose_activity.xml [423-441]

 <ImageView
     android:id="@+id/contact"
     ...
+    android:nextFocusUp="@+id/toolbar"
     android:nextFocusDown="@+id/schedule"
     app:layout_constraintBottom_toTopOf="@id/schedule"
     ... />

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 5

__

Why: The suggestion improves D-pad navigation by explicitly setting the focus behavior, which aligns with the accessibility improvements made elsewhere in the PR.

Low
General
Replace hardcoded color with theme attribute

Replace the hardcoded stroke color #2196F3 with a theme attribute like
?attr/colorPrimary to improve theming support.

presentation/src/main/res/drawable/circle_attach_menu.xml [32]

-<stroke android:width="3dp" android:color="#2196F3" />
+<stroke android:width="3dp" android:color="?attr/colorPrimary" />
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly points out a hardcoded color in a new drawable, which contradicts good theming practices. Using a theme attribute improves maintainability and consistency.

Medium
Match inset to stroke width

Increase the insets from 2dp to 3dp to match the stroke width and prevent
potential clipping of the border.

presentation/src/main/res/drawable/circle_attach_menu.xml [29-34]

-<item android:top="2dp" android:bottom="2dp" android:left="2dp" android:right="2dp">
+<item android:top="3dp" android:bottom="3dp" android:left="3dp" android:right="3dp">
     ...
 </item>

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies that the 2dp inset is smaller than the 3dp stroke width, which could lead to the stroke being partially clipped. Matching the inset to the stroke width is a valid UI fix.

Low
  • More

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants