Skip to content

Add haptic feedback - #289

Open
mqiu90 wants to merge 6 commits into
mainfrom
mabel/haptics
Open

mqiu90 wants to merge 6 commits into
mainfrom
mabel/haptics

Conversation

@mqiu90

@mqiu90 mqiu90 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Overview

This PR adds haptic feedback using Compose's LocalHapticFeedback, which respects the system touch feedback setting.

  • Adds EateryHaptics in ui/haptics so all haptics go through one place
  • Light tick when favoriting/unfavoriting (all favorite buttons, including grid cards and the detail screen stars)
  • Selection tick when switching bottom tabs (not when tapping the current tab)
  • Tick when a Notifications pull-to-refresh starts, and a soft confirm when it succeeds
  • No haptics for initial loads, Retry, failed refreshes, or other automatic changes

Testing

Tested on a Pixel 7a (Android 16)

Notes

  • Stacked on Loading states #288, so the base is mabel/loadingstates
  • Unfavorite uses ToggleOff, which Pixel plays very faintly. Open to switching it to the same tick as favorite.

Summary by CodeRabbit

  • New Features
    • Notifications with saved content now show a connection-error message and retry option when a refresh fails.
    • Added pulsing loading placeholders for notifications and favorites.
  • Improvements
    • Added haptic feedback when favoriting eateries, switching tabs, and starting or completing a refresh.
    • The notifications screen no longer displays the favorite-items section.

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 554a48c0-6613-411b-b0fa-5d8a813ac8a4

No actionable comments were generated in the recent review.

Walkthrough

The change adds shared haptic and pulsing loading components. Favorite controls and navigation use haptics. Notification refresh reports success, and the screen can show cached notifications with a connection-error banner and retry action.

Changes: UI feedback and notification states

Layer / File(s) Summary
Shared haptic and loading primitives
app/src/main/java/com/cornellappdev/android/eatery/ui/haptics/Haptics.kt, app/src/main/java/com/cornellappdev/android/eatery/ui/components/general/LoadingPulse.kt, app/src/main/java/com/cornellappdev/android/eatery/ui/components/home/MainLoading.kt
Adds haptic methods for favorite changes, refresh, and tab selection. Adds the pulsing alpha modifier and configurable EateryBlob color and end padding.
Screen interaction and loading integrations
app/src/main/java/com/cornellappdev/android/eatery/ui/components/general/EateryCard.kt, app/src/main/java/com/cornellappdev/android/eatery/ui/components/general/FavoriteButton.kt, app/src/main/java/com/cornellappdev/android/eatery/ui/navigation/MainTabbedNavigation.kt, app/src/main/java/com/cornellappdev/android/eatery/ui/screens/EateryDetailScreen.kt, app/src/main/java/com/cornellappdev/android/eatery/ui/screens/FavoritesScreen.kt
Favorite controls trigger haptics before their existing callbacks. Bottom navigation triggers haptics when the selected tab changes. The favorites loading state uses pulsing placeholders and EateryBlob components.
Notification refresh and connection-error presentation
app/src/main/java/com/cornellappdev/android/eatery/ui/viewmodels/NotificationsHomeViewModel.kt, app/src/main/java/com/cornellappdev/android/eatery/ui/screens/NotificationsHomeScreen.kt, app/src/main/java/com/cornellappdev/android/eatery/ui/components/general/ConnectionErrorBanner.kt, app/src/main/res/drawable/ic_wifi_slash.xml, app/src/main/res/values/strings.xml
The view state exposes a connection-error flag when notifications remain after a failed fetch. Pull-to-refresh emits a success event, and unread notifications are marked as read only after a successful fetch. The screen adds pulsing loading rows and displays a retry banner with cached notifications.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant NotificationsHomeScreen
  participant EateryHaptics
  participant NotificationsHomeViewModel
  NotificationsHomeScreen->>EateryHaptics: refreshStarted()
  NotificationsHomeScreen->>NotificationsHomeViewModel: pullToRefresh()
  NotificationsHomeViewModel->>NotificationsHomeViewModel: fetchNotifications()
  NotificationsHomeViewModel-->>NotificationsHomeScreen: refreshSucceeded event on success
  NotificationsHomeScreen->>EateryHaptics: refreshCompleted()
Loading

Suggested reviewers: andrewcheung360

Merge Risk: Minimal · previous review b02ce

This change adds haptic feedback, pulsing loading placeholders and a connection-error banner. No actionable merge-blocking risk was identified. The failing Notion sync check is an external configuration problem unrelated to the app code.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "Add haptic feedback" matches the main change. The PR adds an EateryHaptics class and rememberEateryHaptics() helper, and wires light ticks to favorite toggles, selection ticks to bottom tab…
Description check Passed The description follows the repository template's main sections: Overview, Changes Made (as a bulleted list under Overview), Testing (corresponding to Test Coverage), and Notes (corresponding to Next …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Add haptic feedback" matches the main change. The PR adds an EateryHaptics class and rememberEateryHaptics() helper, and wires light ticks to favorite toggles, selection ticks to bottom tab changes, and refresh haptics to Notifications pull-to-refresh. The title is short and specific, though it does not mention that the change is centralized in EateryHaptics.

Full details: Description check

Explanation

The description follows the repository template's main sections: Overview, Changes Made (as a bulleted list under Overview), Testing (corresponding to Test Coverage), and Notes (corresponding to Next Steps). The author documents the haptic scope, exclusions, test device, and stacked base branch. The template's Test Coverage section is titled differently in the description, and it lacks a Related PRs or Issues entry, which is optional. Screenshots are optional and absent. Some template headings are not matched exactly, but the required information is present.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 522fc7bc-f77a-4b42-8191-410ace422d5d
Commits

Reviewing files that changed from the base of the PR and between 8895e1e and b02cec6.

Files selected for processing: 4

  • app/src/main/java/com/cornellappdev/android/eatery/ui/components/general/EateryCard.kt
  • app/src/main/java/com/cornellappdev/android/eatery/ui/components/general/FavoriteButton.kt
  • app/src/main/java/com/cornellappdev/android/eatery/ui/haptics/Haptics.kt
  • app/src/main/java/com/cornellappdev/android/eatery/ui/screens/EateryDetailScreen.kt

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@mqiu90
mqiu90 requested a review from caleb-bit November 28, 2026 04:52

@caleb-bit caleb-bit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the diff looks off, I think it includes some of the loading state diffs. maybe rebase is needed

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.

2 participants