Skip to content

Move home screen tabs to a bottom navigation bar#3688

Open
kkebb wants to merge 10 commits into
quran:mainfrom
kkebb:feature/bottom-nav-home
Open

Move home screen tabs to a bottom navigation bar#3688
kkebb wants to merge 10 commits into
quran:mainfrom
kkebb:feature/bottom-nav-home

Conversation

@kkebb

@kkebb kkebb commented Jun 16, 2026

Copy link
Copy Markdown

Summary

Reworks the home/index screen (QuranActivity) chrome so the primary navigation and the action toolbar both live at the bottom of the screen, within easy thumb reach.

  • Moves the navigation (Surahs / Juz / Bookmarks) from the top swipeable tab strip to a Material BottomNavigationView at the bottom.
  • Moves the action toolbar (last page, search, overflow menu) from the top to the bottom, below the bottom navigation as the bottom-most element. The overflow popup opens upward. The Toolbar remains the support action bar, so all menu items behave exactly as before.
  • Applies the same BottomNavTheme (Material Components Bridge) to both the bottom navigation and the action toolbar so icon/title colors match.
  • Flattens the bottom chrome: disables Material elevation overlays and forces zero elevation on both bars so no shadow gradient appears between the nav and toolbar (a flat 1dp top divider separates scrolling content from the bottom chrome instead).
  • When search is expanded, hide the bottom nav and lift only the search toolbar above the keyboard.
  • Selection stays in sync both ways: tapping a bottom tab switches the pager, and swiping the pager updates the selected tab (a guard flag avoids feedback loops). RTL order is preserved via the existing abs(position - 2) mapping.
  • Edge-to-edge insets: the root reserves both the top (status bar) and bottom (navigation/gesture bar) insets.

PR stack & overlap

This PR is one of three related UX improvements. It does not share any files with #3687 — they touch different screens:

PR Screen Scope
#3687 Reading (PagerActivity) Bottom toolbar + audio bar
This PR (#3688) Home (QuranActivity) Bottom nav tabs + bottom toolbar
#3686 Both Random ayah menu (merges this PR + #3687)

Both bottom PRs use similar patterns (bottom chrome, inset handling, search keyboard behavior) but on different activities and layout files. They can merge in either order.

Changes

  • res/layout/quran_index.xml — pager weighted on top; bottom_chrome container at bottom with nav then toolbar; flat backgrounds and zero elevation.
  • res/drawable/bottom_chrome_background.xml — flat toolbar color with 1dp top divider for content separation.
  • ui/QuranActivity.kt — bottom-nav ↔ pager wiring; root bottom inset + toolbar IME handling; hide nav on search expand; programmatic zero elevation on bottom chrome views.
  • ui/fragment/{SuraList,JuzList,Bookmarks}Fragment.kt — removed per-list bottom inset padding (now owned by bottom chrome).
  • New: menu/bottom_nav_menu.xml, drawable/ic_nav_{surahs,juz,bookmarks}.xml, color/bottom_nav_item_color.xml, BottomNavTheme in themes.xml.

Related

Test plan

  • Tap each tab (Surahs / Juz / Bookmarks); pager switches and the correct tab highlights.
  • Bottom action toolbar shows title + last page + search + overflow; overflow opens upward.
  • Nav and toolbar share a flat background with no gradient/shadow between them.
  • Gesture-nav: bottom chrome sits flush above the system navigation bar.
  • Expand search; confirm bottom nav hides and only the search toolbar sits above the keyboard.
  • Swipe the pager; the bottom nav selection follows.
  • RTL locale (e.g. Arabic): initial tab and tab↔page mapping are correct.
  • Bookmarks multi-select: contextual action mode still appears correctly.

Test results

./gradlew :app:testMadaniDebugUnitTest -PdisableFirebase
  • BUILD SUCCESSFUL (latest run: 2026-06-16)
  • Full :app unit test suite passing (0 failures, 0 errors)

Also verified on an Android emulator (API 36, Pixel 6): bottom nav and action toolbar render stacked at the bottom (nav above, toolbar below), tab switching works, overflow opens upward, search keyboard behavior confirmed, and the flat background fix removes the elevation shadow gradient between the two bars.

Note: the original BottomNavTheme referenced ThemeOverlay.MaterialComponents.DayNight, which does not exist in the Material Components library and caused resource linking to fail. It now uses Theme.MaterialComponents.DayNight.Bridge.

Made with Cursor

Replace the top swipeable SlidingTabLayout on the home screen with a
Material BottomNavigationView (Surahs / Juz / Bookmarks) at the bottom,
within easier thumb reach.

- Keep the existing ViewPager and its 3 fragments; sync selection in both
  directions (tap to switch and swipe), with RTL-aware index mapping.
- Add a contained Material ThemeOverlay applied only on the bottom nav, so
  the rest of the AppCompat-themed app is untouched.
- Add nav icons, menu, and a selected/unselected color selector.
- Move the bottom navigation-bar inset to the bottom nav; the list
  fragments no longer add their own bottom inset padding.

Co-authored-by: Cursor <cursoragent@cursor.com>
ThemeOverlay.MaterialComponents.DayNight does not exist in the Material
Components library, causing resource linking to fail. Use the
Theme.MaterialComponents.DayNight.Bridge theme, which supplies the
Material attributes BottomNavigationView needs on top of the app's
AppCompat theme.

Co-authored-by: Cursor <cursoragent@cursor.com>
kkebb and others added 8 commits June 16, 2026 13:07
Relocate the home screen action toolbar (last page, search, overflow menu)
below the surah/juz pager so it sits directly above the bottom navigation
bar, keeping all primary controls within thumb reach. Reserve the bottom
window inset so the toolbar and bottom navigation clear the navigation/
gesture bar in edge-to-edge mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
Order the home screen action toolbar as the bottom-most element, beneath the
Surahs/Juz/Bookmarks navigation bar.

Co-authored-by: Cursor <cursoragent@cursor.com>
The bottom-most action toolbar no longer uses ToolBarArea elevation, so its
shadow is not cast downward into the gesture bar. Elevation stays on the
bottom navigation bar above it, separating the scrolling content from the
bottom chrome.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use the same Material Components theme on the bottom action toolbar as the
bottom navigation bar so icon and title colors match. Extend BottomNavTheme
with shared control and text color attributes for toolbar rendering.

Co-authored-by: Cursor <cursoragent@cursor.com>
Wrap the bottom navigation and action toolbar in a single elevated container
so the shadow separates scrolling content from the bottom chrome instead of
casting between the two bars. Give the toolbar an explicit flat background
and zero elevation so it matches the navigation bar surface.

Co-authored-by: Cursor <cursoragent@cursor.com>
Material BottomNavigationView still applied a default elevation shadow onto
the action toolbar even with android:elevation="0dp" in XML. Remove wrapper
elevation, disable elevation overlays in BottomNavTheme, force zero elevation
and translationZ in code, and replace the content separator with a flat top
divider drawable.

Co-authored-by: Cursor <cursoragent@cursor.com>
Include IME insets in the home screen root window inset listener so the
bottom navigation and action toolbar move above the soft keyboard when the
SearchView is expanded.

Co-authored-by: Cursor <cursoragent@cursor.com>
Hide the bottom navigation while SearchView is expanded and apply IME
insets to the action toolbar only, instead of lifting the entire bottom
chrome stack above the keyboard.

Co-authored-by: Cursor <cursoragent@cursor.com>
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