mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-21 06:00:38 +01:00
renaming system_id to thread_id
This commit is contained in:
parent
35c205605d
commit
661798cff4
@ -187,20 +187,20 @@ class MainActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
conversations.forEach { clonedConversation ->
|
||||
if (!cachedConversations.map { it.system_id }.contains(clonedConversation.system_id)) {
|
||||
if (!cachedConversations.map { it.thread_id }.contains(clonedConversation.thread_id)) {
|
||||
conversationsDB.insertOrUpdate(clonedConversation)
|
||||
cachedConversations.add(clonedConversation)
|
||||
}
|
||||
}
|
||||
|
||||
cachedConversations.forEach { cachedConversation ->
|
||||
if (!conversations.map { it.system_id }.contains(cachedConversation.system_id)) {
|
||||
if (!conversations.map { it.thread_id }.contains(cachedConversation.thread_id)) {
|
||||
conversationsDB.delete(cachedConversation.id!!)
|
||||
}
|
||||
}
|
||||
|
||||
cachedConversations.forEach { cachedConversation ->
|
||||
val conv = conversations.firstOrNull { it.system_id == cachedConversation.system_id && it.getStringToCompare() != cachedConversation.getStringToCompare() }
|
||||
val conv = conversations.firstOrNull { it.thread_id == cachedConversation.thread_id && it.getStringToCompare() != cachedConversation.getStringToCompare() }
|
||||
if (conv != null) {
|
||||
conversationsDB.insertOrUpdate(conv)
|
||||
}
|
||||
@ -218,7 +218,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).system_id)
|
||||
putExtra(THREAD_ID, (it as Conversation).thread_id)
|
||||
putExtra(THREAD_TITLE, it.title)
|
||||
startActivity(this)
|
||||
}
|
||||
|
@ -59,9 +59,9 @@ class ConversationsAdapter(activity: SimpleActivity, var conversations: ArrayLis
|
||||
|
||||
override fun getIsItemSelectable(position: Int) = true
|
||||
|
||||
override fun getItemSelectionKey(position: Int) = conversations.getOrNull(position)?.system_id
|
||||
override fun getItemSelectionKey(position: Int) = conversations.getOrNull(position)?.thread_id
|
||||
|
||||
override fun getItemKeyPosition(key: Int) = conversations.indexOfFirst { it.system_id == key }
|
||||
override fun getItemKeyPosition(key: Int) = conversations.indexOfFirst { it.thread_id == key }
|
||||
|
||||
override fun onActionModeCreated() {}
|
||||
|
||||
@ -129,10 +129,10 @@ class ConversationsAdapter(activity: SimpleActivity, var conversations: ArrayLis
|
||||
return
|
||||
}
|
||||
|
||||
val conversationsToRemove = conversations.filter { selectedKeys.contains(it.system_id) } as ArrayList<Conversation>
|
||||
val conversationsToRemove = conversations.filter { selectedKeys.contains(it.thread_id) } as ArrayList<Conversation>
|
||||
val positions = getSelectedItemPositions()
|
||||
conversationsToRemove.forEach {
|
||||
activity.deleteConversation(it.system_id)
|
||||
activity.deleteConversation(it.thread_id)
|
||||
}
|
||||
conversations.removeAll(conversationsToRemove)
|
||||
|
||||
@ -164,7 +164,7 @@ class ConversationsAdapter(activity: SimpleActivity, var conversations: ArrayLis
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSelectedItems() = conversations.filter { selectedKeys.contains(it.system_id) } as ArrayList<Conversation>
|
||||
private fun getSelectedItems() = conversations.filter { selectedKeys.contains(it.thread_id) } as ArrayList<Conversation>
|
||||
|
||||
override fun onViewRecycled(holder: ViewHolder) {
|
||||
super.onViewRecycled(holder)
|
||||
@ -184,7 +184,7 @@ class ConversationsAdapter(activity: SimpleActivity, var conversations: ArrayLis
|
||||
|
||||
private fun setupView(view: View, conversation: Conversation) {
|
||||
view.apply {
|
||||
conversation_frame.isSelected = selectedKeys.contains(conversation.system_id)
|
||||
conversation_frame.isSelected = selectedKeys.contains(conversation.thread_id)
|
||||
|
||||
conversation_address.text = conversation.title
|
||||
conversation_body_short.text = conversation.snippet
|
||||
|
@ -17,6 +17,6 @@ interface ConversationsDao {
|
||||
@Query("DELETE FROM conversations WHERE id = :id")
|
||||
fun delete(id: Long)
|
||||
|
||||
@Query("DELETE FROM conversations WHERE system_id = :threadId")
|
||||
@Query("DELETE FROM conversations WHERE thread_id = :threadId")
|
||||
fun deleteThreadId(threadId: Long)
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ import androidx.room.Entity
|
||||
import androidx.room.Index
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(tableName = "conversations", indices = [(Index(value = ["system_id"], unique = true))])
|
||||
@Entity(tableName = "conversations", indices = [(Index(value = ["thread_id"], unique = true))])
|
||||
data class Conversation(
|
||||
@PrimaryKey(autoGenerate = true) var id: Long?,
|
||||
@ColumnInfo(name = "system_id") var system_id: Int,
|
||||
@ColumnInfo(name = "thread_id") var thread_id: Int,
|
||||
@ColumnInfo(name = "snippet") var snippet: String,
|
||||
@ColumnInfo(name = "date") var date: Int,
|
||||
@ColumnInfo(name = "read") var read: Boolean,
|
||||
|
Loading…
x
Reference in New Issue
Block a user