AA-4 | Reyaz & Shashidhara | Create adapter for reading a card view
This commit is contained in:
@@ -1,2 +1,14 @@
|
||||
package com.navi.medici.android_customer_app.bottomNavigation.myLoans
|
||||
package com.navi.medici.android_customer_app.bottomNavigation.myLoans
|
||||
|
||||
import java.util.*
|
||||
|
||||
data class Loan(
|
||||
val status: LoanStatus?,
|
||||
val emiDue: Long?,
|
||||
val amount: Long?,
|
||||
val dueDate: Date?,
|
||||
val type: LoanType?,
|
||||
val startDate: Date?,
|
||||
val interestRate: Float?,
|
||||
val completionDate: Date?
|
||||
)
|
||||
|
||||
@@ -1,2 +1,6 @@
|
||||
package com.navi.medici.android_customer_app.bottomNavigation.myLoans
|
||||
package com.navi.medici.android_customer_app.bottomNavigation.myLoans
|
||||
|
||||
enum class LoanStatus {
|
||||
ACTIVE,
|
||||
COMPLETED
|
||||
}
|
||||
|
||||
@@ -1,2 +1,6 @@
|
||||
package com.navi.medici.android_customer_app.bottomNavigation.myLoans
|
||||
package com.navi.medici.android_customer_app.bottomNavigation.myLoans
|
||||
|
||||
enum class LoanType(val type: String) {
|
||||
COUNTDOWN("Countdown Loan"),
|
||||
PERSONAL("Personal Loan")
|
||||
}
|
||||
|
||||
@@ -1,2 +1,30 @@
|
||||
package com.navi.medici.android_customer_app.bottomNavigation.myLoans
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.navi.medici.android_customer_app.R
|
||||
|
||||
class MyLoansAdapter : RecyclerView.Adapter<MyLoansAdapter.MyLoansViewHolder>() {
|
||||
private var loans = listOf<Loan>()
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyLoansViewHolder {
|
||||
val layoutInflater = LayoutInflater.from(parent.context)
|
||||
val view = layoutInflater.inflate(R.layout.loan_card, parent, false)
|
||||
return MyLoansViewHolder(view)
|
||||
}
|
||||
|
||||
fun setLoans(loans: List<Loan>) {
|
||||
this.loans = loans
|
||||
}
|
||||
|
||||
override fun getItemCount() = loans.count()
|
||||
|
||||
override fun onBindViewHolder(holder: MyLoansViewHolder, position: Int) {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
class MyLoansViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user