2021-05-31 06:06:02 +02:00
|
|
|
package org.thoughtcrime.securesms.conversation.v2
|
|
|
|
|
|
|
|
import android.os.Bundle
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
2021-05-31 06:29:11 +02:00
|
|
|
import kotlinx.android.synthetic.main.activity_conversation_v2.*
|
2021-05-31 06:06:02 +02:00
|
|
|
import network.loki.messenger.R
|
2021-06-01 08:17:14 +02:00
|
|
|
import org.session.libsession.utilities.TextSecurePreferences
|
2021-05-31 06:06:02 +02:00
|
|
|
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
|
|
|
import org.thoughtcrime.securesms.database.DatabaseFactory
|
2021-06-01 08:17:14 +02:00
|
|
|
import org.thoughtcrime.securesms.mms.GlideApp
|
2021-05-31 06:06:02 +02:00
|
|
|
|
|
|
|
class ConversationActivityV2 : PassphraseRequiredActionBarActivity() {
|
|
|
|
private var threadID: Long = -1
|
|
|
|
|
2021-06-01 08:17:14 +02:00
|
|
|
private val thread by lazy {
|
|
|
|
DatabaseFactory.getThreadDatabase(this).getRecipientForThreadId(threadID)!!
|
|
|
|
}
|
|
|
|
|
|
|
|
private val glide by lazy { GlideApp.with(this) }
|
|
|
|
|
2021-05-31 06:06:02 +02:00
|
|
|
// region Settings
|
|
|
|
companion object {
|
|
|
|
const val THREAD_ID = "thread_id"
|
|
|
|
}
|
|
|
|
// endregion
|
|
|
|
|
|
|
|
// region Lifecycle
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?, isReady: Boolean) {
|
|
|
|
super.onCreate(savedInstanceState, isReady)
|
|
|
|
setContentView(R.layout.activity_conversation_v2)
|
|
|
|
threadID = intent.getLongExtra(THREAD_ID, -1)
|
|
|
|
setUpRecyclerView()
|
2021-06-01 08:17:14 +02:00
|
|
|
setUpToolbar()
|
2021-05-31 06:06:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private fun setUpRecyclerView() {
|
|
|
|
val cursor = DatabaseFactory.getMmsSmsDatabase(this).getConversation(threadID)
|
|
|
|
val adapter = ConversationAdapter(this, cursor)
|
|
|
|
adapter.setHasStableIds(true)
|
2021-05-31 06:29:11 +02:00
|
|
|
conversationRecyclerView.adapter = adapter
|
|
|
|
conversationRecyclerView.layoutManager = LinearLayoutManager(this)
|
2021-05-31 06:06:02 +02:00
|
|
|
}
|
2021-06-01 08:17:14 +02:00
|
|
|
|
|
|
|
private fun setUpToolbar() {
|
|
|
|
backButton.setOnClickListener { onBackPressed() }
|
|
|
|
conversationTitleView.text = thread.toShortString()
|
|
|
|
conversationSettingsButton.glide = glide
|
|
|
|
conversationSettingsButton.update(thread, threadID)
|
|
|
|
conversationSettingsButton.setOnClickListener { showConversationSettings() }
|
|
|
|
}
|
|
|
|
// endregion
|
|
|
|
|
|
|
|
// region Interaction
|
|
|
|
private fun showConversationSettings() {
|
|
|
|
// TODO: Implement
|
|
|
|
}
|
2021-05-31 06:06:02 +02:00
|
|
|
// endregion
|
|
|
|
}
|