<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@id/container"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

  <androidx.appcompat.widget.Toolbar
      android:id="@+id/toolbar"
      android:layout_alignParentTop="true"
      android:layout_width="match_parent"
      android:layout_height="?attr/actionBarSize"
      android:minHeight="?attr/actionBarSize"
      android:background="?attr/colorPrimary"
      app:contentInsetStart="0dp"
      app:contentInsetLeft="0dp"
      android:elevation="4dp"
      android:theme="?attr/actionBarStyle">

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

      <LinearLayout
          android:id="@+id/avatar_and_title"
          android:orientation="horizontal"
          android:layout_width="0dp"
          android:layout_weight="1"
          android:paddingStart="14dp"
          android:layout_height="match_parent"
          android:layout_marginEnd="10dp">

        <RelativeLayout
            android:id="@+id/self_avatar_container"
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="45dp">
          <org.thoughtcrime.securesms.components.AvatarView
              android:id="@+id/self_avatar"
              android:layout_width="35dp"
              android:layout_height="35dp"
              android:layout_marginRight="10dp"
              android:layout_marginEnd="10dp"
              android:layout_marginTop="5dp"
              android:layout_marginBottom="5dp"
              android:clickable="true"
              app:inverted="true"
              android:contentDescription="@string/pref_profile_info_headline" />
          <ImageView
              android:id="@+id/unread_indicator"
              android:layout_width="20dp"
              android:layout_height="20dp"
              android:layout_marginLeft="20dp"
              android:layout_marginStart="20dp"
              app:layout_constraintTop_toTopOf="parent"
              android:layout_marginBottom="16dp"
              android:contentDescription="@null"
              android:visibility="gone"
              />
        </RelativeLayout>

        <androidx.appcompat.widget.AppCompatTextView
            style="@style/TextSecure.TitleTextStyle"
            android:id="@+id/toolbar_title"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="@string/app_name"
            android:layout_weight="1"
            android:layout_gravity="center_vertical"
            android:paddingRight="10dp"
            android:ellipsize="end"
            android:maxLines="1"/>
      </LinearLayout>

      <ImageView
          android:id="@+id/search_action"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:src="@drawable/ic_search_white_24dp"
          android:paddingRight="12dp"
          android:paddingEnd="12dp"
          android:paddingLeft="12dp"
          android:paddingStart="12dp"
          android:layout_marginTop="4dp"
          android:layout_marginBottom="4dp"
          android:layout_gravity="center_vertical"
          android:contentDescription="@string/search"/>

    </LinearLayout>

  </androidx.appcompat.widget.Toolbar>

  <FrameLayout
      android:id="@+id/fragment_container"
      android:layout_below="@id/toolbar"
      android:layout_width="match_parent"
      android:layout_height="match_parent"/>

  <org.thoughtcrime.securesms.components.SearchToolbar
      android:id="@+id/search_toolbar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentTop="true"
      android:elevation="4dp"
      android:visibility="invisible"
      tools:visibility="visible"/>

</RelativeLayout>
