mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Convert CaptionListViewAdapter to kotlin
This commit is contained in:
parent
1483e87331
commit
c28ea14cac
1 changed files with 6 additions and 15 deletions
|
|
@ -11,25 +11,16 @@ import fr.free.nrw.commons.R
|
|||
* Adapter for Caption Listview
|
||||
*/
|
||||
class CaptionListViewAdapter(var captions: List<Caption>) : BaseAdapter() {
|
||||
override fun getCount(): Int {
|
||||
return captions.size
|
||||
}
|
||||
override fun getCount(): Int = captions.size
|
||||
|
||||
override fun getItem(i: Int): Any? {
|
||||
return null
|
||||
}
|
||||
override fun getItem(i: Int): Any? = null
|
||||
|
||||
override fun getItemId(i: Int): Long {
|
||||
return 0
|
||||
}
|
||||
override fun getItemId(i: Int): Long = 0
|
||||
|
||||
override fun getView(i: Int, view: View, viewGroup: ViewGroup): View {
|
||||
val captionLanguageTextView: TextView
|
||||
val captionTextView: TextView
|
||||
val captionLayout = LayoutInflater.from(viewGroup.context)
|
||||
.inflate(R.layout.caption_item, null)
|
||||
captionLanguageTextView = captionLayout.findViewById(R.id.caption_language_textview)
|
||||
captionTextView = captionLayout.findViewById(R.id.caption_text)
|
||||
val captionLayout = LayoutInflater.from(viewGroup.context).inflate(R.layout.caption_item, null)
|
||||
val captionLanguageTextView = captionLayout.findViewById<TextView>(R.id.caption_language_textview)
|
||||
val captionTextView = captionLayout.findViewById<TextView>(R.id.caption_text)
|
||||
if (captions.size == 1 && captions[0].value == "No Caption") {
|
||||
captionLanguageTextView.text = captions[i].language
|
||||
captionTextView.text = captions[i].value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue