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
|
* Adapter for Caption Listview
|
||||||
*/
|
*/
|
||||||
class CaptionListViewAdapter(var captions: List<Caption>) : BaseAdapter() {
|
class CaptionListViewAdapter(var captions: List<Caption>) : BaseAdapter() {
|
||||||
override fun getCount(): Int {
|
override fun getCount(): Int = captions.size
|
||||||
return captions.size
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItem(i: Int): Any? {
|
override fun getItem(i: Int): Any? = null
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemId(i: Int): Long {
|
override fun getItemId(i: Int): Long = 0
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getView(i: Int, view: View, viewGroup: ViewGroup): View {
|
override fun getView(i: Int, view: View, viewGroup: ViewGroup): View {
|
||||||
val captionLanguageTextView: TextView
|
val captionLayout = LayoutInflater.from(viewGroup.context).inflate(R.layout.caption_item, null)
|
||||||
val captionTextView: TextView
|
val captionLanguageTextView = captionLayout.findViewById<TextView>(R.id.caption_language_textview)
|
||||||
val captionLayout = LayoutInflater.from(viewGroup.context)
|
val captionTextView = captionLayout.findViewById<TextView>(R.id.caption_text)
|
||||||
.inflate(R.layout.caption_item, null)
|
|
||||||
captionLanguageTextView = captionLayout.findViewById(R.id.caption_language_textview)
|
|
||||||
captionTextView = captionLayout.findViewById(R.id.caption_text)
|
|
||||||
if (captions.size == 1 && captions[0].value == "No Caption") {
|
if (captions.size == 1 && captions[0].value == "No Caption") {
|
||||||
captionLanguageTextView.text = captions[i].language
|
captionLanguageTextView.text = captions[i].language
|
||||||
captionTextView.text = captions[i].value
|
captionTextView.text = captions[i].value
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue