Skip to content
Merged
Show file tree
Hide file tree
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 @@ -87,6 +87,7 @@ import fr.free.nrw.commons.category.CategoryClient
import fr.free.nrw.commons.category.CategoryDetailsActivity
import fr.free.nrw.commons.category.CategoryEditHelper
import fr.free.nrw.commons.contributions.ContributionsFragment
import fr.free.nrw.commons.contributions.MainActivity
import fr.free.nrw.commons.coordinates.CoordinateEditHelper
import fr.free.nrw.commons.databinding.FragmentMediaDetailBinding
import fr.free.nrw.commons.delete.DeleteHelper
Expand Down Expand Up @@ -793,6 +794,14 @@ class MediaDetailFragment : CommonsDaggerSupportFragment(), CategoryEditHelper.C
super.onDestroyView()
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (activity is MainActivity) {
//explicitly hides the tabs when the media details screen is opened.
(activity as MainActivity).hideTabs()
}
}

private fun setTextFields(media: Media) {
setupImageView()
binding.mediaDetailTitle.text = media.displayTitle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ class MediaDetailPagerFragment : CommonsDaggerSupportFragment(), OnPageChangeLis
// If fragment is associated with ProfileActivity, then hide the tabLayout
if (activity is ProfileActivity) {
(activity as ProfileActivity).setTabLayoutVisibility(false)
} else if (activity is MainActivity) {
(activity as MainActivity).hideTabs()
}

binding!!.mediaDetailsPager.adapter = adapter
Expand Down Expand Up @@ -142,6 +140,14 @@ class MediaDetailPagerFragment : CommonsDaggerSupportFragment(), OnPageChangeLis
initProvider()
}

override fun onDestroyView() {
super.onDestroyView()
if (activity is MainActivity) {
(activity as MainActivity).showTabs()
}
binding = null
}

/**
* initialise the provider, based on from where the fragment was started, as in from an activity
* or a fragment
Expand Down