-
-
Notifications
You must be signed in to change notification settings - Fork 318
feat: Double tap on Search pulls up the keyboard and fix for gesture back navbar highlight #1598
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a double-tap gesture on the Search button to bring up the keyboard and fixes an issue where the navbar highlight didn't update correctly when navigating back from Library/Search screens.
Key Changes:
- Implemented double-tap detection on Search navigation items to trigger keyboard focus
- Added LaunchedEffect to update navbar highlight based on current destination
- Introduced a search focus trigger mechanism via SharedViewModel state flow
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| SharedViewModel.kt | Added searchFocusTrigger state flow and triggerSearchFocus() function to coordinate keyboard focus requests |
| SearchScreen.kt | Added LaunchedEffect to observe searchFocusTrigger and request focus when triggered |
| AppBottomNavigationBar.kt | Implemented double-tap detection, added LaunchedEffect to sync selectedIndex with navigation state, and added viewModel parameter |
| App.kt | Passed viewModel to navigation components to enable search focus triggering |
| LiquidGlassAppBottomNavigationBar.android.kt | Replaced FloatingActionButton with Box using combinedClickable for double-tap support and added LaunchedEffect for highlight sync |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| selected = selectedIndex == screen.ordinal, | ||
| onClick = { | ||
| if (selectedIndex == screen.ordinal) { | ||
| val currentTime = System.currentTimeMillis() |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using System.currentTimeMillis() for double-click detection can be unreliable if the system clock changes. Consider using a monotonic time source that is guaranteed to always move forward, such as a platform-specific monotonic clock or Compose's withFrameNanos if available in common code.
| selected = selectedIndex == index, | ||
| onClick = { | ||
| if (selectedIndex == screen.ordinal) { | ||
| val currentTime = System.currentTimeMillis() |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using System.currentTimeMillis() for double-click detection can be unreliable if the system clock changes. Consider using a monotonic time source that is guaranteed to always move forward, such as a platform-specific monotonic clock or Compose's withFrameNanos if available in common code.
...dMain/kotlin/com/maxrave/simpmusic/ui/component/LiquidGlassAppBottomNavigationBar.android.kt
Outdated
Show resolved
Hide resolved
| import androidx.compose.foundation.ExperimentalFoundationApi | ||
| import androidx.compose.foundation.Image | ||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.combinedClickable |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ExperimentalFoundationApi annotation and combinedClickable import are added but never used in this file. The double-click detection is implemented manually instead. Either remove these unused imports or consider using combinedClickable for more reliable double-click handling.
Summary
Added a quick gesture for keyboard pull up - double tap on the Search button. It is commonly found in nearly every other app. Also fixed a small bug with the button highlight when gesturing Back. Fixes #1250
Changes
Double tap on Search brings up the keyboard
Previously: Double tapping on the Search button on Navbar didn't do anything
After: Double tap brings up the keyboard
Fixed Navbar icon highlight not correcting itself when triggering a Back gesture/button tap
Previously: Going back from Library/Search still ahs Library/Search highlighted
After: Going back from Library/Search highlights the Home button
Testing