forked from upstream-mirrors/quik
Add ability to attach and send photos
This commit is contained in:
@@ -20,6 +20,7 @@ package presentation.feature.compose
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.PorterDuff
|
||||
import android.os.Bundle
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
@@ -62,6 +63,7 @@ class ComposeActivity : QkActivity<ComposeViewModel>(), ComposeView {
|
||||
override val copyTextIntent: Subject<Message> = PublishSubject.create()
|
||||
override val forwardMessageIntent: Subject<Message> = PublishSubject.create()
|
||||
override val deleteMessageIntent: Subject<Message> = PublishSubject.create()
|
||||
override val attachmentDeletedIntent: Subject<Bitmap> by lazy { attachmentAdapter.attachmentDeleted }
|
||||
override val textChangedIntent by lazy { message.textChanges() }
|
||||
override val attachIntent by lazy { attach.clicks() }
|
||||
override val sendIntent by lazy { send.clicks() }
|
||||
@@ -69,6 +71,7 @@ class ComposeActivity : QkActivity<ComposeViewModel>(), ComposeView {
|
||||
@Inject lateinit var chipsAdapter: ChipsAdapter
|
||||
@Inject lateinit var contactsAdapter: ContactAdapter
|
||||
@Inject lateinit var messageAdapter: MessagesAdapter
|
||||
@Inject lateinit var attachmentAdapter: AttachmentAdapter
|
||||
|
||||
init {
|
||||
appComponent.inject(this)
|
||||
@@ -120,6 +123,9 @@ class ComposeActivity : QkActivity<ComposeViewModel>(), ComposeView {
|
||||
messageList.layoutManager = layoutManager
|
||||
messageList.adapter = messageAdapter
|
||||
|
||||
attachments.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
|
||||
attachments.adapter = attachmentAdapter
|
||||
|
||||
messageBackground.backgroundTintMode = PorterDuff.Mode.MULTIPLY
|
||||
|
||||
val states = arrayOf(
|
||||
@@ -206,6 +212,11 @@ class ComposeActivity : QkActivity<ComposeViewModel>(), ComposeView {
|
||||
messageAdapter.updateData(state.messages)
|
||||
}
|
||||
|
||||
attachments.setVisible(state.attachments.isNotEmpty())
|
||||
if (attachmentAdapter.data !== state.attachments) {
|
||||
attachmentAdapter.data = state.attachments
|
||||
}
|
||||
|
||||
if (title != state.title) title = state.title
|
||||
|
||||
send.isEnabled = state.canSend
|
||||
|
||||
Reference in New Issue
Block a user