fix tab highlight when programmatically showing tab

This commit is contained in:
Hans-Christoph Steiner committed 2023-07-06 20:07:00 +02:00
1 parent 04a5a4b8d9
commit 5cf4f32e44
1 file changed
+6 -1
@@ -146,10 +146,15 @@ public class MainActivity extends AppCompatActivity {
handleSearchOrAppViewIntent(intent);
}
/**
* {@link android.material.navigation.NavigationBarView} says "Menu items
* can also be used for programmatically selecting which destination is
* currently active. It can be done using {@code MenuItem.setChecked(true)}".
*/
private void setSelectedMenuInNav(int menuId) {
int position = adapter.adapterPositionFromItemId(menuId);
pager.scrollToPosition(position);
bottomNavigation.setSelectedItemId(position);
bottomNavigation.getMenu().getItem(position).setChecked(true);
}
private void initialRepoUpdateIfRequired() {