work with threadIds as Longs, not Ints
This commit is contained in:
parent
e357b4a659
commit
6405b7431f
12 changed files with 56 additions and 59 deletions
|
|
@ -193,20 +193,20 @@ class MainActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
conversations.forEach { clonedConversation ->
|
||||
if (!cachedConversations.map { it.thread_id }.contains(clonedConversation.thread_id)) {
|
||||
if (!cachedConversations.map { it.threadId }.contains(clonedConversation.threadId)) {
|
||||
conversationsDB.insertOrUpdate(clonedConversation)
|
||||
cachedConversations.add(clonedConversation)
|
||||
}
|
||||
}
|
||||
|
||||
cachedConversations.forEach { cachedConversation ->
|
||||
if (!conversations.map { it.thread_id }.contains(cachedConversation.thread_id)) {
|
||||
if (!conversations.map { it.threadId }.contains(cachedConversation.threadId)) {
|
||||
conversationsDB.delete(cachedConversation.id!!)
|
||||
}
|
||||
}
|
||||
|
||||
cachedConversations.forEach { cachedConversation ->
|
||||
val conv = conversations.firstOrNull { it.thread_id == cachedConversation.thread_id && it.getStringToCompare() != cachedConversation.getStringToCompare() }
|
||||
val conv = conversations.firstOrNull { it.threadId == cachedConversation.threadId && it.getStringToCompare() != cachedConversation.getStringToCompare() }
|
||||
if (conv != null) {
|
||||
conversationsDB.insertOrUpdate(conv)
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ class MainActivity : SimpleActivity() {
|
|||
if (currAdapter == null) {
|
||||
ConversationsAdapter(this, conversations, conversations_list, conversations_fastscroller) {
|
||||
Intent(this, ThreadActivity::class.java).apply {
|
||||
putExtra(THREAD_ID, (it as Conversation).thread_id)
|
||||
putExtra(THREAD_ID, (it as Conversation).threadId)
|
||||
putExtra(THREAD_TITLE, it.title)
|
||||
startActivity(this)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
private val MIN_DATE_TIME_DIFF_SECS = 300
|
||||
private val PICK_ATTACHMENT_INTENT = 1
|
||||
|
||||
private var threadId = 0
|
||||
private var threadId = 0L
|
||||
private var currentSIMCardIndex = 0
|
||||
private var isActivityVisible = false
|
||||
private var threadItems = ArrayList<ThreadItem>()
|
||||
|
|
@ -72,7 +72,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
return
|
||||
}
|
||||
|
||||
threadId = intent.getIntExtra(THREAD_ID, 0)
|
||||
threadId = intent.getLongExtra(THREAD_ID, 0L)
|
||||
intent.getStringExtra(THREAD_TITLE)?.let {
|
||||
supportActionBar?.title = it
|
||||
}
|
||||
|
|
@ -290,7 +290,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
val newThreadId = getThreadId(numbers).toInt()
|
||||
val newThreadId = getThreadId(numbers)
|
||||
if (threadId != newThreadId) {
|
||||
Intent(this, ThreadActivity::class.java).apply {
|
||||
putExtra(THREAD_ID, newThreadId)
|
||||
|
|
@ -430,7 +430,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
|
||||
private fun markAsUnread() {
|
||||
ensureBackgroundThread {
|
||||
conversationsDB.markUnread(threadId.toLong())
|
||||
conversationsDB.markUnread(threadId)
|
||||
markThreadMessagesUnread(threadId)
|
||||
runOnUiThread {
|
||||
finish()
|
||||
|
|
@ -474,7 +474,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
if (!message.read) {
|
||||
hadUnreadItems = true
|
||||
markMessageRead(message.id, message.isMMS)
|
||||
conversationsDB.markRead(threadId.toLong())
|
||||
conversationsDB.markRead(threadId)
|
||||
}
|
||||
|
||||
if (i == cnt - 1 && message.type == Telephony.Sms.MESSAGE_TYPE_SENT) {
|
||||
|
|
@ -595,7 +595,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
try {
|
||||
transaction.sendNewMessage(message, threadId.toLong())
|
||||
transaction.sendNewMessage(message, threadId)
|
||||
|
||||
thread_type_message.setText("")
|
||||
attachmentUris.clear()
|
||||
|
|
@ -665,7 +665,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
@Subscribe(threadMode = ThreadMode.ASYNC)
|
||||
fun refreshMessages(event: Events.RefreshMessages) {
|
||||
if (isActivityVisible) {
|
||||
notificationManager.cancel(threadId)
|
||||
notificationManager.cancel(threadId.hashCode())
|
||||
}
|
||||
|
||||
messages = getMessages(threadId)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue