<?xml version="1.0" encoding="utf-8"?>
<org.fdroid.fdroid.nearby.StartSwapView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:swap="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    swap:toolbarColor="@color/swap_bright_blue"
    swap:toolbarTitle="@string/swap_nearby"
    tools:context=".nearby.SwapWorkflowActivity">

    <androidx.cardview.widget.CardView
        android:id="@+id/wifi_banner"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="visible">

        <androidx.appcompat.widget.LinearLayoutCompat
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingLeft="24dp"
            android:paddingTop="24dp"
            android:paddingRight="24dp"
            android:paddingBottom="12dp">

            <ImageView
                android:id="@+id/wifi_banner_icon"
                android:layout_width="48dp"
                android:layout_height="48dp"
                android:src="@drawable/ic_wifi_off" />

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

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="24dp"
                    android:text="@string/swap_banner_message"
                    android:textSize="16sp" />

                <androidx.appcompat.widget.AppCompatButton
                    android:id="@+id/turn_on_wifi"
                    style="@style/Widget.MaterialComponents.Button.TextButton"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="right"
                    android:layout_marginTop="8dp"
                    android:text="@string/turn_on_wifi" />

            </LinearLayout>

        </androidx.appcompat.widget.LinearLayoutCompat>

    </androidx.cardview.widget.CardView>

    <!-- Misc header -->
    <include
        layout="@layout/start_swap_header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/wifi_banner" />

    <!-- Bluetooth swap status + toggle -->
    <LinearLayout
        android:id="@+id/bluetooth_info"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/header"
        android:orientation="horizontal"
        android:padding="10dp">

        <ImageView
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:contentDescription="@string/use_bluetooth"
            swap:srcCompat="@drawable/ic_bluetooth_searching" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1.00"
            android:orientation="vertical"
            android:paddingStart="15dp"
            android:paddingLeft="15dp"
            tools:ignore="RtlSymmetry">

            <TextView
                android:id="@+id/bluetooth_visible"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="18sp"
                tools:text="@string/swap_not_visible_bluetooth" />

            <TextView
                android:id="@+id/device_id_bluetooth"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/swap_light_text"
                tools:text="SP-120" />

        </LinearLayout>

        <com.google.android.material.switchmaterial.SwitchMaterial
            android:id="@+id/switch_bluetooth"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:enabled="false" />

    </LinearLayout>

    <!-- WiFi swap status + toggle -->
    <LinearLayout
        android:id="@+id/wifi_info"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/bluetooth_info"
        android:orientation="horizontal"
        android:padding="10dp">

        <ImageView
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:contentDescription="@string/wifi"
            swap:srcCompat="@drawable/ic_wifi" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1.00"
            android:orientation="vertical"
            android:paddingStart="15dp"
            android:paddingLeft="15dp"
            tools:ignore="RtlSymmetry">

            <TextView
                android:id="@+id/wifi_visible"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="18sp"
                tools:text="@string/swap_starting" />

            <TextView
                android:id="@+id/device_id_wifi"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/swap_wifi_device_name"
                android:textColor="@color/swap_light_text" />

            <TextView
                android:id="@+id/wifi_network"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:minWidth="150dp"
                android:textColor="@color/swap_bright_blue"
                android:textSize="16sp"
                tools:text="wifi network name" />

        </LinearLayout>

        <com.google.android.material.switchmaterial.SwitchMaterial
            android:id="@+id/switch_wifi"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </LinearLayout>

    <!-- Feedback for "searching for nearby people..." -->
    <LinearLayout
        android:id="@+id/feedback_searching"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/wifi_info"
        android:paddingStart="20dp"
        android:paddingTop="20dp"
        android:paddingEnd="20dp"
        android:paddingBottom="5dp">

        <TextView
            android:id="@+id/text_people_nearby"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1.00"
            android:text="@string/swap_people_nearby"
            android:textColor="@color/swap_light_text" />

        <com.google.android.material.progressindicator.CircularProgressIndicator
                android:id="@+id/searching_people_nearby"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:indeterminate="true"
                app:showAnimationBehavior="inward"
                app:hideAnimationBehavior="outward"
                app:indicatorSize="24dp"
                app:trackCornerRadius="@dimen/mtrl_progress_indicator_full_rounded_corner_radius"/>

    </LinearLayout>


    <!-- Buttons to help the user when they can't find any peers. Shown at bottom of relative layout -->
    <LinearLayout
        android:id="@+id/cant_find_peers"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="horizontal">

        <com.google.android.material.button.MaterialButton
            android:id="@+id/btn_send_fdroid"
            style="@style/Widget.App.Button.TextButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/swap_send_fdroid"
            swap:icon="@drawable/ic_fdroid_grey" />

        <com.google.android.material.button.MaterialButton
            android:id="@+id/btn_scan_qr"
            style="@style/Widget.App.Button.TextButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/swap_scan_qr"
            swap:icon="@drawable/ic_qr_code" />

        <Space
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1" />

        <com.google.android.material.button.MaterialButton
            android:id="@+id/btn_apps"
            style="@style/Widget.App.Button.TextButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:text="@string/apps"
            swap:icon="@drawable/ic_apps" />

    </LinearLayout>

    <!-- Heading for "can't find peers" -->
    <TextView
        android:id="@+id/header_cant_find_peers"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@id/cant_find_peers"
        android:paddingStart="20dp"
        android:paddingLeft="20dp"
        android:paddingTop="20dp"
        android:paddingEnd="20dp"
        android:paddingRight="20dp"
        android:text="@string/swap_cant_find_peers"
        android:textColor="@color/swap_light_text" />

    <!-- List of all currently known peers (i.e. bluetooth and wifi devices that have been identified -->
    <ListView
        android:id="@+id/list_people_nearby"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/header_cant_find_peers"
        android:layout_below="@id/feedback_searching">

    </ListView>

</org.fdroid.fdroid.nearby.StartSwapView>
