Skip to content

Commit 43d6bed

Browse files
committed
CallLogAdapter.kt: Fix bind method
1 parent 9f95159 commit 43d6bed

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/src/main/java/com/addev/listaspam/calllog/CallLogAdapter.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,20 @@ class CallLogAdapter(
4242
private val reportButton: Button = itemView.findViewById(R.id.reportButton)
4343

4444
fun bind(callLog: CallLogEntry, isBlocked: Boolean) {
45-
numberTextView.text = "${callLog.number}${if (isBlocked) " (blocked)" else ""}"
45+
val number = callLog.number ?: ""
46+
val textToShow = if (isBlocked) "$number (blocked)" else number
47+
numberTextView.text = textToShow
4648
dateTextView.text = formatter.format(callLog.date)
4749
durationTextView.text = "Duration: ${callLog.duration} seconds"
4850

4951
if (isBlocked) {
5052
numberTextView.setTextColor(ContextCompat.getColor(context, android.R.color.holo_red_light))
53+
} else {
54+
numberTextView.setTextColor(ContextCompat.getColor(context, android.R.color.system_palette_key_color_neutral_light)) // O el color por defecto
5155
}
5256

5357
reportButton.setOnClickListener {
54-
val url = String.format(SpamUtils.REPORT_URL_TEMPLATE, callLog.number)
58+
val url = String.format(SpamUtils.REPORT_URL_TEMPLATE, number)
5559
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
5660
context.startActivity(intent)
5761
}

0 commit comments

Comments
 (0)