Basic voice message

This commit is contained in:
Niels Andriesse 2021-06-21 11:09:30 +10:00
parent ce5f923b25
commit ac718a425d
5 changed files with 48 additions and 23 deletions

View File

@ -103,7 +103,7 @@ class VisibleMessageContentView : LinearLayout {
val hPadding = toPx(12, resources)
result.setPadding(hPadding, vPadding, hPadding, vPadding)
result.text = message.body
result.setTextSize(TypedValue.COMPLEX_UNIT_PX, resources.getDimension(R.dimen.medium_font_size))
result.setTextSize(TypedValue.COMPLEX_UNIT_PX, resources.getDimension(R.dimen.small_font_size))
val uiMode = UiModeUtilities.getUserSelectedUiMode(context)
val colorID = if (message.isOutgoing) {
if (uiMode == UiMode.NIGHT) R.color.black else R.color.white

View File

@ -11,26 +11,18 @@ import org.thoughtcrime.securesms.database.model.MessageRecord
class VoiceMessageView : LinearLayout {
// region Lifecycle
constructor(context: Context) : super(context) {
setUpViewHierarchy()
}
constructor(context: Context) : super(context) { initialize() }
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { initialize() }
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { initialize() }
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
setUpViewHierarchy()
}
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
setUpViewHierarchy()
}
private fun setUpViewHierarchy() {
private fun initialize() {
LayoutInflater.from(context).inflate(R.layout.view_voice_message, this)
}
// endregion
// region Updating
fun bind(message: MessageRecord) {
textView.text = "I'm a voice message"
}
fun recycle() {

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/white" />
</shape>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="10dp"/>
<solid android:color="@color/white" />
</shape>

View File

@ -1,16 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="160dp"
android:layout_height="36dp"
android:orientation="horizontal"
android:padding="@dimen/small_spacing"
android:gravity="center">
<RelativeLayout
android:layout_width="20dp"
android:layout_height="20dp"
android:background="@drawable/circle_tintable"
android:backgroundTint="@color/white">
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:src="@drawable/exo_icon_play"
android:layout_centerInParent="true"
app:tint="@color/black" />
</RelativeLayout>
<View
android:layout_width="84dp"
android:layout_height="1dp"
android:background="@color/white" />
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/medium_font_size"
android:textColor="@color/text" />
android:layout_width="40dp"
android:layout_height="20dp"
android:text="0:08"
android:gravity="center"
android:textColor="@color/black"
android:textSize="@dimen/small_font_size"
android:background="@drawable/view_voice_message_duration_text_view_background"
android:backgroundTint="@color/white" />
</LinearLayout>