mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Show author/uploader names in Media Details for Commons licensing compliance (#6375)
Some checks are pending
Android CI / Run tests and generate APK (push) Waiting to run
Some checks are pending
Android CI / Run tests and generate APK (push) Waiting to run
* Initial plan * Implement author/uploader display in Media Details Co-authored-by: nicolas-raoul <99590+nicolas-raoul@users.noreply.github.com> * Enhanced implementation to use getAttributedAuthor() for better attribution coverage Co-authored-by: nicolas-raoul <99590+nicolas-raoul@users.noreply.github.com> * Move Author/Uploader fields to be positioned after License field Co-authored-by: nicolas-raoul <99590+nicolas-raoul@users.noreply.github.com> * Remove unnecessary comment lines as requested Co-authored-by: nicolas-raoul <99590+nicolas-raoul@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: nicolas-raoul <99590+nicolas-raoul@users.noreply.github.com>
This commit is contained in:
parent
7500b6d374
commit
0cda8e4d70
3 changed files with 44 additions and 31 deletions
|
|
@ -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 == "") {
|
||||
// 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
|
||||
} else {
|
||||
binding.mediaDetailAuthor.text = media.author
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue