Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Issue #5832: Navigation Banner Appears in Media Details Screen #5839

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,13 @@ private void launchZoomActivityAfterPermissionCheck(final View view) {
@Override
public void onResume() {
super.onResume();
if (getParentFragment() != null && getParentFragment().getParentFragment() != null) {
//Added a check because, not necessarily, the parent fragment will have a parent fragment, say
// in the case when MediaDetailPagerFragment is directly started by the CategoryImagesActivity
if (getParentFragment() instanceof ContributionsFragment) {
((ContributionsFragment) (getParentFragment()
.getParentFragment())).binding.cardViewNearby
.setVisibility(View.GONE);
}

//Hide the Nearby card when looking at media details
ContributionsFragment cf = this.getContributionsFragmentParent();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Java we prefer explicit variable names, even if long. So unless there is a reason I missed, would you mind renaming cf to contributionFragment?

if(cf != null && cf.binding != null){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for nitpicking, but would you mind inserting a space character before if and while, here and below?

cf.binding.cardViewNearby.setVisibility(View.GONE);
}

// detail provider is null when fragment is shown in review activity
if (detailProvider != null) {
media = detailProvider.getMediaAtPosition(index);
Expand Down Expand Up @@ -445,6 +443,27 @@ public void run() {
}
}

/**
* Retrieves the ContributionsFragment that is potentially the parent, grandparent, etc
* fragment of this fragment.
*
* @return The ContributionsFragment instance. If the ContributionsFragment instance could not
* be found, null is returned.
*/
private ContributionsFragment getContributionsFragmentParent(){
Fragment f = this;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, f to fragment.


while(f != null && !(f instanceof ContributionsFragment)){
f = f.getParentFragment();
}

if(f != null){
return (ContributionsFragment)f;
} else {
return null;
}
}

private void displayMediaDetails() {
setTextFields(media);
compositeDisposable.addAll(
Expand Down
Loading