mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 10:35:19 +00:00
Implement conversation activity toolbar
This commit is contained in:
parent
dc4a7d0761
commit
8b084c89b9
@ -4,12 +4,20 @@ import android.os.Bundle
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import kotlinx.android.synthetic.main.activity_conversation_v2.*
|
import kotlinx.android.synthetic.main.activity_conversation_v2.*
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory
|
import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||||
|
import org.thoughtcrime.securesms.mms.GlideApp
|
||||||
|
|
||||||
class ConversationActivityV2 : PassphraseRequiredActionBarActivity() {
|
class ConversationActivityV2 : PassphraseRequiredActionBarActivity() {
|
||||||
private var threadID: Long = -1
|
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
|
// region Settings
|
||||||
companion object {
|
companion object {
|
||||||
const val THREAD_ID = "thread_id"
|
const val THREAD_ID = "thread_id"
|
||||||
@ -22,6 +30,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity() {
|
|||||||
setContentView(R.layout.activity_conversation_v2)
|
setContentView(R.layout.activity_conversation_v2)
|
||||||
threadID = intent.getLongExtra(THREAD_ID, -1)
|
threadID = intent.getLongExtra(THREAD_ID, -1)
|
||||||
setUpRecyclerView()
|
setUpRecyclerView()
|
||||||
|
setUpToolbar()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpRecyclerView() {
|
private fun setUpRecyclerView() {
|
||||||
@ -31,5 +40,19 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity() {
|
|||||||
conversationRecyclerView.adapter = adapter
|
conversationRecyclerView.adapter = adapter
|
||||||
conversationRecyclerView.layoutManager = LinearLayoutManager(this)
|
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
|
// endregion
|
||||||
}
|
}
|
@ -1,11 +1,57 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/contentView"
|
android:id="@+id/contentView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/conversationToolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?colorPrimary"
|
||||||
|
app:contentInsetStart="0dp">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginRight="20dp">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/backButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:src="?attr/homeAsUpIndicator"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/conversationTitleView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginLeft="64dp"
|
||||||
|
android:text="Elon"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="@dimen/very_large_font_size" />
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.loki.views.ProfilePictureView
|
||||||
|
android:id="@+id/conversationSettingsButton"
|
||||||
|
android:layout_width="@dimen/small_profile_picture_size"
|
||||||
|
android:layout_height="@dimen/small_profile_picture_size"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_centerVertical="true" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/conversationRecyclerView"
|
android:id="@+id/conversationRecyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
Reference in New Issue
Block a user