<?xml version="1.0" encoding="utf-8"?>

<androidx.coordinatorlayout.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/parent_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/transparent_activity_overlay">

    <LinearLayout
        android:id="@+id/bottom_sheet"
        style="?attr/bottomSheetStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?android:attr/colorBackground"
        android:orientation="vertical"
        android:clipToPadding="false"
        android:outlineProvider="bounds"
        app:behavior_hideable="false"
        app:behavior_saveFlags="all"
        android:elevation="2dp"
        app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

        <SeekBar
            android:id="@+id/seekbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:paddingTop="8dp"
            android:paddingBottom="4dp"
            android:thumbTint="?attr/colorPrimary"
            android:visibility="gone" />

        <RelativeLayout
            android:id="@+id/bottom_panel"
            android:layout_width="match_parent"
            android:layout_height="@dimen/compose_bottom_panel_height"
            android:orientation="horizontal">

            <LinearLayout
                android:id="@+id/button_layout"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_alignParentLeft="true"
                android:divider="?android:attr/dividerVertical"
                android:dividerPadding="12dp"
                android:orientation="horizontal"
                android:showDividers="middle"
                android:animateLayoutChanges="true">

                <ImageView
                    style="?android:attr/borderlessButtonStyle"
                    android:id="@+id/discard_button"
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:layout_marginLeft="8dp"
                    android:layout_gravity="center_vertical"
                    android:background="@drawable/selector_compose_button"
                    android:clickable="true"
                    android:contentDescription="@string/discard"
                    android:focusable="true"
                    android:nextFocusRight="@+id/play_button"
                    android:scaleType="centerInside"
                    app:srcCompat="@drawable/ic_delete_outline"
                    app:tint="?attr/colorOnSurface" />

                <ImageView
                    style="?android:attr/borderlessButtonStyle"
                    android:id="@+id/play_button"
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:layout_gravity="center_vertical"
                    android:background="@drawable/selector_compose_button"
                    android:clickable="true"
                    android:contentDescription="@string/play"
                    android:focusable="true"
                    android:nextFocusRight="@+id/pause_button"
                    android:scaleType="centerInside"
                    app:srcCompat="@drawable/ic_stop"
                    app:tint="?attr/colorOnSurface" />

                <ImageView
                    style="?android:attr/borderlessButtonStyle"
                    android:id="@+id/pause_button"
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:layout_gravity="center_vertical"
                    android:background="@drawable/selector_compose_button"
                    android:clickable="true"
                    android:contentDescription="@string/pause"
                    android:focusable="true"
                    android:nextFocusRight="@+id/send_button"
                    android:scaleType="centerInside"
                    app:srcCompat="@drawable/ic_pause"
                    app:tint="?attr/colorOnSurface" />

            </LinearLayout>

            <FrameLayout
                android:id="@+id/timer_container"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_marginLeft="4dp"
                android:layout_toRightOf="@id/button_layout">

                <com.google.android.material.card.MaterialCardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    app:cardBackgroundColor="@color/voice_recorder_counter_background"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="0dp"
                    app:cardMaxElevation="0dp"
                    app:cardUseCompatPadding="true"
                    app:contentPaddingBottom="4dp"
                    app:contentPaddingLeft="2dp"
                    app:contentPaddingRight="2dp"
                    app:contentPaddingTop="2dp"
                    app:strokeWidth="0dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal">

                        <TextView
                            android:id="@+id/timer_text"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_marginLeft="8dp"
                            android:text="00:00"
                            android:textColor="?attr/colorOnBackground"
                            android:textSize="22sp" />

                        <ImageView
                            android:id="@+id/record_image"
                            style="@android:style/Widget.Holo.Light.Button.Borderless.Small"
                            android:layout_width="20dp"
                            android:layout_height="20dp"
                            android:layout_gravity="center_vertical"
                            android:clickable="false"
                            android:contentDescription="@string/recording"
                            android:drawablePadding="0dip"
                            android:focusable="false"
                            android:scaleType="centerInside"
                            app:srcCompat="@drawable/ic_record" />

                    </LinearLayout>

                </com.google.android.material.card.MaterialCardView>

            </FrameLayout>

            <ImageView
                style="?android:attr/borderlessButtonStyle"
                android:id="@+id/bluetooth_toggle"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_centerVertical="true"
                android:layout_toRightOf="@id/timer_container"
                android:background="@drawable/selector_compose_button"
                android:clickable="true"
                android:contentDescription="Bluetooth"
                android:focusable="true"
                android:scaleType="centerInside"
                android:visibility="invisible"
                app:srcCompat="@drawable/ic_bluetooth_searching_24dp"
                app:tint="?attr/colorOnSurface" />

            <com.google.android.material.button.MaterialButton
                style="@style/Threema.MaterialButton.Icon.Circle.Filled.Small"
                android:id="@+id/send_button"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_marginRight="8dp"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:clickable="true"
                android:contentDescription="@string/send"
                android:focusable="true"
                android:scaleType="centerInside"
                app:icon="@drawable/ic_send_grey600_24dp" />

        </RelativeLayout>

    </LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
