| | |
| | | |
| | | fun bind(record: ReminderRecord) { |
| | | binding.apply { |
| | | categoryNameText.text = record.categoryName |
| | | // 设置图标 |
| | | // 根据提醒类别设置不同图标 |
| | | val iconResource = when (record.categoryId) { |
| | | 1 -> R.drawable.reminder_express // 快递 |
| | | 2 -> R.drawable.reminder_finance // 还款 |
| | | 3 -> R.drawable.reminder_income // 收入 |
| | | 4 -> R.drawable.reminder_flight // 航班 |
| | | 5 -> R.drawable.reminder_train // 火车票 |
| | | else -> R.drawable.reminder_express // 默认使用快递图标 |
| | | } |
| | | categoryIcon.setImageResource(iconResource) |
| | | contentText.text = record.content |
| | | timeText.text = dateFormat.format(Date(record.createdAt)) |
| | | |
| | | // 设置状态图标 |
| | | statusIcon.setImageResource( |
| | | if (record.status == ReminderRecord.STATUS_UNREAD) |
| | | R.drawable.ic_reminder |
| | | else |
| | | R.drawable.ic_add |
| | | ) |
| | | // 保留已读/未读状态的视觉区分,现在仅通过整体项目透明度区分 |
| | | val alpha = if (record.status == ReminderRecord.STATUS_UNREAD) 1.0f else 0.7f |
| | | root.alpha = alpha |
| | | } |
| | | } |
| | | } |