Enable support toolbar for ProfileActivity and added a couple of unit… (#5188)

* Enable support toolbar for ProfileActivity and added a couple of unit tests

* Nit fixes

* Nit Fixes

* Minor styling changes in ContributionsFragment
This commit is contained in:
Priyank Shankar 2023-04-03 12:32:16 +05:30 committed by GitHub
parent fc672dbd9b
commit 07616485ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 97 additions and 50 deletions

View file

@ -196,6 +196,10 @@ public class ContributionsFragment
@Override
public void onCreateOptionsMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater) {
// Removing contributions menu items for ProfileActivity
if (getActivity() instanceof ProfileActivity) { return; }
inflater.inflate(R.menu.contribution_activity_notification_menu, menu);
MenuItem notificationsMenuItem = menu.findItem(R.id.notifications);
@ -339,23 +343,23 @@ public class ContributionsFragment
if (fragment.isAdded() && otherFragment != null) {
transaction.hide(otherFragment);
transaction.show(fragment);
transaction.addToBackStack(CONTRIBUTION_LIST_FRAGMENT_TAG);
transaction.addToBackStack(tag);
transaction.commit();
getChildFragmentManager().executePendingTransactions();
} else if (fragment.isAdded() && otherFragment == null) {
transaction.show(fragment);
transaction.addToBackStack(CONTRIBUTION_LIST_FRAGMENT_TAG);
transaction.addToBackStack(tag);
transaction.commit();
getChildFragmentManager().executePendingTransactions();
}else if (!fragment.isAdded() && otherFragment != null ) {
transaction.hide(otherFragment);
transaction.add(R.id.root_frame, fragment, tag);
transaction.addToBackStack(CONTRIBUTION_LIST_FRAGMENT_TAG);
transaction.addToBackStack(tag);
transaction.commit();
getChildFragmentManager().executePendingTransactions();
} else if (!fragment.isAdded()) {
transaction.replace(R.id.root_frame, fragment, tag);
transaction.addToBackStack(CONTRIBUTION_LIST_FRAGMENT_TAG);
transaction.addToBackStack(tag);
transaction.commit();
getChildFragmentManager().executePendingTransactions();
}
@ -641,7 +645,7 @@ public class ContributionsFragment
@Override
public void showDetail(int position, boolean isWikipediaButtonDisplayed) {
if (mediaDetailPagerFragment == null || !mediaDetailPagerFragment.isVisible()) {
mediaDetailPagerFragment = new MediaDetailPagerFragment();
mediaDetailPagerFragment = new MediaDetailPagerFragment(false, true);
if(isUserProfile) {
((ProfileActivity)getActivity()).setScroll(false);
}