<!--
  ~ Copyright (c) 2015, Nordic Semiconductor
  ~ All rights reserved.
  ~
  ~ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
  ~
  ~ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  ~
  ~ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
  ~ documentation and/or other materials provided with the distribution.
  ~
  ~ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this
  ~ software without specific prior written permission.
  ~
  ~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  ~ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  ~ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  ~ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  ~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  ~ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	xmlns:tools="http://schemas.android.com/tools"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	android:orientation="vertical"
	tools:context=".csc.CSCActivity">

	<include
		android:id="@+id/toolbar_actionbar"
		layout="@layout/toolbar"/>

	<no.nordicsemi.android.nrftoolbox.widget.ForegroundRelativeLayout
		style="@style/HeaderShadow"
		android:layout_width="match_parent"
		android:layout_height="match_parent">

		<!-- The size of text below must be fixed, therefore dp are used instead of sp -->

		<no.nordicsemi.android.nrftoolbox.widget.TrebuchetBoldTextView
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:layout_centerVertical="true"
			android:layout_marginLeft="@dimen/csc_feature_title_long_margin"
			android:rotation="270"
			android:text="@string/csc_feature_title_long"
			android:textColor="@color/darkGray"
			android:textSize="32dp"
			android:textStyle="bold"/>

		<TextView
			android:id="@+id/battery"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:layout_alignParentLeft="true"
			android:layout_marginLeft="@dimen/feature_horizontal_margin"
			android:layout_marginTop="@dimen/feature_device_name_margin_top"
			android:background="@drawable/battery"
			android:freezesText="true"
			android:gravity="center"
			android:text="@string/not_available"
			android:textColor="#FFFFFF"
			android:textSize="12sp"/>

		<no.nordicsemi.android.nrftoolbox.widget.TrebuchetTextView
			android:id="@+id/device_name"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:layout_marginLeft="10dp"
			android:layout_marginTop="@dimen/feature_device_name_margin_top"
			android:layout_toRightOf="@+id/battery"
			android:ellipsize="end"
			android:freezesText="true"
			android:maxLines="1"
			android:text="@string/csc_default_name"
			android:textAllCaps="true"
			android:textAppearance="?android:attr/textAppearanceLarge"/>

		<LinearLayout
			android:layout_width="match_parent"
			android:layout_height="wrap_content"
			android:layout_marginLeft="@dimen/feature_horizontal_margin"
			android:layout_marginRight="@dimen/feature_horizontal_margin"
			android:baselineAligned="false"
			android:gravity="center_horizontal"
			android:orientation="horizontal">

			<!-- Application section -->

			<LinearLayout
				style="@style/Widget.List"
				android:layout_width="0dp"
				android:layout_height="wrap_content"
				android:layout_marginBottom="@dimen/activity_vertical_margin_bottom"
				android:layout_marginLeft="4dp"
				android:layout_marginTop="@dimen/feature_vertical_margin_top"
				android:layout_weight="1"
				android:orientation="vertical">

				<no.nordicsemi.android.nrftoolbox.widget.TrebuchetBoldTextView
					style="@style/Widget.ListTitle"
					android:layout_width="match_parent"
					android:layout_height="wrap_content"
					android:text="@string/csc_section_csc_header"/>

				<TableLayout
					android:layout_width="match_parent"
					android:layout_height="wrap_content"
					android:paddingLeft="@dimen/feature_section_padding"
					android:paddingRight="@dimen/feature_section_padding">

					<TableRow
						android:layout_width="match_parent"
						android:layout_height="wrap_content">

						<no.nordicsemi.android.nrftoolbox.widget.TrebuchetTextView
							android:layout_width="0dp"
							android:layout_height="match_parent"
							android:layout_weight="1"
							android:gravity="center_vertical"
							android:text="@string/csc_speed"/>

						<no.nordicsemi.android.nrftoolbox.widget.TrebuchetBoldTextView
							android:id="@+id/speed"
							android:layout_width="wrap_content"
							android:layout_height="wrap_content"
							android:freezesText="true"
							android:gravity="right"
							android:text="@string/not_available_value"
							android:textSize="36sp"/>

						<no.nordicsemi.android.nrftoolbox.widget.TrebuchetTextView
							android:id="@+id/speed_unit"
							android:layout_width="45dp"
							android:layout_height="match_parent"
							android:freezesText="true"
							android:gravity="bottom"
							android:text="@string/csc_speed_unit_km_h"/>
					</TableRow>

					<TableRow
						android:layout_width="match_parent"
						android:layout_height="wrap_content">

						<no.nordicsemi.android.nrftoolbox.widget.TrebuchetTextView
							android:layout_width="0dp"
							android:layout_height="match_parent"
							android:layout_weight="1"
							android:gravity="center_vertical"
							android:text="@string/csc_cadence"/>

						<no.nordicsemi.android.nrftoolbox.widget.TrebuchetBoldTextView
							android:id="@+id/cadence"
							android:layout_width="wrap_content"
							android:layout_height="wrap_content"
							android:freezesText="true"
							android:gravity="right"
							android:text="@string/not_available_value"
							android:textSize="36sp"/>

						<no.nordicsemi.android.nrftoolbox.widget.TrebuchetTextView
							android:layout_width="45dp"
							android:layout_height="match_parent"
							android:freezesText="true"
							android:gravity="bottom"
							android:text="@string/csc_cadence_unit"/>
					</TableRow>

					<TableRow
						android:layout_width="match_parent"
						android:layout_height="wrap_content">

						<no.nordicsemi.android.nrftoolbox.widget.TrebuchetTextView
							android:layout_width="0dp"
							android:layout_height="match_parent"
							android:layout_weight="1"
							android:gravity="center_vertical"
							android:text="@string/csc_distance"/>

						<no.nordicsemi.android.nrftoolbox.widget.TrebuchetBoldTextView
							android:id="@+id/distance"
							android:layout_width="wrap_content"
							android:layout_height="wrap_content"
							android:freezesText="true"
							android:gravity="right"
							android:text="@string/not_available_value"
							android:textSize="36sp"/>

						<no.nordicsemi.android.nrftoolbox.widget.TrebuchetTextView
							android:id="@+id/distance_unit"
							android:layout_width="45dp"
							android:layout_height="match_parent"
							android:freezesText="true"
							android:gravity="bottom"
							android:text="@string/csc_distance_unit_m"/>
					</TableRow>
				</TableLayout>
			</LinearLayout>

			<LinearLayout
				android:layout_width="0dp"
				android:layout_height="match_parent"
				android:layout_marginLeft="10dp"
				android:layout_weight="1"
				android:orientation="vertical">

				<LinearLayout
					style="@style/Widget.List"
					android:layout_width="match_parent"
					android:layout_height="match_parent"
					android:layout_marginBottom="@dimen/activity_vertical_margin_bottom"
					android:layout_marginLeft="4dp"
					android:layout_marginRight="4dp"
					android:layout_marginTop="@dimen/feature_vertical_margin_top"
					android:orientation="vertical">

					<no.nordicsemi.android.nrftoolbox.widget.TrebuchetBoldTextView
						style="@style/Widget.ListTitle"
						android:layout_width="match_parent"
						android:layout_height="wrap_content"/>

					<TableLayout
						android:layout_width="match_parent"
						android:layout_height="wrap_content"
						android:paddingLeft="@dimen/feature_section_padding"
						android:paddingRight="@dimen/feature_section_padding">

						<TableRow
							android:layout_width="match_parent"
							android:layout_height="wrap_content">

							<no.nordicsemi.android.nrftoolbox.widget.TrebuchetTextView
								android:layout_width="0dp"
								android:layout_height="match_parent"
								android:layout_weight="1"
								android:gravity="center_vertical"
								android:text="@string/csc_total_distance"/>

							<no.nordicsemi.android.nrftoolbox.widget.TrebuchetBoldTextView
								android:id="@+id/distance_total"
								android:layout_width="wrap_content"
								android:layout_height="wrap_content"
								android:freezesText="true"
								android:gravity="right"
								android:text="@string/not_available_value"
								android:textSize="36sp"/>

							<no.nordicsemi.android.nrftoolbox.widget.TrebuchetTextView
								android:id="@+id/distance_total_unit"
								android:layout_width="45dp"
								android:layout_height="match_parent"
								android:freezesText="true"
								android:gravity="bottom"
								android:text="@string/csc_total_distance_unit_km"/>
						</TableRow>

						<TableRow
							android:layout_width="match_parent"
							android:layout_height="wrap_content">

							<no.nordicsemi.android.nrftoolbox.widget.TrebuchetTextView
								android:layout_width="0dp"
								android:layout_height="match_parent"
								android:layout_weight="1"
								android:gravity="center_vertical"
								android:text="@string/csc_gear_ratio"/>

							<no.nordicsemi.android.nrftoolbox.widget.TrebuchetBoldTextView
								android:id="@+id/ratio"
								android:layout_width="wrap_content"
								android:layout_height="wrap_content"
								android:layout_marginRight="45dp"
								android:freezesText="true"
								android:gravity="right"
								android:text="@string/not_available_value"
								android:textSize="36sp"/>
						</TableRow>
					</TableLayout>
				</LinearLayout>
			</LinearLayout>
		</LinearLayout>

		<Button
			android:id="@+id/action_connect"
			style="@style/Widget.Connect"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:layout_alignParentBottom="true"
			android:layout_centerHorizontal="true"
			android:layout_marginBottom="@dimen/activity_vertical_margin_bottom"
			android:onClick="onConnectClicked"
			android:text="@string/action_connect"/>

		<ImageView
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:layout_alignParentBottom="true"
			android:layout_centerHorizontal="true"
			android:layout_marginBottom="6dp"
			android:src="@drawable/background_title"/>

	</no.nordicsemi.android.nrftoolbox.widget.ForegroundRelativeLayout>
</LinearLayout>