|
|
@ -29,6 +29,7 @@ import androidx.appcompat.widget.SearchView; |
|
|
|
import androidx.appcompat.widget.Toolbar; |
|
|
|
import androidx.coordinatorlayout.widget.CoordinatorLayout; |
|
|
|
import androidx.core.app.NotificationManagerCompat; |
|
|
|
import androidx.fragment.app.Fragment; |
|
|
|
import androidx.fragment.app.FragmentManager; |
|
|
|
import androidx.lifecycle.LiveData; |
|
|
|
import androidx.navigation.NavBackStackEntry; |
|
|
@ -56,6 +57,7 @@ import awais.instagrabber.asyncs.SuggestionsFetcher; |
|
|
|
import awais.instagrabber.customviews.helpers.CustomHideBottomViewOnScrollBehavior; |
|
|
|
import awais.instagrabber.databinding.ActivityMainBinding; |
|
|
|
import awais.instagrabber.fragments.PostViewV2Fragment; |
|
|
|
import awais.instagrabber.fragments.main.FeedFragment; |
|
|
|
import awais.instagrabber.fragments.settings.MorePreferencesFragmentDirections; |
|
|
|
import awais.instagrabber.interfaces.FetchListener; |
|
|
|
import awais.instagrabber.models.IntentModel; |
|
|
@ -429,6 +431,16 @@ public class MainActivity extends BaseLanguageActivity implements FragmentManage |
|
|
|
firstFragmentGraphIndex); |
|
|
|
navControllerLiveData.observe(this, navController -> setupNavigation(binding.toolbar, navController)); |
|
|
|
currentNavControllerLiveData = navControllerLiveData; |
|
|
|
binding.bottomNavView.setOnNavigationItemReselectedListener(item -> { |
|
|
|
// Log.d(TAG, "setupBottomNavigationBar: item: " + item); |
|
|
|
final Fragment navHostFragment = getSupportFragmentManager().findFragmentById(R.id.main_nav_host); |
|
|
|
if (navHostFragment != null) { |
|
|
|
final Fragment fragment = navHostFragment.getChildFragmentManager().getPrimaryNavigationFragment(); |
|
|
|
if (fragment instanceof FeedFragment) { |
|
|
|
((FeedFragment) fragment).scrollToTop(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private void setBottomNavSelectedItem(final int navId) { |
|
|
|