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

<!-- Copyright 2015 The Chromium Authors
     Use of this source code is governed by a BSD-style license that can be
     found in the LICENSE file.
-->

<!-- Overall layout and amount of padding is based on specs for
     "Two-line item (icon with text)" from:
     https://www.google.com/design/spec/components/lists.html#lists-specs

     In particular:
     - Left edge of the image is 16dp from the left edge of the screen
     - Right edge of the text is 16dp from the right edge of the screen
     - The height of the list item is 72dp
     - Vertical text padding: top = bottom = 20dp

     Intentional UI spec violation: We allow the status line to grow up to 2
     lines, and therefore we can end up with a total of 3 lines.  We want this
     because this behavior preserves all of error information, and seems
     harmless:
     - Still looks ok, despite not being strictly conforming to the UI spec.
     - Happens rarely (on small screens in vertical orientation - think Nexus 5
       rather than Nexus 7).

     TODO(lukasza): Temporary UI spec violation:  The left edge of the text is
     not exactly 72dp from the left edge of the screen.  Instead of 72dp we
     have 16dp (outer layout start padding) + 16dp (inner layout start padding)
     + *original* image width.  Overriding image width to be exactly 40dp would
     achieve 72dp text distance from screen edge, but scaling the image leads
     to bluriness.
  -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:minHeight="72dp"
        android:paddingStart="16dp"
        android:paddingEnd="16dp"
        android:paddingTop="20dp"
        android:paddingBottom="20dp"
        android:orientation="horizontal">

    <ImageView
            android:layout_gravity="start|center_vertical"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:padding="0dp"
            android:contentDescription="@string/host_icon_offline_description"
            android:src="@drawable/ic_host_offline"/>

    <LinearLayout
            android:layout_gravity="end|center_vertical"
            android:layout_height="wrap_content"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:orientation="vertical"
            android:paddingStart="16dp"
            android:paddingEnd="0dp"
            android:paddingTop="0dp"
            android:paddingBottom="0dp">

        <TextView
                android:gravity="start|center_vertical"
                android:id="@+id/host_label"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:paddingTop="0dp"
                android:textColor="?android:attr/textColorSecondary"
                style="?android:attr/textAppearanceMedium"/>

        <TextView
                android:ellipsize="end"
                android:gravity="start|center_vertical"
                android:id="@+id/host_status"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:paddingBottom="0dp"
                android:maxLines="2"
                android:textColor="?android:attr/textColorSecondary"
                style="?android:attr/textAppearanceSmall"/>

    </LinearLayout>

</LinearLayout>
