mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Hide input if the user isn't part of a group
This commit is contained in:
parent
1fbb3d3dd5
commit
07de201fde
@ -201,6 +201,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
setUpLinkPreviewObserver()
|
||||
scrollToFirstUnreadMessageIfNeeded()
|
||||
markAllAsRead()
|
||||
showOrHideInputIfNeeded()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
@ -381,12 +382,25 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Animation & Updating
|
||||
override fun onModified(recipient: Recipient) {
|
||||
runOnUiThread {
|
||||
if (thread.isContactRecipient) {
|
||||
blockedBanner.isVisible = thread.isBlocked
|
||||
}
|
||||
updateSubtitle()
|
||||
showOrHideInputIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showOrHideInputIfNeeded() {
|
||||
if (thread.isClosedGroupRecipient) {
|
||||
val group = DatabaseFactory.getGroupDatabase(this).getGroup(thread.address.toGroupString()).orNull()
|
||||
val isActive = (group?.isActive == true)
|
||||
Log.d("Test", "isActive: $isActive")
|
||||
inputBar.showInput = isActive
|
||||
} else {
|
||||
inputBar.showInput = true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,8 @@ class InputBar : RelativeLayout, InputBarEditTextDelegate, QuoteViewDelegate, Li
|
||||
var additionalContentHeight = 0
|
||||
var quote: MessageRecord? = null
|
||||
var linkPreview: LinkPreview? = null
|
||||
var showInput: Boolean = true
|
||||
set(value) { field = value; showOrHideInputIfNeeded() }
|
||||
|
||||
var text: String
|
||||
get() { return inputBarEditText.text.toString() }
|
||||
@ -159,6 +161,19 @@ class InputBar : RelativeLayout, InputBarEditTextDelegate, QuoteViewDelegate, Li
|
||||
additionalContentHeight = 0
|
||||
setHeight(newHeight)
|
||||
}
|
||||
|
||||
private fun showOrHideInputIfNeeded() {
|
||||
if (showInput) {
|
||||
setOf( inputBarEditText, attachmentsButton ).forEach { it.isVisible = true }
|
||||
microphoneButton.isVisible = text.isEmpty()
|
||||
sendButton.isVisible = text.isNotEmpty()
|
||||
} else {
|
||||
cancelQuoteDraft()
|
||||
cancelLinkPreviewDraft()
|
||||
val views = setOf( inputBarEditText, attachmentsButton, microphoneButton, sendButton )
|
||||
views.forEach { it.isVisible = false }
|
||||
}
|
||||
}
|
||||
// endregion
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user