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

<layout 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">

    <data>
        <variable
            name="viewModel"
            type="com.example.flightgearcontrollerapp.view_model.FGViewModel" />
       <variable
            name="model"
            type="com.example.flightgearcontrollerapp.model.FGModel"/>
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@mipmap/background">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:context="com.setheightwidthpercentage_android_examples.com.MainActivity"
            android:weightSum="100"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="13"
                android:paddingTop="20dp"
                android:paddingBottom="10dp"
                android:text="@string/header_text"
                android:textColor="@color/white"
                android:textSize="40sp"
                android:textStyle="bold|italic"
                android:textAlignment="center"
                android:gravity="center" />

            <TextView
                android:id="@+id/text_ip"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="6"
                android:text="@string/ask_ip"
                android:textSize="20sp"
                android:textColor="@color/white"
                android:paddingStart="15dp"
                android:paddingEnd="15dp"
                android:paddingTop="5dp"
                android:paddingBottom="5dp" />

            <EditText
                android:id="@+id/ip_address"
                android:labelFor="@id/ip_address"
                android:layout_width="match_parent"
                android:layout_height="0sp"
                android:layout_weight="6"
                android:digits="0123456789."
                android:inputType="number|numberDecimal"
                android:textSize="20sp"
                android:textDirection="ltr"
                android:textColor="@color/white"
                android:theme="@android:style/Theme.Holo"
                android:paddingLeft="15dp"
                android:paddingRight="15dp"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:singleLine="true"
                android:nextFocusForward="@+id/port_address"
                android:importantForAutofill="no" />

            <TextView
                android:id="@+id/text_port"
                android:layout_width="match_parent"
                android:layout_height="0sp"
                android:layout_weight="6"
                android:text="@string/ask_port"
                android:textSize="20sp"
                android:textColor="@color/white"
                android:paddingLeft="15dp"
                android:paddingRight="15dp"
                android:paddingTop="5dp"
                android:paddingBottom="5dp" />

            <EditText
                android:id="@+id/port_address"
                android:labelFor="@id/port_address"
                android:layout_width="match_parent"
                android:layout_height="0sp"
                android:layout_weight="6"
                android:digits="0123456789"
                android:inputType="number"
                android:textSize="20sp"
                android:textDirection="ltr"
                android:theme="@android:style/Theme.Holo"
                android:paddingLeft="15dp"
                android:paddingRight="15dp"
                android:paddingTop="4dp"
                android:paddingBottom="4dp"

                android:importantForAutofill="no"
                android:singleLine="true" />

            <Button
                android:id="@+id/btn_connect"
                android:textSize="20sp"
                android:textAllCaps="false"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:paddingTop="12dp"
                android:paddingBottom="12dp"
                android:layout_gravity="center"
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_weight="9"
                android:onClick="onClickConnect"
                android:text="@string/btn_connect" />

            <LinearLayout
                android:layout_width="match_parent"
                android:orientation="horizontal"
                android:layout_height="0dp"
                android:layout_weight="43"
                tools:context="com.setheightwidthpercentage_android_examples.com.MainActivity"
                android:weightSum="100"
                android:background="@color/black_60"
                android:baselineAligned="false">


                <include
                    android:layout_height="match_parent"
                    android:layout_width="0dp"
                    android:layout_weight="75"
                    android:layout_gravity="center"
                    layout="@layout/joystick" />


                <LinearLayout
                    android:layout_height="match_parent"
                    android:layout_width="0dp"
                    android:layout_weight="25"
                    tools:context="com.setheightwidthpercentage_android_examples.com.MainActivity"
                    android:weightSum="100"
                    android:background="@color/white_40"
                    android:orientation="vertical">
                    <TextView
                        android:id="@+id/text_throttle"
                        android:layout_width="match_parent"
                        android:layout_height="0dp"
                        android:layout_weight="20"
                        android:gravity="center"
                        android:text="@string/txt_throttle"
                        android:textColor="@color/black_60"
                        android:autoSizeTextType="uniform"
                        android:autoSizeMaxTextSize="20sp"
                        android:textStyle="bold"/>
                    <RelativeLayout
                        android:layout_width="230dp"
                        android:layout_height="0dp"
                        android:layout_weight="80"
                        android:layout_marginStart="-65dp"
                        android:layout_marginBottom="10dp"
                        android:gravity="center">

                        <com.google.android.material.slider.Slider
                            android:id="@+id/slider_throttle"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:rotation="270"

                            android:value="0"
                            android:valueFrom="0"
                            android:valueTo="1" />
                    </RelativeLayout>
                </LinearLayout>

            </LinearLayout>

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_weight="11"
                android:background="@color/white_40"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/text_rudder"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:paddingLeft="15dp"
                    android:paddingRight="15dp"
                    android:text="@string/txt_rudder"
                    android:textColor="@color/black_60"
                    android:textSize="20sp"
                    android:textStyle="bold" />

                <com.google.android.material.slider.Slider
                    android:id="@+id/slider_rudder"
                    android:layout_width="match_parent"
                    android:layout_marginLeft="30dp"
                    android:layout_marginRight="30dp"
                    android:layout_height="fill_parent"
                    app:trackColorActive="@color/navy_blue_40"
                    app:trackColorInactive="@color/navy_blue_40"
                    android:value="0"
                    android:valueFrom="-1"
                    android:valueTo="1" />
            </LinearLayout>
        </LinearLayout>

    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>
