Skip to content

Commit 7d3fb8d

Browse files
committed
Added Kotlin sources
1 parent e0701c3 commit 7d3fb8d

File tree

2 files changed

+485
-0
lines changed

2 files changed

+485
-0
lines changed

Kotlin/SwiftAdapter.kt

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package com.jmarkstar.swiftandroid
2+
3+
import android.view.View
4+
import android.view.ViewGroup
5+
import android.widget.BaseAdapter
6+
7+
/**
8+
* Created by coleman on 3/18/18.
9+
*/
10+
11+
open class SwiftAdapter(__swiftObject: Long) : BaseAdapter() {
12+
13+
val __swiftObject: Long
14+
15+
init {
16+
17+
this.__swiftObject = __swiftObject
18+
}
19+
20+
external fun __finalize(__swiftObject: Long)
21+
22+
fun finalize() {
23+
__finalize(__swiftObject)
24+
}
25+
26+
// adapter
27+
28+
private external fun __getCount(__swiftObject: Long): Int;
29+
30+
override fun getCount(): Int {
31+
32+
return __getCount(__swiftObject)
33+
}
34+
35+
override fun getItem(position: Int): Any? {
36+
37+
return null
38+
}
39+
40+
override fun getItemId(position: Int): Long {
41+
42+
return position.toLong()
43+
}
44+
45+
private external fun __getView(__swiftObject: Long, position: Int, convertView: View?, parent: ViewGroup): View;
46+
47+
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
48+
49+
return __getView(__swiftObject, position, convertView, parent)
50+
51+
/*
52+
val view: View
53+
val cell: CustomCell
54+
55+
// create
56+
if (convertView == null) {
57+
58+
view = inflater!!.inflate(R.layout.cell, parent, false)
59+
60+
cell = CustomCell()
61+
cell.textView = view.findViewById(R.id.textView) as TextView
62+
63+
view.tag = cell
64+
65+
} else {
66+
67+
view = convertView
68+
cell = view.tag as CustomCell
69+
}
70+
71+
// configure
72+
listener.configureCell(cell, position)
73+
74+
return view
75+
*/
76+
}
77+
}

0 commit comments

Comments
 (0)