Add voice message lock view

This commit is contained in:
Niels Andriesse 2021-06-17 11:24:54 +10:00
parent 7cacee8499
commit 8f2ccf9e70
5 changed files with 60 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.conversation.v2.input_bar package org.thoughtcrime.securesms.conversation.v2.input_bar
import android.animation.FloatEvaluator import android.animation.FloatEvaluator
import android.animation.IntEvaluator
import android.animation.ValueAnimator import android.animation.ValueAnimator
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
@ -11,6 +12,7 @@ import kotlinx.android.synthetic.main.view_input_bar_recording.view.*
import network.loki.messenger.R import network.loki.messenger.R
import org.thoughtcrime.securesms.loki.utilities.animateSizeChange import org.thoughtcrime.securesms.loki.utilities.animateSizeChange
import org.thoughtcrime.securesms.loki.utilities.disableClipping import org.thoughtcrime.securesms.loki.utilities.disableClipping
import org.thoughtcrime.securesms.loki.utilities.toDp
import org.thoughtcrime.securesms.loki.utilities.toPx import org.thoughtcrime.securesms.loki.utilities.toPx
class InputBarRecordingView : RelativeLayout { class InputBarRecordingView : RelativeLayout {
@ -35,6 +37,7 @@ class InputBarRecordingView : RelativeLayout {
animation.start() animation.start()
animateDotView() animateDotView()
pulse() pulse()
animateLockViewUp()
} }
private fun animateDotView() { private fun animateDotView() {
@ -60,4 +63,19 @@ class InputBarRecordingView : RelativeLayout {
} }
animation.start() 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()
}
} }

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="18dp"/>
<solid android:color="@color/input_bar_lock_view_background" />
<stroke android:color="@color/input_bar_lock_view_border" android:width="1px" />
</shape>

View File

@ -3,7 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="92dp"> android:layout_height="132dp"
android:background="@color/blue">
<!-- The fake input bar --> <!-- The fake input bar -->
@ -132,4 +133,32 @@
</RelativeLayout> </RelativeLayout>
<LinearLayout
android:id="@+id/lockView"
android:layout_width="36dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="16dp"
android:layout_marginBottom="72dp"
android:paddingVertical="8dp"
android:background="@drawable/view_lock_background">
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:src="@drawable/ic_lock"
app:tint="@color/text" />
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginTop="4dp"
android:src="@drawable/ic_chevron_up"
app:tint="@color/text" />
</LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -22,6 +22,8 @@
<color name="message_selected">#FFFFFF</color> <color name="message_selected">#FFFFFF</color>
<color name="input_bar_background">#FCFCFC</color> <color name="input_bar_background">#FCFCFC</color>
<color name="input_bar_button_background">#0D000000</color> <color name="input_bar_button_background">#0D000000</color>
<color name="input_bar_lock_view_background">#FCFCFC</color>
<color name="input_bar_lock_view_border">#99FFFFFF</color>
<color name="default_background_start">#ffffff</color> <color name="default_background_start">#ffffff</color>
<color name="default_background_end">#fcfcfc</color> <color name="default_background_end">#fcfcfc</color>

View File

@ -29,6 +29,8 @@
<color name="message_selected">#000000</color> <color name="message_selected">#000000</color>
<color name="input_bar_background">#171717</color> <color name="input_bar_background">#171717</color>
<color name="input_bar_button_background">#0DFFFFFF</color> <color name="input_bar_button_background">#0DFFFFFF</color>
<color name="input_bar_lock_view_background">#171717</color>
<color name="input_bar_lock_view_border">#99000000</color>
<array name="profile_picture_placeholder_colors"> <array name="profile_picture_placeholder_colors">
<item>#5ff8b0</item> <item>#5ff8b0</item>