package Ġcom . h ill park . h ill park . adapters Ċ Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ import Ġcom . h ill park . h ill park . App Class Ċ import Ġcom . h ill park . h ill park App . R Ċ import Ġcom . h ill park . h ill park . model . Card Operation Ċ import Ġkotlinx . android . synt hetic . main . item _ history _ operation . view .* Ċ Ċ class ĠCard History Adapter ( private Ġval Ġlist : ĠList < Card Operation >) Ġ: Ġ ĠRecyclerView . Adapter < RecyclerView . ViewHolder >() Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠRecyclerView . ViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠNotification ViewHolder ( LayoutInflater . from (( parent . context )). inflate ( R . layout . item _ history _ operation , Ġparent , Ġfalse )) ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġlist . size ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠRecyclerView . ViewHolder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġholder . item View . oper Title Label . text Ġ= Ġlist [ position ]. title ĊĠĠĠĠĠĠĠ Ġholder . item View . sum Label . text Ġ= Ġlist [ position ]. amount ĊĠĠĠĠĠĠĠ Ġholder . item View . time Label . text Ġ= Ġlist [ position ]. time ĊĠĠĠĠĠĠĠ Ġholder . item View . date Label . text Ġ= Ġlist [ position ]. date ĊĠĠĠĠĠĠĠ Ġif ( list [ position ]. amount . contains ("- ")){ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġholder . item View . sum Label . setTextColor ( App Class . getContext (). resources . getColor ( R . color . minus _ color )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġholder . item View . icon Operation . setImage Drawable ( App Class . getContext (). resources . get Drawable ( R . drawable . ic _ minus _ red )) ĊĠĠĠĠĠĠĠ Ġ} else { ĊĠĠĠĠĠĠĠĠĠĠĠ Ġholder . item View . sum Label . setTextColor ( App Class . getContext (). resources . getColor ( R . color . plus _ color )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġholder . item View . icon Operation . setImage Drawable ( App Class . getContext (). resources . get Drawable ( R . drawable . ic _ plus _ green )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġclass ĠNotification ViewHolder ( v : ĠView ) Ġ: ĠRecyclerView . ViewHolder ( v ) Ċ }