Browse Source

put setToolbar() on onResume()

fix problem with ActionBar duplicating
renovate/androidx.fragment-fragment-ktx-1.x
Austin Huang 3 years ago
parent
commit
5221442988
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 2
      app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java
  2. 2
      app/src/main/java/awais/instagrabber/fragments/LocationFragment.java
  3. 7
      app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java
  4. 3
      app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.kt

2
app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java

@ -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();
}

2
app/src/main/java/awais/instagrabber/fragments/LocationFragment.java

@ -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();
}

7
app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java

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

3
app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.kt

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

Loading…
Cancel
Save