<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

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

        <TableLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:stretchColumns="*" >

            <TableRow android:gravity="center_vertical" >

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:ems="10"
                    android:text="@string/customize_touch_controls" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="right"
                    android:orientation="vertical" >

                    <Button
                        android:id="@+id/buttonLaunchEditor"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:ems="8"
                        android:text="@string/launch_editor" />
                </LinearLayout>
            </TableRow>

            <TableRow
                android:layout_marginTop="25dp"
                android:gravity="center_vertical" >

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.5"
                    android:ems="10"
                    android:gravity="center_vertical|left"
                    android:text="@string/touch_vibration" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="right"
                    android:orientation="vertical" >

                    <de.ankri.views.Switch
                        android:id="@+id/switchTouchVibrationEnabled"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:focusable="true" />
                </LinearLayout>
            </TableRow>

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_marginTop="10dp"
                android:orientation="vertical"
                android:visibility="gone"
                android:id="@+id/vibDuration_layout" >

                <TableRow
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent">

                    <TextView
                        android:id="@+id/vibDuration_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="@string/vibration_duration" />

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        android:gravity="right"
                        android:layout_weight="1">

                        <TextView
                            android:id="@+id/vibDuration_current"
                            android:layout_width="wrap_content"
                            android:layout_height="0dp"
                            android:layout_weight="1"
                            android:ems="5"
                            android:gravity="center_vertical|right"
                            android:textSize="20sp"
                            android:layout_marginRight="10dp" />

                    </LinearLayout>
                </TableRow>

                <SeekBar
                    android:id="@+id/vib_seekBar"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:ems="10"
                    android:max="60"
                    android:progress="0"
                    android:layout_weight="0.50"
                    android:layout_marginLeft="30dip"
                    android:layout_marginRight="30dip"
                    android:layout_marginTop="10dip" />

            </LinearLayout>

            <TableRow
                android:layout_marginTop="25dp"
                android:gravity="center_vertical" >

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:ems="10"
                    android:text="@string/customize_physical_controls" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="right"
                    android:orientation="vertical" >

                    <Button
                        android:id="@+id/buttonKeycodeEditor"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:ems="8"
                        android:text="@string/launch_editor" />
                </LinearLayout>
            </TableRow>
            
			<TableRow
                android:layout_marginTop="25dp"
                android:gravity="center_vertical" >

			    <LinearLayout 
			        android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:layout_marginLeft="6dp"
                    android:gravity="center_vertical" >
			        
			        <ImageView 
			            android:src="@drawable/mic_icon"
			            android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:layout_centerInParent="true"
                        android:scaleType="fitCenter" />
			        
	                <TextView
	                    android:layout_width="wrap_content"
	                    android:layout_height="wrap_content"
	                    android:layout_weight="0.5"
	                    android:ems="10"
	                    android:gravity="center_vertical|left"
	                    android:layout_marginLeft="6dp"
	                    android:text="@string/mic_in_port_2" />
				</LinearLayout>
				
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="right"
                    android:orientation="vertical" >

                    <de.ankri.views.Switch
                        android:id="@+id/micInPort2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:focusable="true" />
                </LinearLayout>
            </TableRow>
        </TableLayout>

        <TableLayout
            android:id="@+id/input_devices"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:stretchColumns="*" >

            <TableRow
                android:layout_marginTop="25dp"
                android:gravity="center_vertical" >

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center_vertical|left"
                    android:orientation="horizontal" >

                    <RelativeLayout
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:layout_marginLeft="6dp"
                        android:orientation="vertical" >

                        <ImageView
                            android:id="@+id/controller_icon_a"
                            android:layout_width="48dp"
                            android:layout_height="48dp"
                            android:layout_centerInParent="true"
                            android:scaleType="fitCenter"
                            android:src="@drawable/input" />

                        <TextView
                            android:id="@+id/controller_text_a"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerInParent="true"
                            android:text="A"
                            android:textAppearance="?android:attr/textAppearanceLarge"
                            android:textColor="#ff0000"
                            android:textIsSelectable="false"
                            android:textStyle="bold" />
                    </RelativeLayout>

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="6dp"
                        android:layout_weight="1"
                        android:orientation="vertical" >

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:ems="10"
                            android:text="@string/controller_a" />

                        <TextView
                            android:id="@+id/textViewDeviceDescriptorPlayer1"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:ems="10"
                            android:text="@string/controller_none_selected" />
                    </LinearLayout>
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="right"
                    android:orientation="vertical" >

                    <Button
                        android:id="@+id/buttonSelectControllerPlayer1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:ems="6"
                        android:text="@string/select" />

                    <Button
                        android:id="@+id/buttonRemoveControllerPlayer1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:ems="6"
                        android:text="@string/remove" />
                </LinearLayout>
            </TableRow>

            <TableRow
                android:layout_marginTop="25dp"
                android:gravity="center_vertical" >

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center_vertical|left"
                    android:orientation="horizontal" >

                    <RelativeLayout
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:layout_marginLeft="6dp"
                        android:orientation="vertical" >

                        <ImageView
                            android:id="@+id/controller_icon_b"
                            android:layout_width="48dp"
                            android:layout_height="48dp"
                            android:layout_centerInParent="true"
                            android:scaleType="fitCenter"
                            android:src="@drawable/input" />

                        <TextView
                            android:id="@+id/controller_text_b"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerInParent="true"
                            android:text="B"
                            android:textAppearance="?android:attr/textAppearanceLarge"
                            android:textColor="#0000ff"
                            android:textIsSelectable="false"
                            android:textStyle="bold" />
                    </RelativeLayout>

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="6dp"
                        android:layout_weight="1"
                        android:orientation="vertical" >

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:ems="10"
                            android:text="@string/controller_b" />

                        <TextView
                            android:id="@+id/textViewDeviceDescriptorPlayer2"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:ems="10"
                            android:text="@string/controller_none_selected" />
                    </LinearLayout>
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="right"
                    android:orientation="vertical" >

                    <Button
                        android:id="@+id/buttonSelectControllerPlayer2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:ems="6"
                        android:text="@string/select" />

                    <Button
                        android:id="@+id/buttonRemoveControllerPlayer2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:ems="6"
                        android:text="@string/remove" />
                </LinearLayout>
            </TableRow>

            <TableRow
                android:layout_marginTop="25dp"
                android:gravity="center_vertical" >

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center_vertical|left"
                    android:orientation="horizontal" >

                    <RelativeLayout
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:layout_marginLeft="6dp"
                        android:orientation="vertical" >

                        <ImageView
                            android:id="@+id/controller_icon_c"
                            android:layout_width="48dp"
                            android:layout_height="48dp"
                            android:layout_centerInParent="true"
                            android:scaleType="fitCenter"
                            android:src="@drawable/input" />

                        <TextView
                            android:id="@+id/controller_text_c"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerInParent="true"
                            android:text="C"
                            android:textAppearance="?android:attr/textAppearanceLarge"
                            android:textColor="#ffff00"
                            android:textIsSelectable="false"
                            android:textStyle="bold" />
                    </RelativeLayout>

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="6dp"
                        android:layout_weight="1"
                        android:orientation="vertical" >

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:ems="10"
                            android:text="@string/controller_c" />

                        <TextView
                            android:id="@+id/textViewDeviceDescriptorPlayer3"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:ems="10"
                            android:text="@string/controller_none_selected" />
                    </LinearLayout>
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="right"
                    android:orientation="vertical" >

                    <Button
                        android:id="@+id/buttonSelectControllerPlayer3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:ems="6"
                        android:text="@string/select" />

                    <Button
                        android:id="@+id/buttonRemoveControllerPlayer3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:ems="6"
                        android:text="@string/remove" />
                </LinearLayout>
            </TableRow>

            <TableRow
                android:layout_marginTop="25dp"
                android:gravity="center_vertical" >

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center_vertical|left"
                    android:orientation="horizontal" >

                    <RelativeLayout
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:layout_marginLeft="6dp"
                        android:orientation="vertical" >

                        <ImageView
                            android:id="@+id/controller_icon_d"
                            android:layout_width="48dp"
                            android:layout_height="48dp"
                            android:layout_centerInParent="true"
                            android:scaleType="fitCenter"
                            android:src="@drawable/input" />

                        <TextView
                            android:id="@+id/controller_text_d"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerInParent="true"
                            android:text="D"
                            android:textAppearance="?android:attr/textAppearanceLarge"
                            android:textColor="#00ff00"
                            android:textIsSelectable="false"
                            android:textStyle="bold" />
                    </RelativeLayout>

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="6dp"
                        android:layout_weight="1"
                        android:orientation="vertical" >

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:ems="10"
                            android:text="@string/controller_d" />

                        <TextView
                            android:id="@+id/textViewDeviceDescriptorPlayer4"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:ems="10"
                            android:text="@string/controller_none_selected" />
                    </LinearLayout>
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="right"
                    android:orientation="vertical" >

                    <Button
                        android:id="@+id/buttonSelectControllerPlayer4"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:ems="6"
                        android:text="@string/select" />

                    <Button
                        android:id="@+id/buttonRemoveControllerPlayer4"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:ems="6"
                        android:text="@string/remove" />
                </LinearLayout>
            </TableRow>
        </TableLayout>
    </LinearLayout>

</ScrollView>