mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-21 09:18:27 +00:00
Merge branch 'ui' of https://github.com/oxen-io/session-android into ui
This commit is contained in:
commit
fa737a5b05
@ -56,7 +56,6 @@ import org.session.libsession.messaging.sending_receiving.MessageSender
|
|||||||
import org.session.libsession.utilities.Address
|
import org.session.libsession.utilities.Address
|
||||||
import org.session.libsession.utilities.TextSecurePreferences
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
import org.session.libsession.utilities.concurrent.SimpleTask
|
import org.session.libsession.utilities.concurrent.SimpleTask
|
||||||
import org.session.libsession.messaging.sending_receiving.MessageSender.send
|
|
||||||
import org.session.libsession.messaging.sending_receiving.attachments.Attachment
|
import org.session.libsession.messaging.sending_receiving.attachments.Attachment
|
||||||
import org.session.libsession.messaging.sending_receiving.link_preview.LinkPreview
|
import org.session.libsession.messaging.sending_receiving.link_preview.LinkPreview
|
||||||
import org.session.libsession.messaging.sending_receiving.quotes.QuoteModel
|
import org.session.libsession.messaging.sending_receiving.quotes.QuoteModel
|
||||||
@ -105,7 +104,6 @@ import org.thoughtcrime.securesms.permissions.Permissions
|
|||||||
import org.thoughtcrime.securesms.util.DateUtils
|
import org.thoughtcrime.securesms.util.DateUtils
|
||||||
import org.thoughtcrime.securesms.util.MediaUtil
|
import org.thoughtcrime.securesms.util.MediaUtil
|
||||||
import org.thoughtcrime.securesms.util.SaveAttachmentTask
|
import org.thoughtcrime.securesms.util.SaveAttachmentTask
|
||||||
import org.w3c.dom.Text
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.concurrent.ExecutionException
|
import java.util.concurrent.ExecutionException
|
||||||
import kotlin.math.*
|
import kotlin.math.*
|
||||||
@ -270,18 +268,22 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
gifButtonContainer.addView(gifButton)
|
gifButtonContainer.addView(gifButton)
|
||||||
gifButton.layoutParams = RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)
|
gifButton.layoutParams = RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)
|
||||||
gifButton.onUp = { showGIFPicker() }
|
gifButton.onUp = { showGIFPicker() }
|
||||||
|
gifButton.snIsEnabled = false
|
||||||
// Document button
|
// Document button
|
||||||
documentButtonContainer.addView(documentButton)
|
documentButtonContainer.addView(documentButton)
|
||||||
documentButton.layoutParams = RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)
|
documentButton.layoutParams = RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)
|
||||||
documentButton.onUp = { showDocumentPicker() }
|
documentButton.onUp = { showDocumentPicker() }
|
||||||
|
documentButton.snIsEnabled = false
|
||||||
// Library button
|
// Library button
|
||||||
libraryButtonContainer.addView(libraryButton)
|
libraryButtonContainer.addView(libraryButton)
|
||||||
libraryButton.layoutParams = RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)
|
libraryButton.layoutParams = RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)
|
||||||
libraryButton.onUp = { pickFromLibrary() }
|
libraryButton.onUp = { pickFromLibrary() }
|
||||||
|
libraryButton.snIsEnabled = false
|
||||||
// Camera button
|
// Camera button
|
||||||
cameraButtonContainer.addView(cameraButton)
|
cameraButtonContainer.addView(cameraButton)
|
||||||
cameraButton.layoutParams = RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)
|
cameraButton.layoutParams = RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)
|
||||||
cameraButton.onUp = { showCamera() }
|
cameraButton.onUp = { showCamera() }
|
||||||
|
cameraButton.snIsEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun restoreDraftIfNeeded() {
|
private fun restoreDraftIfNeeded() {
|
||||||
@ -500,11 +502,11 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
|
|
||||||
override fun toggleAttachmentOptions() {
|
override fun toggleAttachmentOptions() {
|
||||||
val targetAlpha = if (isShowingAttachmentOptions) 0.0f else 1.0f
|
val targetAlpha = if (isShowingAttachmentOptions) 0.0f else 1.0f
|
||||||
val allButtons = listOf( cameraButtonContainer, libraryButtonContainer, documentButtonContainer, gifButtonContainer)
|
val allButtonContainers = listOf( cameraButtonContainer, libraryButtonContainer, documentButtonContainer, gifButtonContainer)
|
||||||
val isReversed = isShowingAttachmentOptions // Run the animation in reverse
|
val isReversed = isShowingAttachmentOptions // Run the animation in reverse
|
||||||
val count = allButtons.size
|
val count = allButtonContainers.size
|
||||||
allButtons.indices.forEach { index ->
|
allButtonContainers.indices.forEach { index ->
|
||||||
val view = allButtons[index]
|
val view = allButtonContainers[index]
|
||||||
val animation = ValueAnimator.ofObject(FloatEvaluator(), view.alpha, targetAlpha)
|
val animation = ValueAnimator.ofObject(FloatEvaluator(), view.alpha, targetAlpha)
|
||||||
animation.duration = 250L
|
animation.duration = 250L
|
||||||
animation.startDelay = if (isReversed) 50L * (count - index.toLong()) else 50L * index.toLong()
|
animation.startDelay = if (isReversed) 50L * (count - index.toLong()) else 50L * index.toLong()
|
||||||
@ -514,6 +516,8 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
animation.start()
|
animation.start()
|
||||||
}
|
}
|
||||||
isShowingAttachmentOptions = !isShowingAttachmentOptions
|
isShowingAttachmentOptions = !isShowingAttachmentOptions
|
||||||
|
val allButtons = listOf( cameraButton, libraryButton, documentButton, gifButton )
|
||||||
|
allButtons.forEach { it.snIsEnabled = isShowingAttachmentOptions }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun showVoiceMessageUI() {
|
override fun showVoiceMessageUI() {
|
||||||
|
@ -32,7 +32,7 @@ class InputBarButton : RelativeLayout {
|
|||||||
@DrawableRes private var iconID = 0
|
@DrawableRes private var iconID = 0
|
||||||
private var longPressCallback: Runnable? = null
|
private var longPressCallback: Runnable? = null
|
||||||
private var onDownTimestamp = 0L
|
private var onDownTimestamp = 0L
|
||||||
|
var snIsEnabled = true
|
||||||
var onPress: (() -> Unit)? = null
|
var onPress: (() -> Unit)? = null
|
||||||
var onMove: ((MotionEvent) -> Unit)? = null
|
var onMove: ((MotionEvent) -> Unit)? = null
|
||||||
var onCancel: ((MotionEvent) -> Unit)? = null
|
var onCancel: ((MotionEvent) -> Unit)? = null
|
||||||
@ -130,6 +130,7 @@ class InputBarButton : RelativeLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||||
|
if (!snIsEnabled) { return false }
|
||||||
when (event.action) {
|
when (event.action) {
|
||||||
MotionEvent.ACTION_DOWN -> onDown(event)
|
MotionEvent.ACTION_DOWN -> onDown(event)
|
||||||
MotionEvent.ACTION_MOVE -> onMove(event)
|
MotionEvent.ACTION_MOVE -> onMove(event)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user