<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".PeersActivity">

    <FrameLayout
        android:id="@+id/settings"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:dividerPadding="4pt"
            android:orientation="vertical">

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

                <TextView
                    android:id="@+id/pageTitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="8pt"
                    android:text="Peers"
                    android:textColor="?attr/textDefault"
                    android:textSize="24sp"
                    android:textStyle="bold" />

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

                <ImageButton
                    android:id="@+id/addPeerButton"
                    android:layout_width="16pt"
                    android:layout_height="16pt"
                    android:layout_marginTop="6pt"
                    android:layout_marginRight="8pt"
                    android:background="@android:color/transparent"
                    app:srcCompat="@drawable/ic_baseline_add_circle_24" />
            </LinearLayout>

            <ScrollView
                android:layout_width="match_parent"
                android:layout_height="match_parent">

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

                    <TextView
                        android:id="@+id/connectedPeersLabel"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="16pt"
                        android:layout_marginLeft="16pt"
                        android:layout_marginTop="8pt"
                        android:layout_marginEnd="8pt"
                        android:layout_marginRight="8pt"
                        android:layout_marginBottom="2pt"
                        android:alpha="0.7"
                        android:text="Connected Peers"
                        android:textAllCaps="true"
                        android:textAppearance="@style/TextAppearance.AppCompat.Small"
                        android:textSize="12sp" />

                    <TableLayout
                        android:id="@+id/connectedPeersTableLayout"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="8pt"
                        android:layout_marginLeft="8pt"
                        android:layout_marginEnd="8pt"
                        android:layout_marginRight="8pt"
                        android:background="@drawable/rounded"
                        android:divider="#46878787"
                        android:dividerPadding="4pt"
                        android:paddingLeft="4pt"
                        android:paddingTop="2pt"
                        android:paddingRight="4pt"
                        android:paddingBottom="2pt"
                        android:showDividers="middle" />

                    <TextView
                        android:id="@+id/configuredPeersLabel"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="16pt"
                        android:layout_marginLeft="16pt"
                        android:layout_marginTop="8pt"
                        android:layout_marginEnd="8pt"
                        android:layout_marginRight="8pt"
                        android:layout_marginBottom="2pt"
                        android:alpha="0.7"
                        android:paddingRight="8pt"
                        android:text="Configured Peers"
                        android:textAllCaps="true"
                        android:textAppearance="@style/TextAppearance.AppCompat.Small"
                        android:textSize="12sp" />

                    <TableLayout
                        android:id="@+id/configuredPeersTableLayout"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="8pt"
                        android:layout_marginLeft="8pt"
                        android:layout_marginEnd="8pt"
                        android:layout_marginRight="8pt"
                        android:background="@drawable/rounded"
                        android:divider="#46878787"
                        android:dividerPadding="4pt"
                        android:paddingLeft="4pt"
                        android:paddingTop="2pt"
                        android:paddingRight="4pt"
                        android:paddingBottom="2pt"
                        android:showDividers="middle" />

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="16pt"
                        android:layout_marginLeft="16pt"
                        android:layout_marginTop="2pt"
                        android:layout_marginEnd="8pt"
                        android:layout_marginRight="8pt"
                        android:layout_marginBottom="4pt"
                        android:alpha="0.7"
                        android:paddingRight="8pt"
                        android:text="Yggdrasil will automatically attempt to connect to configured peers when started. If you configure more than one peer, your device may carry traffic on behalf of other network nodes. Avoid this by configuring only a single peer."
                        android:textAllCaps="false"
                        android:textAppearance="@style/TextAppearance.AppCompat.Small"
                        android:textSize="12sp" />

                    <Space
                        android:layout_width="match_parent"
                        android:layout_height="32px" />

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="16pt"
                        android:layout_marginLeft="16pt"
                        android:layout_marginEnd="8pt"
                        android:layout_marginRight="8pt"
                        android:layout_marginBottom="2pt"
                        android:alpha="0.7"
                        android:paddingRight="8pt"
                        android:text="Peer Connectivity"
                        android:textAllCaps="true"
                        android:textAppearance="@style/TextAppearance.AppCompat.Small"
                        android:textSize="12sp" />

                    <TableLayout
                        android:id="@+id/configurationTableLayout"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="8pt"
                        android:layout_marginLeft="8pt"
                        android:layout_marginEnd="8pt"
                        android:layout_marginRight="8pt"
                        android:background="@drawable/rounded"
                        android:clickable="true"
                        android:divider="#46878787"
                        android:dividerPadding="4pt"
                        android:paddingLeft="4pt"
                        android:paddingTop="2pt"
                        android:paddingRight="4pt"
                        android:paddingBottom="2pt"
                        android:showDividers="middle">

                        <TableRow
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:clickable="true"
                            android:paddingStart="4pt"
                            android:paddingTop="2pt"
                            android:paddingEnd="4pt"
                            android:paddingBottom="4pt">

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="Discoverable over multicast"
                                android:textColor="?attr/textDefault" />

                            <Space
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="2" />

                            <Switch
                                android:id="@+id/enableMulticastBeacon"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content" />

                        </TableRow>

                        <TableRow
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:clickable="true"
                            android:paddingStart="4pt"
                            android:paddingTop="4pt"
                            android:paddingEnd="4pt"
                            android:paddingBottom="2pt">

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="Search for multicast peers"
                                android:textColor="?attr/textDefault" />

                            <Space
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="2" />

                            <Switch
                                android:id="@+id/enableMulticastListen"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content" />

                        </TableRow>

                    </TableLayout>

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="16pt"
                        android:layout_marginLeft="16pt"
                        android:layout_marginTop="2pt"
                        android:layout_marginEnd="8pt"
                        android:layout_marginRight="8pt"
                        android:alpha="0.7"
                        android:paddingRight="8pt"
                        android:text="Multicast peers will be discovered on the same Wi-Fi network or via USB. Data charges may apply when using mobile data. You can prevent data usage in the device settings."
                        android:textAllCaps="false"
                        android:textAppearance="@style/TextAppearance.AppCompat.Small"
                        android:textSize="12sp" />
                </LinearLayout>
            </ScrollView>

        </LinearLayout>
    </FrameLayout>
</LinearLayout>
