ganghee / Android_Pattern

Repository, MVP, MVVM, AAC, Koin
0 stars 0 forks source link

1-3. text의 색이 바뀌지 않는다. #5

Closed ganghee closed 5 years ago

ganghee commented 5 years ago
//색이 바뀌지 않음
        if(dataList[position].signed_change_rate > 0){
            holder.signed_change_rate.textColor = ContextCompat.getColor(ctx, R.color.diff_up)
        }else if (dataList[position].signed_change_rate < 0){
            holder.signed_change_rate.textColor = ContextCompat.getColor(ctx, R.color.diff_down)
        }else{
            holder.signed_change_rate.textColor = ContextCompat.getColor(ctx, R.color.black)
ganghee commented 5 years ago
when {
            dataList[position].signed_change_rate > 0 -> holder.signed_change_rate.textColor =
                ContextCompat.getColor(ctx, R.color.diff_up)
            dataList[position].signed_change_rate < 0 -> holder.signed_change_rate.textColor =
                ContextCompat.getColor(ctx, R.color.diff_down)
            else -> holder.signed_change_rate.textColor = ContextCompat.getColor(ctx, R.color.black)
        }