Implement author/uploader display in Media Details

Co-authored-by: nicolas-raoul <99590+nicolas-raoul@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-07-15 12:15:24 +00:00
parent 95aee269bf
commit 2841d55645
3 changed files with 25 additions and 9 deletions

View file

@ -320,11 +320,8 @@ class MediaDetailFragment : CommonsDaggerSupportFragment(), CategoryEditHelper.C
binding.seeMore.setUnderlinedText(R.string.nominated_see_more)
if (isCategoryImage) {
binding.authorLinearLayout.visibility = View.VISIBLE
} else {
binding.authorLinearLayout.visibility = View.GONE
}
// Author/uploader visibility will be determined in setTextFields based on available data
// This initial setting for category images is overridden in setTextFields()
if (!sessionManager.isUserLoggedIn) {
binding.categoryEditButton.visibility = View.GONE
@ -814,10 +811,27 @@ class MediaDetailFragment : CommonsDaggerSupportFragment(), CategoryEditHelper.C
categoryNames.clear()
categoryNames.addAll(media.categories!!)
if (media.author == null || media.author == "") {
// Show author or uploader information for licensing compliance
val authorName = media.author
val uploaderName = media.user
when {
!authorName.isNullOrEmpty() -> {
// Show author if available
binding.mediaDetailAuthorLabel.text = getString(R.string.media_detail_author)
binding.mediaDetailAuthor.text = authorName
binding.authorLinearLayout.visibility = View.VISIBLE
}
!uploaderName.isNullOrEmpty() -> {
// Show uploader as fallback
binding.mediaDetailAuthorLabel.text = getString(R.string.media_detail_uploader)
binding.mediaDetailAuthor.text = uploaderName
binding.authorLinearLayout.visibility = View.VISIBLE
}
else -> {
// Hide if neither author nor uploader is available
binding.authorLinearLayout.visibility = View.GONE
} else {
binding.mediaDetailAuthor.text = media.author
}
}
}

View file

@ -133,6 +133,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/mediaDetailAuthorLabel"
style="@style/MediaDetailTextLabelGeneric"
android:layout_width="@dimen/widget_margin"
android:layout_height="match_parent"

View file

@ -211,6 +211,7 @@
<string name="media_detail_description">Description</string>
<string name="media_detail_discussion">Discussion</string>
<string name="media_detail_author">Author</string>
<string name="media_detail_uploader">Uploader</string>
<string name="media_detail_uploaded_date">Uploaded date</string>
<string name="media_detail_license">License</string>
<string name="media_detail_coordinates">Coordinates</string>