<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <!--TODO: organize the input similarly to the output-->
    <!--TODO: add "other" element to input further information-->

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:minHeight="?attr/actionBarSize"
        android:background="@color/primary"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:paddingTop="@dimen/activity_vertical_margin"
            android:paddingBottom="@dimen/activity_vertical_margin"
            tools:context=".PowerEditor">

            <EditText
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/nameEdit"
                android:capitalize="sentences"
                android:layout_alignParentTop="true"
                android:layout_alignParentRight="true"
                android:layout_alignParentEnd="true"
                android:layout_toEndOf="@+id/keywordsText"
                android:layout_toRightOf="@+id/keywordsText"
                android:hint="@string/powerNameHint"/>

            <EditText
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:capitalize="sentences"
                android:id="@+id/keywordsEdit"
                android:layout_below="@+id/nameEdit"
                android:layout_alignRight="@+id/nameEdit"
                android:layout_alignEnd="@+id/nameEdit"
                android:layout_toRightOf="@+id/keywordsText"
                android:layout_toEndOf="@+id/keywordsText"
                android:hint="@string/keywordsPowerHint" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="@string/name"
                android:id="@+id/nameText"
                android:layout_alignParentTop="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_above="@+id/keywordsEdit"
                android:layout_toLeftOf="@+id/nameEdit"
                android:layout_toStartOf="@+id/nameEdit"
                android:gravity="center_vertical" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="@string/keywords"
                android:id="@+id/keywordsText"
                android:layout_below="@+id/nameEdit"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_alignBottom="@+id/keywordsEdit"
                android:gravity="center_vertical"
                android:layout_marginRight="10dp" />

            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/keywordsEdit"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:id="@+id/spinnersLayout">

                <Spinner
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/freqSpinner"
                    android:layout_weight="1"
                    android:spinnerMode="dropdown" />

                <Spinner
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/rangeSpinner"
                    android:layout_weight="1"
                    android:spinnerMode="dropdown" />
<!--TODO: this field can accept more than numbers, rearrange-->
                <EditText
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:inputType="textCapSentences"
                    android:ems="10"
                    android:id="@+id/distanceNumEdit"
                    android:layout_weight="0.75"
                    android:hint="@string/number10"
                    android:focusableInTouchMode="true" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/spinnersLayout"
                android:orientation="horizontal"
                android:gravity="center"
                android:id="@+id/vsLayout">
                <Spinner
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/atkSpinner"
                    android:spinnerMode="dropdown" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:text="@string/vs"
                    android:id="@+id/vsText" />

                <Spinner
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/defSpinner"
                    android:spinnerMode="dropdown" />

            </LinearLayout>

            <EditText
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:inputType="textMultiLine"
                android:ems="10"
                android:id="@+id/impactEdit"
                android:layout_below="@+id/vsLayout"
                android:layout_alignParentRight="true"
                android:layout_alignParentEnd="true"
                android:capitalize="sentences"
                android:hint="@string/impactEditHint"
                android:layout_toRightOf="@+id/attackText"
                android:layout_toEndOf="@+id/attackText" />


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="@string/impact"
                android:id="@+id/attackText"
                android:gravity="center_vertical"
                android:layout_below="@+id/vsLayout"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_alignBottom="@+id/impactEdit"
                android:layout_marginRight="10dp" />

            <Spinner
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/actionSpinner"
                android:layout_below="@+id/impactEdit"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:spinnerMode="dropdown" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="@string/objective"
                android:id="@+id/objectiveText"
                android:gravity="center_vertical"
                android:layout_below="@+id/actionSpinner"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_marginRight="10dp"
                android:layout_alignBottom="@+id/objectiveEdit" />

            <EditText
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/objectiveEdit"
                android:hint="@string/objectiveHint"
                android:layout_below="@+id/actionSpinner"
                android:layout_alignParentRight="true"
                android:capitalize="sentences"
                android:layout_alignParentEnd="true"
                android:layout_toRightOf="@+id/objectiveText"
                android:layout_toEndOf="@+id/objectiveText" />

            <Button
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/save"
                android:id="@+id/saveButton"
                android:layout_below="@+id/objectiveEdit"
                android:layout_alignRight="@+id/impactEdit"
                android:layout_alignEnd="@+id/impactEdit"
                android:background="@android:color/transparent"
                android:onClick="saveClick"
                android:textColor="@color/primary_dark"/>

        </RelativeLayout>
    </ScrollView>
</LinearLayout>