From 8b084c89b9c4dee9cd8697a4ddb0ce1bef92173a Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Tue, 1 Jun 2021 16:17:14 +1000 Subject: [PATCH] Implement conversation activity toolbar --- .../conversation/v2/ConversationActivityV2.kt | 23 ++++++++++ .../res/layout/activity_conversation_v2.xml | 46 +++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index 2b70bb5d39..5633627037 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -4,12 +4,20 @@ import android.os.Bundle import androidx.recyclerview.widget.LinearLayoutManager import kotlinx.android.synthetic.main.activity_conversation_v2.* import network.loki.messenger.R +import org.session.libsession.utilities.TextSecurePreferences import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity import org.thoughtcrime.securesms.database.DatabaseFactory +import org.thoughtcrime.securesms.mms.GlideApp class ConversationActivityV2 : PassphraseRequiredActionBarActivity() { private var threadID: Long = -1 + private val thread by lazy { + DatabaseFactory.getThreadDatabase(this).getRecipientForThreadId(threadID)!! + } + + private val glide by lazy { GlideApp.with(this) } + // region Settings companion object { const val THREAD_ID = "thread_id" @@ -22,6 +30,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity() { setContentView(R.layout.activity_conversation_v2) threadID = intent.getLongExtra(THREAD_ID, -1) setUpRecyclerView() + setUpToolbar() } private fun setUpRecyclerView() { @@ -31,5 +40,19 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity() { conversationRecyclerView.adapter = adapter conversationRecyclerView.layoutManager = LinearLayoutManager(this) } + + 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 + } // endregion } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_conversation_v2.xml b/app/src/main/res/layout/activity_conversation_v2.xml index 13dc9d7e4c..d76737410e 100644 --- a/app/src/main/res/layout/activity_conversation_v2.xml +++ b/app/src/main/res/layout/activity_conversation_v2.xml @@ -1,11 +1,57 @@ + + + + + + + + + + + + + +