fix tab highlight when programmatically showing tab

This commit is contained in:
Hans-Christoph Steiner
2023-07-06 14:30:22 +02:00
parent 04a5a4b8d9
commit 5cf4f32e44

View File

@@ -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() {