Refresh bottom nav counter even if app is not open (#7970)

This commit is contained in:
Hans-Peter Lehmann 2025-08-31 11:41:49 +02:00 committed by GitHub
parent ad94f2f647
commit 3fa9607d72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 12 deletions

View File

@ -145,6 +145,7 @@ public class MainActivity extends CastEnabledActivity {
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
drawerLayout = null;
bottomNavigation.onCreateView();
} else {
bottomNavigation.hide();
bottomNavigation = null;
@ -337,7 +338,7 @@ public class MainActivity extends CastEnabledActivity {
drawerLayout.removeDrawerListener(drawerToggle);
}
if (bottomNavigation != null) {
bottomNavigation.onDestroy();
bottomNavigation.onDestroyView();
}
}
@ -571,9 +572,6 @@ public class MainActivity extends CastEnabledActivity {
super.onStart();
EventBus.getDefault().register(this);
new RatingDialogManager(this).showIfNeeded();
if (bottomNavigation != null) {
bottomNavigation.onStart();
}
getOnBackPressedDispatcher().addCallback(this, openDefaultPageBackPressedCallback);
getOnBackPressedDispatcher().addCallback(this, bottomSheetBackPressedCallback);
}
@ -603,9 +601,6 @@ public class MainActivity extends CastEnabledActivity {
protected void onStop() {
super.onStop();
EventBus.getDefault().unregister(this);
if (bottomNavigation != null) {
bottomNavigation.onStop();
}
}
@Override

View File

@ -148,15 +148,12 @@ public class BottomNavigation {
bottomNavigationView.setVisibility(View.GONE);
}
public void onStart() {
public void onCreateView() {
EventBus.getDefault().register(this);
}
public void onStop() {
public void onDestroyView() {
EventBus.getDefault().unregister(this);
}
public void onDestroy() {
if (bottomNavigationBadgeLoader != null) {
bottomNavigationBadgeLoader.dispose();
bottomNavigationBadgeLoader = null;