This commit is contained in:
Niels Andriesse 2021-06-17 14:01:43 +10:00
parent 7b68d63534
commit 4855f694e7
3 changed files with 37 additions and 2 deletions

View File

@ -248,7 +248,11 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
}
override fun onMicrophoneButtonUp(event: MotionEvent) {
resetVoiceMessageUI()
if (isValidLockViewLocation(event.rawX.roundToInt(), event.rawY.roundToInt())) {
inputBarRecordingView.lock()
} else {
resetVoiceMessageUI()
}
}
private fun resetVoiceMessageUI() {

View File

@ -7,12 +7,12 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.RelativeLayout
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.isVisible
import kotlinx.android.synthetic.main.view_input_bar_recording.view.*
import network.loki.messenger.R
import org.thoughtcrime.securesms.loki.utilities.animateSizeChange
import org.thoughtcrime.securesms.loki.utilities.disableClipping
import org.thoughtcrime.securesms.loki.utilities.toDp
import org.thoughtcrime.securesms.loki.utilities.toPx
class InputBarRecordingView : RelativeLayout {
@ -78,4 +78,21 @@ class InputBarRecordingView : RelativeLayout {
}
animation.start()
}
fun lock() {
val fadeOutAnimation = ValueAnimator.ofObject(FloatEvaluator(), 1.0f, 0.0f)
fadeOutAnimation.duration = 250L
fadeOutAnimation.addUpdateListener { animator ->
inputBarMiddleContentContainer.alpha = animator.animatedValue as Float
lockView.alpha = animator.animatedValue as Float
}
fadeOutAnimation.start()
val fadeInAnimation = ValueAnimator.ofObject(FloatEvaluator(), 0.0f, 1.0f)
fadeInAnimation.duration = 250L
fadeInAnimation.addUpdateListener { animator ->
inputBarCancelButton.alpha = animator.animatedValue as Float
}
fadeInAnimation.start()
recordButtonOverlayImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.ic_arrow_up, context.theme))
}
}

View File

@ -79,6 +79,19 @@
</LinearLayout>
<!-- The cancel button -->
<TextView
android:id="@+id/inputBarCancelButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:alpha="0"
android:text="@string/cancel"
android:textSize="@dimen/small_font_size"
android:textColor="@color/text"
android:textStyle="bold" />
<!-- Separator -->
<View
@ -123,6 +136,7 @@
android:backgroundTint="@color/destructive" >
<ImageView
android:id="@+id/recordButtonOverlayImageView"
android:layout_width="16dp"
android:layout_height="16dp"
app:tint="@color/white"