Merge branch 'commons-app:main' into issue-6064

This commit is contained in:
Sonal Yadav 2025-07-16 10:36:23 +05:30 committed by GitHub
commit be752678de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 44 additions and 31 deletions

View file

@ -320,12 +320,6 @@ 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
}
if (!sessionManager.isUserLoggedIn) {
binding.categoryEditButton.visibility = View.GONE
binding.descriptionEdit.visibility = View.GONE
@ -814,10 +808,27 @@ class MediaDetailFragment : CommonsDaggerSupportFragment(), CategoryEditHelper.C
categoryNames.clear()
categoryNames.addAll(media.categories!!)
if (media.author == null || media.author == "") {
binding.authorLinearLayout.visibility = View.GONE
} else {
binding.mediaDetailAuthor.text = media.author
// Show author or uploader information for licensing compliance
val authorName = media.getAttributedAuthor()
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
}
}
}

View file

@ -125,27 +125,6 @@
</LinearLayout>
<LinearLayout
style="@style/MediaDetailContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/authorLinearLayout"
android:orientation="horizontal">
<TextView
style="@style/MediaDetailTextLabelGeneric"
android:layout_width="@dimen/widget_margin"
android:layout_height="match_parent"
android:text="@string/media_detail_author" />
<TextView
style="@style/MediaDetailTextBody"
android:id="@+id/mediaDetailAuthor"
android:layout_width="@dimen/widget_margin"
android:layout_height="match_parent"
tools:text="Media author user name goes here." />
</LinearLayout>
<LinearLayout
android:id="@+id/caption_layout"
style="@style/MediaDetailContainer"
@ -263,6 +242,28 @@
tools:text="License link" />
</LinearLayout>
<LinearLayout
style="@style/MediaDetailContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/authorLinearLayout"
android:orientation="horizontal">
<TextView
android:id="@+id/mediaDetailAuthorLabel"
style="@style/MediaDetailTextLabelGeneric"
android:layout_width="@dimen/widget_margin"
android:layout_height="match_parent"
android:text="@string/media_detail_author" />
<TextView
style="@style/MediaDetailTextBody"
android:id="@+id/mediaDetailAuthor"
android:layout_width="@dimen/widget_margin"
android:layout_height="match_parent"
tools:text="Media author user name goes here." />
</LinearLayout>
<LinearLayout
style="@style/MediaDetailContainer"
android:layout_width="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>