blob: 874e73b8fd801adcbd4d67c9bfc9ba6d591a1d33 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package ca.allanwang.kau.sample
import android.os.Bundle
import ca.allanwang.kau.iitems.CardIItem
import ca.allanwang.kau.ui.activities.ElasticRecyclerActivity
import ca.allanwang.kau.utils.toast
import com.mikepenz.fastadapter.IItem
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter
import com.mikepenz.google_material_typeface_library.GoogleMaterial
/**
* Created by Allan Wang on 2017-07-17.
*/
class AdapterActivity : ElasticRecyclerActivity() {
val adapter = FastItemAdapter<IItem<*, *>>()
override fun onCreate(savedInstanceState: Bundle?, configs: Configs): Boolean {
recycler.adapter = adapter
adapter.add(listOf(
CardIItem {
titleRes = R.string.kau_text_copied
descRes = R.string.kau_lorem_ipsum
imageIIcon = GoogleMaterial.Icon.gmd_file_download
},
CardIItem {
titleRes = R.string.kau_text_copied
descRes = R.string.kau_lorem_ipsum
},
CardIItem {
titleRes = R.string.kau_text_copied
imageIIcon = GoogleMaterial.Icon.gmd_file_download
cardClick = { toast("Card click") }
},
CardIItem {
titleRes = R.string.kau_text_copied
descRes = R.string.kau_lorem_ipsum
imageIIcon = GoogleMaterial.Icon.gmd_file_download
button = "Test"
buttonClick = { toast("T") }
},
CardIItem {
titleRes = R.string.kau_text_copied
button = "Test"
buttonClick = { toast("HI") }
}
))
setOutsideTapListener { finishAfterTransition() }
return true
}
}
|