mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	corrected
This commit is contained in:
		
							parent
							
								
									0827cdc64a
								
							
						
					
					
						commit
						4e261fc219
					
				
					 1 changed files with 17 additions and 2 deletions
				
			
		|  | @ -201,7 +201,7 @@ class MediaDetailFragment : CommonsDaggerSupportFragment(), CategoryEditHelper.C | ||||||
|     /** |     /** | ||||||
|      * Depicts is a feature part of Structured data. |      * Depicts is a feature part of Structured data. | ||||||
|      * Multiple Depictions can be added for an image just like categories. |      * Multiple Depictions can be added for an image just like categories. | ||||||
|      * However unlike categories depictions is multi-lingual |      * However unlike categories depictions is multi-lingualmedia | ||||||
|      * Ex: key: en value: monument |      * Ex: key: en value: monument | ||||||
|      */ |      */ | ||||||
|     private var imageInfoCache: ImageInfo? = null |     private var imageInfoCache: ImageInfo? = null | ||||||
|  | @ -861,8 +861,22 @@ class MediaDetailFragment : CommonsDaggerSupportFragment(), CategoryEditHelper.C | ||||||
|      */ |      */ | ||||||
|     private fun buildDepictionList(idAndCaptions: List<IdAndCaptions>) { |     private fun buildDepictionList(idAndCaptions: List<IdAndCaptions>) { | ||||||
|         binding.mediaDetailDepictionContainer.removeAllViews() |         binding.mediaDetailDepictionContainer.removeAllViews() | ||||||
|  | 
 | ||||||
|  |         // Create a mutable list from the original list | ||||||
|  |         val mutableIdAndCaptions = idAndCaptions.toMutableList() | ||||||
|  | 
 | ||||||
|  |         if (mutableIdAndCaptions.isEmpty()) { | ||||||
|  |             // Create a placeholder IdAndCaptions object and add it to the list | ||||||
|  |             mutableIdAndCaptions.add( | ||||||
|  |                 IdAndCaptions( | ||||||
|  |                     id = media?.pageId ?: "", // Use an empty string if media?.pageId is null | ||||||
|  |                     captions = mapOf(Locale.getDefault().language to getString(R.string.detail_panel_cats_none)) // Create a Map with the language as the key and the message as the value | ||||||
|  |                 ) | ||||||
|  |             ) | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         val locale: String = Locale.getDefault().language |         val locale: String = Locale.getDefault().language | ||||||
|         for (idAndCaption: IdAndCaptions in idAndCaptions) { |         for (idAndCaption: IdAndCaptions in mutableIdAndCaptions) { | ||||||
|             binding.mediaDetailDepictionContainer.addView( |             binding.mediaDetailDepictionContainer.addView( | ||||||
|                 buildDepictLabel( |                 buildDepictLabel( | ||||||
|                     getDepictionCaption(idAndCaption, locale), |                     getDepictionCaption(idAndCaption, locale), | ||||||
|  | @ -873,6 +887,7 @@ class MediaDetailFragment : CommonsDaggerSupportFragment(), CategoryEditHelper.C | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|     private fun getDepictionCaption(idAndCaption: IdAndCaptions, locale: String): String? { |     private fun getDepictionCaption(idAndCaption: IdAndCaptions, locale: String): String? { | ||||||
|         // Check if the Depiction Caption is available in user's locale |         // Check if the Depiction Caption is available in user's locale | ||||||
|         // if not then check for english, else show any available. |         // if not then check for english, else show any available. | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Sujal-Gupta-SG
						Sujal-Gupta-SG