mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-17 20:20:53 +01:00
Show SIM in details only if multiple are present
This commit is contained in:
parent
45416c07bd
commit
c1b29646d3
@ -20,13 +20,17 @@ class MessageDetailsDialog(val activity: BaseSimpleActivity, val message: Messag
|
|||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
val view = activity.layoutInflater.inflate(R.layout.dialog_message_details, null).apply {
|
val view = activity.layoutInflater.inflate(R.layout.dialog_message_details, null).apply {
|
||||||
dialog_message_details_text_value.text = """
|
dialog_message_details_text_value.text = mutableListOf<String>().apply {
|
||||||
${activity.getString(R.string.message_details_type)}: ${message.getMessageType()}
|
add("${activity.getString(R.string.message_details_type)}: ${message.getMessageType()}")
|
||||||
${message.getReceiverOrSenderLabel()}: ${message.getReceiverOrSenderPhoneNumbers()}
|
add("${message.getReceiverOrSenderLabel()}: ${message.getReceiverOrSenderPhoneNumbers()}")
|
||||||
SIM: ${message.getSIM(availableSIMs)}
|
if (availableSIMs.count() > 1) {
|
||||||
${activity.getString(R.string.message_details_sent_at)}: ${message.getSentAt()}
|
add("SIM: ${message.getSIM(availableSIMs)}")
|
||||||
${message.getReceivedAtLine()}
|
}
|
||||||
""".trimIndent().trimEnd()
|
add("${activity.getString(R.string.message_details_sent_at)}: ${message.getSentAt()}")
|
||||||
|
if (message.isReceivedMessage()) {
|
||||||
|
add("${activity.getString(R.string.message_details_received_at)}: ${message.getReceivedAt()}")
|
||||||
|
}
|
||||||
|
}.joinToString(separator = System.lineSeparator())
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.getAlertDialogBuilder()
|
activity.getAlertDialogBuilder()
|
||||||
@ -60,14 +64,6 @@ class MessageDetailsDialog(val activity: BaseSimpleActivity, val message: Messag
|
|||||||
return DateTime(dateSent * 1000L).toString(activity.config.dateFormat + " " + activity.getTimeFormat())
|
return DateTime(dateSent * 1000L).toString(activity.config.dateFormat + " " + activity.getTimeFormat())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Message.getReceivedAtLine(): String {
|
|
||||||
return if (isReceivedMessage()) {
|
|
||||||
"${activity.getString(R.string.message_details_received_at)}: ${getReceivedAt()}"
|
|
||||||
} else {
|
|
||||||
""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun Message.getReceivedAt(): String {
|
private fun Message.getReceivedAt(): String {
|
||||||
return DateTime(date * 1000L).toString("${activity.config.dateFormat} ${activity.getTimeFormat()}")
|
return DateTime(date * 1000L).toString("${activity.config.dateFormat} ${activity.getTimeFormat()}")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user