From 8f2ccf9e7083d4f1d16db6c13989380f88f59e0a Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Thu, 17 Jun 2021 11:24:54 +1000 Subject: [PATCH] Add voice message lock view --- .../v2/input_bar/InputBarRecordingView.kt | 18 +++++++++++ .../res/drawable/view_lock_background.xml | 8 +++++ .../res/layout/view_input_bar_recording.xml | 31 ++++++++++++++++++- .../main/res/values-notnight-v21/colors.xml | 2 ++ app/src/main/res/values/colors.xml | 2 ++ 5 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/view_lock_background.xml diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarRecordingView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarRecordingView.kt index 9c09c68771..4293740d47 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarRecordingView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarRecordingView.kt @@ -1,6 +1,7 @@ package org.thoughtcrime.securesms.conversation.v2.input_bar import android.animation.FloatEvaluator +import android.animation.IntEvaluator import android.animation.ValueAnimator import android.content.Context import android.util.AttributeSet @@ -11,6 +12,7 @@ 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 { @@ -35,6 +37,7 @@ class InputBarRecordingView : RelativeLayout { animation.start() animateDotView() pulse() + animateLockViewUp() } private fun animateDotView() { @@ -60,4 +63,19 @@ class InputBarRecordingView : RelativeLayout { } animation.start() } + + private fun animateLockViewUp() { + val startMarginBottom = toPx(32, resources) + val endMarginBottom = toPx(72, resources) + val layoutParams = lockView.layoutParams as LayoutParams + layoutParams.bottomMargin = startMarginBottom + lockView.layoutParams = layoutParams + val animation = ValueAnimator.ofObject(IntEvaluator(), startMarginBottom, endMarginBottom) + animation.duration = 250L + animation.addUpdateListener { animator -> + layoutParams.bottomMargin = animator.animatedValue as Int + lockView.layoutParams = layoutParams + } + animation.start() + } } diff --git a/app/src/main/res/drawable/view_lock_background.xml b/app/src/main/res/drawable/view_lock_background.xml new file mode 100644 index 0000000000..b7f6ef75e1 --- /dev/null +++ b/app/src/main/res/drawable/view_lock_background.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/view_input_bar_recording.xml b/app/src/main/res/layout/view_input_bar_recording.xml index fc87155a2a..36741377a5 100644 --- a/app/src/main/res/layout/view_input_bar_recording.xml +++ b/app/src/main/res/layout/view_input_bar_recording.xml @@ -3,7 +3,8 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" - android:layout_height="92dp"> + android:layout_height="132dp" + android:background="@color/blue"> @@ -132,4 +133,32 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-notnight-v21/colors.xml b/app/src/main/res/values-notnight-v21/colors.xml index 95021ff8b0..7cd8241332 100644 --- a/app/src/main/res/values-notnight-v21/colors.xml +++ b/app/src/main/res/values-notnight-v21/colors.xml @@ -22,6 +22,8 @@ #FFFFFF #FCFCFC #0D000000 + #FCFCFC + #99FFFFFF #ffffff #fcfcfc diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index e61ab9ccac..39228cd5b2 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -29,6 +29,8 @@ #000000 #171717 #0DFFFFFF + #171717 + #99000000 #5ff8b0