Avoid warnings in MessageListAdapter
This commit is contained in:
@@ -62,19 +62,18 @@ class MessageListAdapter(private val ctx: Context, private val rows: ArrayList<M
|
|||||||
var info: String
|
var info: String
|
||||||
val cal = GregorianCalendar()
|
val cal = GregorianCalendar()
|
||||||
cal.timeInMillis = message.timeStamp
|
cal.timeInMillis = message.timeStamp
|
||||||
val fmt: DateFormat
|
val fmt: DateFormat = if (isToday(message.timeStamp))
|
||||||
if (isToday(message.timeStamp))
|
DateFormat.getTimeInstance(DateFormat.SHORT)
|
||||||
fmt = DateFormat.getTimeInstance(DateFormat.SHORT)
|
|
||||||
else
|
else
|
||||||
fmt = DateFormat.getDateInstance(DateFormat.SHORT)
|
DateFormat.getDateInstance(DateFormat.SHORT)
|
||||||
info = fmt.format(cal.time)
|
info = fmt.format(cal.time)
|
||||||
if (info.length < 6) info = "${ctx.getString(R.string.today)} $info"
|
if (info.length < 6) info = "${ctx.getString(R.string.today)} $info"
|
||||||
info = "$info - $peer"
|
info = "$info - $peer"
|
||||||
if (message.direction == R.drawable.arrow_up_red) {
|
if (message.direction == R.drawable.arrow_up_red) {
|
||||||
if (message.responseCode != 0)
|
info = if (message.responseCode != 0)
|
||||||
info = "$info - ${ctx.getString(R.string.message_failed)}: " + "${message.responseCode} ${message.responseReason}"
|
"$info - ${ctx.getString(R.string.message_failed)}: " + "${message.responseCode} ${message.responseReason}"
|
||||||
else
|
else
|
||||||
info = "$info - ${ctx.getString(R.string.sending_failed)}"
|
"$info - ${ctx.getString(R.string.sending_failed)}"
|
||||||
viewHolder.infoView.setTextColor(ContextCompat.getColor(ctx, R.color.colorAccent))
|
viewHolder.infoView.setTextColor(ContextCompat.getColor(ctx, R.color.colorAccent))
|
||||||
}
|
}
|
||||||
viewHolder.infoView.text = info
|
viewHolder.infoView.text = info
|
||||||
|
|||||||
Reference in New Issue
Block a user