mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-02 15:53:55 +01:00
MediaDetailFragment.java: replace code that is meant to hide nearby card
Before this commit, code would attempt to find and hide the nearby card that would appear when the user was looking at media details. However, this code did not work. After this commit, the old code has been replaced with code that correctly hides the nearby card. Also, this new code uses a helper method call and is overall easier to read.
This commit is contained in:
parent
408f5a3b57
commit
4c8875944f
1 changed files with 7 additions and 9 deletions
|
|
@ -362,15 +362,13 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment implements
|
|||
@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();
|
||||
if(cf != null && cf.binding != null){
|
||||
cf.binding.cardViewNearby.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// detail provider is null when fragment is shown in review activity
|
||||
if (detailProvider != null) {
|
||||
media = detailProvider.getMediaAtPosition(index);
|
||||
|
|
@ -448,7 +446,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment implements
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue