1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-14 10:47:30 +00:00

put setToolbar() on onResume()

fix problem with ActionBar duplicating
This commit is contained in:
Austin Huang 2021-07-12 20:19:05 -04:00
parent eba32935ae
commit 5221442988
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
4 changed files with 10 additions and 4 deletions

View File

@ -305,7 +305,6 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
@Override
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
fragmentActivity.setToolbar(binding.toolbar, this);
if (!shouldRefresh) return;
binding.swipeRefreshLayout.setOnRefreshListener(this);
init();
@ -321,6 +320,7 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
@Override
public void onResume() {
super.onResume();
fragmentActivity.setToolbar(binding.toolbar, this);
setTitle();
}

View File

@ -300,7 +300,6 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
@Override
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
fragmentActivity.setToolbar(binding.toolbar, this);
if (!shouldRefresh) return;
binding.swipeRefreshLayout.setOnRefreshListener(this);
init();
@ -315,6 +314,7 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
@Override
public void onResume() {
super.onResume();
fragmentActivity.setToolbar(binding.toolbar, this);
setTitle();
}

View File

@ -280,7 +280,6 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
@Override
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
fragmentActivity.setToolbar(binding.toolbar, this);
if (!shouldRefresh) return;
binding.feedSwipeRefreshLayout.setOnRefreshListener(this);
/*
@ -335,6 +334,12 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
fetchStories();
}
@Override
public void onResume() {
super.onResume();
fragmentActivity.setToolbar(binding.toolbar, this);
}
@Override
public void onStop() {
super.onStop();

View File

@ -380,12 +380,14 @@ class ProfileFragment : Fragment(), OnRefreshListener, ConfirmDialogFragmentCall
override fun onResume() {
super.onResume()
mainActivity.setToolbar(binding.toolbar, this)
try {
val backStackEntry = NavHostFragment.findNavController(this).currentBackStackEntry
if (backStackEntry != null) {
backStackSavedStateResultLiveData = backStackEntry.savedStateHandle.getLiveData("result")
backStackSavedStateResultLiveData?.observe(viewLifecycleOwner, backStackSavedStateObserver)
}
mainActivity.supportActionBar?.title = viewModel.username.value
} catch (e: Exception) {
Log.e(TAG, "onResume: ", e)
}
@ -439,7 +441,6 @@ class ProfileFragment : Fragment(), OnRefreshListener, ConfirmDialogFragmentCall
}
private fun init() {
mainActivity.setToolbar(binding.toolbar, this)
binding.swipeRefreshLayout.setOnRefreshListener(this)
disableDm = !isNavRootInCurrentTabs("direct_messages_nav_graph")
setupHighlights()