material-components / material-components/material-components-android

[BottomNavigationView] BottomNavigationView can have only one setOnNavigationItemSelectedListener

Open
#735 3 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request Good First Issue Widget: BottomNavigation
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

FEATURE REQUEST

As per title, BottomNavigationView can have only one setOnNavigationItemSelectedListener. This is annoying because if i use the
bottomNavigationView.setupWithNavController(navController)
this internally sets that listener, and i cannot use it anymore for anything else (like setting the text in a custom appBar, for example)
A list of listeners would be the right thing in my opinion.

Ps. this probably applies to setOnNavigationItemReselectedListener(BottomNavigationView.OnNavigationItemReselectedListener listener)
too.

For Pattern reference, see NavController addOnDestinationChangedListener and removeOnDestinationChangedListener

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading BottomNavigationView's setOnNavigationItemSelectedListener and setOnNavigationItemReselectedListener APIs, then compare their behavior with NavController's addOnDestinationChangedListener and removeOnDestinationChangedListener pattern. Done should allow the navigation setup and another consumer to receive the relevant callbacks without breaking existing listener behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.