forked from upstream-mirrors/quik
Merge pull request #277 from gavine99/Attach-to-message-UI-266
important fix for npe in messagesadapter with out messages
This commit is contained in:
@@ -211,6 +211,7 @@ class MessagesAdapter @Inject constructor(
|
|||||||
holder.containerView.isActivated = isSelected(message.id) || highlight == message.id
|
holder.containerView.isActivated = isSelected(message.id) || highlight == message.id
|
||||||
|
|
||||||
// Bind the cancelFrame (cancel button) view
|
// Bind the cancelFrame (cancel button) view
|
||||||
|
if (holder.cancelFrame != null) {
|
||||||
holder.cancelFrame.let { cancelFrame ->
|
holder.cancelFrame.let { cancelFrame ->
|
||||||
val isCancellable = message.isSending() && message.date > System.currentTimeMillis()
|
val isCancellable = message.isSending() && message.date > System.currentTimeMillis()
|
||||||
cancelFrame.visibility = if (isCancellable) View.VISIBLE else View.GONE
|
cancelFrame.visibility = if (isCancellable) View.VISIBLE else View.GONE
|
||||||
@@ -232,18 +233,21 @@ class MessagesAdapter @Inject constructor(
|
|||||||
.start()
|
.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bind the send now icon view
|
// bind the send now icon view
|
||||||
|
if (holder.sendNowIcon != null) {
|
||||||
holder.sendNowIcon.let { sendNowIcon ->
|
holder.sendNowIcon.let { sendNowIcon ->
|
||||||
if (message.isSending() && message.date > System.currentTimeMillis()) {
|
if (message.isSending() && message.date > System.currentTimeMillis()) {
|
||||||
sendNowIcon.visibility = View.VISIBLE
|
sendNowIcon.visibility = View.VISIBLE
|
||||||
sendNowIcon.clicks().subscribe { sendNowClicks.onNext(message.id) }
|
sendNowIcon.clicks().subscribe { sendNowClicks.onNext(message.id) }
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
sendNowIcon.visibility = View.GONE
|
sendNowIcon.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bind the resend icon view
|
// bind the resend icon view
|
||||||
|
if (holder.resendIcon != null) {
|
||||||
holder.resendIcon.let { resendIcon ->
|
holder.resendIcon.let { resendIcon ->
|
||||||
if (message.isFailedMessage()) {
|
if (message.isFailedMessage()) {
|
||||||
resendIcon.visibility = View.VISIBLE
|
resendIcon.visibility = View.VISIBLE
|
||||||
@@ -251,10 +255,10 @@ class MessagesAdapter @Inject constructor(
|
|||||||
resendClicks.onNext(message.id)
|
resendClicks.onNext(message.id)
|
||||||
resendIcon.visibility = View.GONE
|
resendIcon.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
resendIcon.visibility = View.GONE
|
resendIcon.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Bind the message status
|
// Bind the message status
|
||||||
bindStatus(holder, message, next)
|
bindStatus(holder, message, next)
|
||||||
|
|||||||
Reference in New Issue
Block a user