| @@ -0,0 +1,3 @@ | ||
| package com.example.benjo.bil_app_kotlin.list.model | ||
|
|
||
| data class Row(var desc : String?, var data : String?) |
| @@ -0,0 +1,27 @@ | ||
| package com.example.benjo.bil_app_kotlin.list.ordinary | ||
|
|
||
|
|
||
| import android.os.Bundle | ||
| import android.view.View | ||
| import com.example.benjo.bil_app_kotlin.BaseFragment | ||
| import com.example.benjo.bil_app_kotlin.list.model.Row | ||
| import kotlinx.android.synthetic.main.fragment_base.* | ||
|
|
||
|
|
||
| class BasicListFragment : BaseFragment() { | ||
| private val arrayList = arrayListOf<Row>() | ||
| private var listAdapter: ListAdapter? = null | ||
|
|
||
|
|
||
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
| super.onViewCreated(view, savedInstanceState) | ||
| listAdapter = ListAdapter(arrayList) | ||
| list.adapter = listAdapter | ||
| } | ||
|
|
||
| fun updateList(list: ArrayList<Row>) { | ||
| listAdapter?.setList(list) | ||
| } | ||
|
|
||
|
|
||
| } |
| @@ -0,0 +1,10 @@ | ||
| package com.example.benjo.bil_app_kotlin.list.ordinary | ||
|
|
||
| import android.support.v7.widget.RecyclerView | ||
| import android.view.View | ||
| import kotlinx.android.synthetic.main.row_list.view.* | ||
|
|
||
| class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | ||
| val descRow = itemView.row_tv_desc | ||
| val dataRow = itemView.row_tv_data | ||
| } |
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
|
||
| <!-- pressed --> | ||
| <item android:color="@color/colorBlack200" android:state_pressed="true"/> | ||
|
|
||
|
|
||
| </selector> |
| @@ -11,5 +11,4 @@ | ||
| android:layout_height="match_parent" | ||
| android:scrollbars="vertical" /> | ||
|
|
||
| </FrameLayout> | ||