Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chiru bhaiya amazing
Browse files Browse the repository at this point in the history
rchtgpt committed Jan 23, 2020
1 parent 741653e commit 4c90673
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package org.mifos.mobile.cn.data.models.beneficiaries

data class ListBeneficiary(val name: String, val description: String, val price: String)
data class Beneficiary(val name: String, val description: String, val price: String)
Original file line number Diff line number Diff line change
@@ -6,9 +6,10 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import org.mifos.mobile.cn.R
import org.mifos.mobile.cn.data.models.beneficiaries.ListBeneficiary
import org.mifos.mobile.cn.data.models.beneficiaries.Beneficiary

class BeneficiariesAdapter(val beneficiariesList: ArrayList<Beneficiary>) : RecyclerView.Adapter<BeneficiariesAdapter.ViewHolder>() {

class BeneficiariesAdapter(val beneficiariesList: ArrayList<ListBeneficiary>) : RecyclerView.Adapter<BeneficiariesAdapter.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val v = LayoutInflater.from(parent.context).inflate(R.layout.item_beneficiaries, parent, false)
return ViewHolder(v)
@@ -19,7 +20,7 @@ class BeneficiariesAdapter(val beneficiariesList: ArrayList<ListBeneficiary>) :
}

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val list: ListBeneficiary = beneficiariesList[position]
val list: Beneficiary = beneficiariesList[position]
holder.textViewName?.text = list.name
holder.textViewDescription?.text = list.description
holder.textViewPrice?.text = list.price
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.activity_beneficiaries.*
import org.mifos.mobile.cn.R
import org.mifos.mobile.cn.data.models.beneficiaries.ListBeneficiary
import org.mifos.mobile.cn.data.models.beneficiaries.Beneficiary
import org.mifos.mobile.cn.ui.adapter.BeneficiariesAdapter

class BeneficiariesActivity : AppCompatActivity() {
@@ -25,12 +25,12 @@ class BeneficiariesActivity : AppCompatActivity() {

beneficiariesRecyclerView.layoutManager = LinearLayoutManager(this, RecyclerView.VERTICAL, false)

val items = ArrayList<ListBeneficiary>()
items.add(ListBeneficiary(name, description, price))
items.add(ListBeneficiary(name, description, price))
items.add(ListBeneficiary(name, description, price))
items.add(ListBeneficiary(name, description, price))
items.add(ListBeneficiary(name, description, price))
val items = ArrayList<Beneficiary>()
items.add(Beneficiary(name, description, price))
items.add(Beneficiary(name, description, price))
items.add(Beneficiary(name, description, price))
items.add(Beneficiary(name, description, price))
items.add(Beneficiary(name, description, price))

val adapter = BeneficiariesAdapter(items)
beneficiariesRecyclerView.adapter = adapter

0 comments on commit 4c90673

Please sign in to comment.