MainScheduleFragment is now responsive

This commit is contained in:
Peter Siegmund
2015-08-26 17:42:34 +02:00
parent deabff6054
commit 22a1c4b3c6
19 changed files with 380 additions and 640 deletions
@@ -1,180 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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:background="?sap_gray">
<RelativeLayout
android:id="@+id/event_header"
android:layout_width="match_parent"
android:layout_height="@dimen/selector_header_height">
<TextView
android:id="@+id/label_event"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/default_padding"
android:paddingRight="@dimen/default_padding"
android:text="@string/label_login_events"
android:textAppearance="?textNormal"/>
<ImageView
android:id="@+id/icon_event"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/default_padding"
android:paddingRight="@dimen/default_padding"
android:src="?arrow_drop_down_24dp"/>
<TextView
android:id="@+id/selected_event"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/icon_event"
android:layout_toRightOf="@+id/label_event"
android:gravity="right"
android:textColor="?white"
android:textSize="@dimen/textSize_22"
tools:text="Test-Event"/>
</RelativeLayout>
<View
android:id="@+id/event_line"
android:layout_width="match_parent"
android:layout_height="@dimen/thick_line"
android:layout_below="@id/event_header"
android:background="?black"/>
<FrameLayout
android:id="@+id/event_fragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_alignParentEnd="true"
android:layout_below="@id/event_line"
android:background="?sap_gray_black_30"/>
<RelativeLayout
android:id="@+id/area_header"
android:layout_width="match_parent"
android:layout_height="@dimen/selector_header_height"
android:layout_below="@id/event_fragment">
<TextView
android:id="@+id/label_area"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/default_padding"
android:paddingRight="@dimen/default_padding"
android:text="@string/label_login_course_area"
android:textAppearance="?textNormal"/>
<ImageView
android:id="@+id/icon_area"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/default_padding"
android:paddingRight="@dimen/default_padding"
android:src="?arrow_drop_down_24dp"/>
<TextView
android:id="@+id/selected_area"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/icon_area"
android:layout_toRightOf="@id/label_area"
android:gravity="right"
android:textColor="?white"
android:textSize="@dimen/textSize_22"
tools:text="Selected Area"/>
</RelativeLayout>
<View
android:id="@+id/area_line"
android:layout_width="match_parent"
android:layout_height="@dimen/thick_line"
android:layout_below="@id/area_header"
android:background="?black"/>
<FrameLayout
android:id="@+id/area_fragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="@id/area_line"
android:background="?sap_gray_black_30"/>
<RelativeLayout
android:id="@+id/position_header"
android:layout_width="match_parent"
android:layout_height="@dimen/selector_header_height"
android:layout_below="@id/area_fragment">
<TextView
android:id="@+id/label_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/default_padding"
android:paddingRight="@dimen/default_padding"
android:text="@string/label_login_position"
android:textAppearance="?textNormal"/>
<ImageView
android:id="@+id/icon_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/default_padding"
android:paddingRight="@dimen/default_padding"
android:src="?arrow_drop_down_24dp"/>
<TextView
android:id="@+id/selected_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/icon_position"
android:layout_toRightOf="@id/label_position"
android:gravity="right"
android:textColor="?white"
android:textSize="@dimen/textSize_22"
tools:text="Viewer"/>
</RelativeLayout>
<View
android:id="@+id/position_line"
android:layout_width="match_parent"
android:layout_height="@dimen/thick_line"
android:layout_below="@id/position_header"
android:background="?black"/>
<FrameLayout
android:id="@+id/position_fragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="@id/position_line"
android:background="?sap_gray_black_30"/>
<Button
android:id="@+id/login_submit"
style="?attr/buttonSolidNormal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="@dimen/default_margin_twice"
android:layout_marginRight="@dimen/default_margin_twice"
android:enabled="false"
android:text="@string/sign_up"
android:textSize="@dimen/textSize_26"/>
</RelativeLayout>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Button
android:id="@+id/login_submit"
style="?attr/buttonSolidNormal"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="@dimen/default_margin_twice"
android:layout_marginRight="@dimen/default_margin_twice"
android:enabled="false"
android:text="@string/sign_up"
android:textSize="@dimen/textSize_26"/>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Button
style="?attr/buttonSolidSmall"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_margin="@dimen/unscheduled_confirm_button_margin"
android:text="@string/race_setup_confirm"/>
@@ -22,11 +22,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/default_padding_half"
android:paddingRight="@dimen/default_padding_half"
android:padding="@dimen/side_padding"
android:text="@string/label_login_events"
android:textColor="?white"
android:textSize="@dimen/textSize_20"/>
android:textSize="@dimen/login_text_size"/>
<ImageView
android:id="@+id/icon_event"
@@ -34,8 +33,7 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/default_padding_half"
android:paddingRight="@dimen/default_padding_half"
android:padding="@dimen/side_padding"
android:src="?arrow_drop_down_24dp"/>
<TextView
@@ -48,7 +46,7 @@
android:gravity="right"
android:singleLine="true"
android:textColor="?white"
android:textSize="@dimen/textSize_18"
android:textSize="@dimen/login_text_size_small"
tools:text="Test-Event"/>
</RelativeLayout>
@@ -82,11 +80,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/default_padding_half"
android:paddingRight="@dimen/default_padding_half"
android:padding="@dimen/side_padding"
android:text="@string/label_login_course_area"
android:textColor="?white"
android:textSize="@dimen/textSize_20"/>
android:textSize="@dimen/login_text_size"/>
<ImageView
android:id="@+id/icon_area"
@@ -94,8 +91,7 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/default_padding_half"
android:paddingRight="@dimen/default_padding_half"
android:padding="@dimen/side_padding"
android:src="?arrow_drop_down_24dp"/>
<TextView
@@ -108,7 +104,7 @@
android:gravity="right"
android:singleLine="true"
android:textColor="?white"
android:textSize="@dimen/textSize_18"
android:textSize="@dimen/login_text_size_small"
tools:text="Selected Area"/>
</RelativeLayout>
@@ -142,11 +138,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/default_padding_half"
android:paddingRight="@dimen/default_padding_half"
android:padding="@dimen/side_padding"
android:text="@string/label_login_position"
android:textColor="?white"
android:textSize="@dimen/textSize_20"/>
android:textSize="@dimen/login_text_size"/>
<ImageView
android:id="@+id/icon_position"
@@ -154,8 +149,7 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/default_padding_half"
android:paddingRight="@dimen/default_padding_half"
android:padding="@dimen/side_padding"
android:src="?arrow_drop_down_24dp"/>
<TextView
@@ -168,7 +162,7 @@
android:gravity="right"
android:singleLine="true"
android:textColor="?white"
android:textSize="@dimen/textSize_18"
android:textSize="@dimen/login_text_size_small"
tools:text="Viewer"/>
</RelativeLayout>
@@ -185,16 +179,5 @@
android:background="?sap_gray_black_30"/>
</LinearLayout>
<Button
android:id="@+id/login_submit"
style="?attr/button"
android:layout_width="@dimen/default_button_width"
android:layout_height="@dimen/default_button_height"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/default_margin"
android:enabled="false"
android:text="@string/sign_up"
android:textSize="@dimen/textSize_18"
android:textStyle="normal"/>
<include layout="@layout/login_listviews_button"/>
</RelativeLayout>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Button
android:id="@+id/login_submit"
style="?attr/button"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/default_button_width"
android:layout_height="@dimen/default_button_height"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/default_margin"
android:enabled="false"
android:text="@string/sign_up"
android:textSize="@dimen/textSize_18"
android:textStyle="normal"/>
@@ -1,306 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/start_time"
android:layout_width="match_parent"
android:layout_height="@dimen/selector_header_height">
<TextView
android:id="@+id/start_time_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/default_margin"
android:layout_marginStart="@dimen/default_margin"
android:text="@string/start_time"
android:textAppearance="?textNormal" />
<ImageView
android:id="@+id/start_time_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/default_margin"
android:layout_marginRight="@dimen/default_margin"
android:src="@drawable/ic_chevron_right_grey600_24dp" />
<TextView
android:id="@+id/start_time_value"
android:layout_width="@dimen/setup_text_width"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/default_margin"
android:layout_marginRight="@dimen/default_margin"
android:layout_toEndOf="@id/start_time_caption"
android:layout_toLeftOf="@id/start_time_icon"
android:layout_toRightOf="@id/start_time_caption"
android:layout_toStartOf="@id/start_time_icon"
android:gravity="end"
android:textAppearance="?textSmall"
tools:text="@string/start_time_value" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/thin_line"
android:layout_alignParentBottom="true"
android:background="?black" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/start_procedure"
android:layout_width="match_parent"
android:layout_height="@dimen/selector_header_height"
android:layout_below="@id/start_time">
<TextView
android:id="@+id/start_procedure_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/default_margin"
android:layout_marginStart="@dimen/default_margin"
android:text="@string/start_procedure"
android:textAppearance="?textNormal" />
<ImageView
android:id="@+id/start_procedure_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/default_margin"
android:layout_marginRight="@dimen/default_margin"
android:src="@drawable/ic_chevron_right_grey600_24dp" />
<TextView
android:id="@+id/start_procedure_value"
android:layout_width="@dimen/setup_text_width"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/default_margin"
android:layout_marginRight="@dimen/default_margin"
android:layout_toEndOf="@id/start_procedure_caption"
android:layout_toLeftOf="@id/start_procedure_icon"
android:layout_toRightOf="@id/start_procedure_caption"
android:layout_toStartOf="@id/start_procedure_icon"
android:gravity="end"
android:textAppearance="?textSmall"
tools:text="Fix Line Start (RRS26)" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/thin_line"
android:layout_alignParentBottom="true"
android:background="?black" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/start_mode"
android:layout_width="match_parent"
android:layout_height="@dimen/selector_header_height"
android:layout_below="@id/start_procedure">
<TextView
android:id="@+id/start_mode_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/default_margin"
android:layout_marginStart="@dimen/default_margin"
android:layout_toLeftOf="@+id/start_mode_flag"
android:layout_toStartOf="@+id/start_mode_flag"
android:text="@string/start_mode"
android:textAppearance="?textNormal" />
<ImageView
android:id="@+id/start_mode_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/default_margin"
android:layout_marginRight="@dimen/default_margin"
android:src="@drawable/ic_chevron_right_grey600_24dp" />
<ImageView
android:id="@+id/start_mode_flag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_margin="@dimen/default_margin_half"
android:layout_toLeftOf="@+id/start_mode_value"
android:layout_toStartOf="@+id/start_mode_value"
android:focusableInTouchMode="false"
tools:src="@drawable/flag_papa_48dp" />
<TextView
android:id="@+id/start_mode_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/start_mode_icon"
android:layout_marginEnd="@dimen/default_margin"
android:layout_marginRight="@dimen/default_margin"
android:layout_toLeftOf="@+id/start_mode_icon"
android:layout_toStartOf="@+id/start_mode_icon"
android:gravity="end"
android:singleLine="true"
android:textAppearance="?textSmall"
tools:text="Papa" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/thin_line"
android:layout_alignParentBottom="true"
android:background="?black" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/start_course"
android:layout_width="match_parent"
android:layout_height="@dimen/selector_header_height"
android:layout_below="@id/start_mode">
<TextView
android:id="@+id/start_course_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/default_margin"
android:layout_marginStart="@dimen/default_margin"
android:layout_toLeftOf="@+id/start_course_symbol"
android:layout_toStartOf="@+id/start_course_symbol"
android:text="@string/course"
android:textAppearance="?textNormal" />
<ImageView
android:id="@+id/start_course_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/default_margin"
android:layout_marginRight="@dimen/default_margin"
android:src="@drawable/ic_chevron_right_grey600_24dp" />
<ImageView
android:id="@+id/start_course_symbol"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerVertical="true"
android:layout_margin="@dimen/default_margin_half"
android:layout_toLeftOf="@+id/start_course_value"
android:layout_toStartOf="@+id/start_course_value"
tools:src="@drawable/course_triangle_48dp_dark"
android:visibility="gone"/>
<TextView
android:id="@+id/start_course_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginEnd="@dimen/default_margin"
android:layout_marginRight="@dimen/default_margin"
android:layout_toLeftOf="@+id/start_course_icon"
android:layout_toStartOf="@+id/start_course_icon"
android:gravity="end"
android:singleLine="true"
android:textAppearance="?textSmall"
tools:text="O3" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/thin_line"
android:layout_alignParentBottom="true"
android:background="?black" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/wind"
android:layout_width="match_parent"
android:layout_height="@dimen/selector_header_height"
android:layout_below="@id/start_course">
<TextView
android:id="@+id/wind_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/default_margin"
android:layout_marginStart="@dimen/default_margin"
android:layout_toLeftOf="@+id/wind_sensor"
android:layout_toStartOf="@+id/wind_sensor"
android:text="@string/wind"
android:textAppearance="?textNormal" />
<ImageView
android:id="@+id/wind_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/default_margin"
android:layout_marginRight="@dimen/default_margin"
android:src="@drawable/ic_chevron_right_grey600_24dp" />
<ImageView
android:id="@+id/wind_sensor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_margin="@dimen/default_margin_half"
android:layout_toLeftOf="@+id/wind_value"
android:layout_toStartOf="@+id/wind_value"
android:src="?wind_off" />
<TextView
android:id="@+id/wind_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/default_margin"
android:layout_marginRight="@dimen/default_margin"
android:layout_toLeftOf="@id/wind_icon"
android:layout_toStartOf="@id/wind_icon"
android:gravity="end"
android:text="@string/wind_unknown"
android:textAppearance="?textSmall" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/thin_line"
android:layout_alignParentBottom="true"
android:background="?black" />
</RelativeLayout>
<Button
<include
android:id="@+id/start_race"
style="?attr/buttonSolidSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_margin="@dimen/default_margin_twice"
android:text="@string/race_setup_confirm" />
layout="@layout/race_schedule_button"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/race_data"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/start_race"
android:scrollbars="vertical"/>
</RelativeLayout>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Button
style="?attr/button"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/default_button_width"
android:layout_height="@dimen/default_button_height"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/unscheduled_confirm_button_margin"
android:text="@string/race_setup_confirm"
android:textSize="@dimen/textSize_18"
android:textStyle="normal"/>
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/selector_header_height">
<TextView
android:id="@+id/item_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/side_padding"
android:layout_toLeftOf="@+id/item_flag"
android:text="@string/start_mode"
android:textAppearance="?textNormal"
android:layout_marginRight="@dimen/side_padding"/>
<ImageView
android:id="@+id/item_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/default_margin"
android:src="@drawable/ic_chevron_right_grey600_24dp"/>
<ImageView
android:id="@+id/item_flag"
tools:src="@drawable/flag_papa_48dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/item_value"/>
<TextView
android:id="@+id/item_value"
tools:text="Papa"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/item_icon"
android:layout_marginRight="@dimen/side_padding"
android:layout_toLeftOf="@+id/item_icon"
android:gravity="end"
android:singleLine="true"
android:textAppearance="?textSmall"
android:layout_marginLeft="@dimen/side_padding"/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/thin_line"
android:layout_alignParentBottom="true"
android:background="?black"/>
</RelativeLayout>
@@ -14,8 +14,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="@dimen/finished_side_padding"
android:paddingRight="@dimen/finished_side_padding">
android:paddingLeft="@dimen/side_padding"
android:paddingRight="@dimen/side_padding">
<RelativeLayout
android:layout_width="match_parent"
@@ -45,14 +45,24 @@
<dimen name="wind_hide_button_right_margin">76dp</dimen>
<dimen name="wind_hide_button_top_margin">20dp</dimen>
<item name="picker_scale" format="float" type="integer">1.55</item>
<dimen name="panel_button_caption_size">@dimen/textSize_18</dimen>
<dimen name="panel_button_header_size">@dimen/textSize_20</dimen>
<!-- custom dimens (float, integer) -->
<item name="picker_scale" format="float" type="integer">1.55</item>
<item name="flag_size" format="integer" type="integer">48</item>
<dimen name="side_padding">@dimen/default_padding</dimen>
<!-- race state dependent -->
<!-- login -->
<dimen name="login_text_size_small">@dimen/textSize_22</dimen>
<dimen name="login_text_size">@dimen/textSize_26</dimen>
<!-- unscheduled -->
<dimen name="unscheduled_confirm_button_margin">@dimen/default_margin_twice</dimen>
<!-- finished -->
<dimen name="finished_side_padding">@dimen/default_padding</dimen>
<dimen name="finished_header_text_size">@dimen/textSize_40</dimen>
<dimen name="finished_default_text_size">@dimen/textSize_26</dimen>
<dimen name="finished_line_padding_half">@dimen/default_padding_half</dimen>
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="flag_size">48</integer>
</resources>
@@ -76,7 +76,7 @@
<attr name="wind_on" format="reference"/>
<attr name="wind_off" format="reference"/>
<!-- flag drawables -->
<!-- drawable drawables -->
<attr name="flag_ap_alpha_96dp" format="reference"/>
<attr name="flag_ap_hotel_96dp" format="reference"/>
<attr name="flag_november_alpha_96dp" format="reference"/>
@@ -61,14 +61,24 @@
<dimen name="wind_hide_button_right_margin">76dp</dimen>
<dimen name="wind_hide_button_top_margin">20dp</dimen>
<item name="picker_scale" format="float" type="integer">1</item>
<dimen name="panel_button_caption_size">@dimen/textSize_18</dimen>
<dimen name="panel_button_header_size">@dimen/textSize_20</dimen>
<!-- custom dimens (float, integer) -->
<item name="picker_scale" format="float" type="integer">1</item>
<item name="flag_size" format="integer" type="integer">32</item>
<dimen name="side_padding">@dimen/default_padding_half</dimen>
<!-- race state dependent -->
<!-- login -->
<dimen name="login_text_size_small">@dimen/textSize_18</dimen>
<dimen name="login_text_size">@dimen/textSize_20</dimen>
<!-- unscheduled -->
<dimen name="unscheduled_confirm_button_margin">@dimen/default_margin</dimen>
<!-- finished -->
<dimen name="finished_side_padding">@dimen/default_padding_half</dimen>
<dimen name="finished_header_text_size">@dimen/textSize_32</dimen>
<dimen name="finished_default_text_size">@dimen/textSize_22</dimen>
<dimen name="finished_line_padding_half">5dp</dimen>
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="flag_size">32</integer>
</resources>
@@ -90,7 +90,7 @@
<item name="wind_off">@drawable/wind_off_dark</item>
<item name="wind_on">@drawable/wind_on_dark</item>
<!-- flag drawable -->
<!-- drawable drawable -->
<item name="flag_ap_alpha_96dp">@drawable/flag_ap_alpha_96dp_dark</item>
<item name="flag_ap_hotel_96dp">@drawable/flag_ap_hotel_96dp_dark</item>
<item name="flag_november_alpha_96dp">@drawable/flag_november_alpha_96dp_dark</item>
@@ -99,7 +99,7 @@
<item name="wind_off">@drawable/wind_off_light</item>
<item name="wind_on">@drawable/wind_on_light</item>
<!-- flag drawable -->
<!-- drawable drawable -->
<item name="flag_ap_alpha_96dp">@drawable/flag_ap_alpha_96dp_light</item>
<item name="flag_ap_hotel_96dp">@drawable/flag_ap_hotel_96dp_light</item>
<item name="flag_november_alpha_96dp">@drawable/flag_november_alpha_96dp_light</item>
@@ -0,0 +1,37 @@
package com.sap.sailing.racecommittee.app.domain.impl;
import android.graphics.drawable.Drawable;
public class MainScheduleItem {
private String mCaption;
private String mValue;
private Drawable mDrawable;
private Runnable mRunnable;
public MainScheduleItem(String caption, Drawable drawable, String value, Runnable runnable) {
mCaption = caption;
mDrawable = drawable;
mValue = value;
mRunnable = runnable;
}
public String getCaption() {
return mCaption;
}
public String getValue() {
return mValue;
}
public void setValue(String value) {
mValue = value;
}
public Drawable getDrawable() {
return mDrawable;
}
public Runnable getRunnable() {
return mRunnable;
}
}
@@ -0,0 +1,80 @@
package com.sap.sailing.racecommittee.app.ui.adapters;
import java.util.List;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.sap.sailing.android.shared.util.ViewHelper;
import com.sap.sailing.racecommittee.app.R;
import com.sap.sailing.racecommittee.app.domain.impl.MainScheduleItem;
import com.sap.sailing.racecommittee.app.ui.utils.FlagsResources;
public class MainScheduleAdapter extends RecyclerView.Adapter<MainScheduleAdapter.ViewHolder> {
private Context mContext;
private List<MainScheduleItem> mItems;
private ItemClick mListener;
public MainScheduleAdapter(Context context, List<MainScheduleItem> items, ItemClick listener) {
mContext = context;
mItems = items;
mListener = listener;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.race_schedule_list_item, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
final MainScheduleItem item = mItems.get(position);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mListener != null) {
mListener.onItemClick(item.getRunnable());
}
}
});
holder.caption.setText(item.getCaption());
holder.value.setText(item.getValue());
holder.drawable.setImageDrawable(null);
if (item.getDrawable() != null) {
holder.drawable.setImageDrawable(item.getDrawable());
}
}
@Override
public int getItemCount() {
return (mItems != null) ? mItems.size() : 0;
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView caption;
public ImageView drawable;
public TextView value;
public ViewHolder(View itemView) {
super(itemView);
caption = ViewHelper.get(itemView, R.id.item_caption);
drawable = ViewHelper.get(itemView, R.id.item_flag);
value = ViewHelper.get(itemView, R.id.item_value);
}
}
public interface ItemClick {
void onItemClick(Runnable runnable);
}
}
@@ -1,17 +1,18 @@
package com.sap.sailing.racecommittee.app.ui.fragments.raceinfo;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Locale;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.sap.sailing.android.shared.logging.ExLog;
import com.sap.sailing.android.shared.util.ViewHelper;
@@ -25,17 +26,18 @@ import com.sap.sailing.domain.common.racelog.RacingProcedureType;
import com.sap.sailing.racecommittee.app.R;
import com.sap.sailing.racecommittee.app.data.DataManager;
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
import com.sap.sailing.racecommittee.app.domain.impl.MainScheduleItem;
import com.sap.sailing.racecommittee.app.ui.activities.RacingActivity;
import com.sap.sailing.racecommittee.app.ui.adapters.MainScheduleAdapter;
import com.sap.sailing.racecommittee.app.ui.fragments.RaceFragment;
import com.sap.sailing.racecommittee.app.ui.utils.FlagsResources;
import com.sap.sailing.racecommittee.app.utils.BitmapHelper;
import com.sap.sailing.racecommittee.app.utils.RaceHelper;
import com.sap.sailing.racecommittee.app.utils.TimeUtils;
import com.sap.sse.common.Duration;
import com.sap.sse.common.TimePoint;
import com.sap.sse.common.impl.MillisecondsTimePoint;
public class MainScheduleFragment extends BaseFragment implements View.OnClickListener {
public class MainScheduleFragment extends BaseFragment implements View.OnClickListener, MainScheduleAdapter.ItemClick {
public static final String START_TIME = "startTime";
public static final String DEPENDENT_RACE = "dependentRace";
@@ -43,131 +45,121 @@ public class MainScheduleFragment extends BaseFragment implements View.OnClickLi
private static final String TAG = MainScheduleFragment.class.getName();
private TextView mStartTimeTextView;
private MainScheduleAdapter mAdapter;
private ArrayList<MainScheduleItem> mItems;
private MainScheduleItem mItemStartTime;
private MainScheduleItem mItemStartWind;
private String mStartTimeString;
private SimpleRaceLogIdentifier mRaceId;
private TimePoint mStartTime;
private Duration mStartTimeDiff;
private TextView mWindValue;
private RacingProcedureType mRacingProcedureType;
private TextView mStartProcedureValue;
private View mStartModeView;
private TextView mStartModeTextView;
private ImageView mStartModeImageView;
private TextView mCourseTextView;
private ImageView mCourseImageView;
private SimpleDateFormat mDateFormat;
private Calendar mCalendar;
private RaceStateChangedListener mStateListener;
private int mFlagSize;
public MainScheduleFragment() {
mCalendar = Calendar.getInstance();
}
public static MainScheduleFragment newInstance() {
MainScheduleFragment fragment = new MainScheduleFragment();
return fragment;
return new MainScheduleFragment();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.race_schedule, container, false);
mItems = new ArrayList<>();
mStateListener = new RaceStateChangedListener();
RecyclerView raceData = ViewHelper.get(layout, R.id.race_data);
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mAdapter = new MainScheduleAdapter(getActivity(), mItems, this);
raceData.setLayoutManager(layoutManager);
raceData.setAdapter(mAdapter);
mDateFormat = new SimpleDateFormat("HH:mm:ss", getResources().getConfiguration().locale);
View startTime = ViewHelper.get(layout, R.id.start_time);
if (startTime != null) {
startTime.setOnClickListener(this);
}
mStartTimeTextView = ViewHelper.get(layout, R.id.start_time_value);
View startProcedure = ViewHelper.get(layout, R.id.start_procedure);
if (startProcedure != null) {
startProcedure.setOnClickListener(this);
}
mStartProcedureValue = ViewHelper.get(layout, R.id.start_procedure_value);
mStartModeView = ViewHelper.get(layout, R.id.start_mode);
if (mStartModeView != null) {
mStartModeView.setOnClickListener(this);
}
mStartModeTextView = ViewHelper.get(layout, R.id.start_mode_value);
mStartModeImageView = ViewHelper.get(layout, R.id.start_mode_flag);
View course = ViewHelper.get(layout, R.id.start_course);
if (course != null) {
course.setOnClickListener(this);
}
mCourseImageView = ViewHelper.get(layout, R.id.start_course_symbol);
mCourseTextView = ViewHelper.get(layout, R.id.start_course_value);
View start = ViewHelper.get(layout, R.id.start_race);
if (start != null) {
start.setOnClickListener(this);
}
View wind = ViewHelper.get(layout, R.id.wind);
if (wind != null) {
wind.setOnClickListener(this);
}
mWindValue = ViewHelper.get(layout, R.id.wind_value);
mFlagSize = getResources().getInteger(R.integer.flag_size);
return layout;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
initStartTime();
initStartMode();
initCourse();
initWind();
}
@Override
public void onResume() {
super.onResume();
if (getRace() != null && getRaceState() != null) {
getRaceState().addChangedListener(mStateListener);
initStartTime();
initStartMode();
initCourse();
}
}
private void initCourse() {
if (mCourseTextView != null && getRaceState().getCourseDesign() != null) {
String courseName = getCourseName();
mCourseTextView.setText(courseName);
if (mCourseImageView != null && !TextUtils.isEmpty(courseName)) {
int resId = (courseName.toLowerCase(Locale.US).startsWith("i")) ? R.attr.course_updown_48dp : R.attr.course_triangle_48dp;
Drawable drawable = BitmapHelper.getAttrDrawable(getActivity(), resId);
if (drawable != null) {
mCourseImageView.setImageDrawable(drawable);
}
mCourseImageView.setVisibility(View.GONE);
Runnable runnable = new Runnable() {
@Override
public void run() {
openFragment(CourseFragment.newInstance(0, getRace()));
}
};
MainScheduleItem courseItem = new MainScheduleItem(getString(R.string.course), null, null, runnable);
if (getRaceState().getCourseDesign() != null) {
courseItem.setValue(getCourseName());
}
mItems.add(courseItem);
}
private void initWind() {
Runnable runnable = new Runnable() {
@Override
public void run() {
openFragment(WindFragment.newInstance(0));
}
};
mItemStartWind = new MainScheduleItem(getString(R.string.wind), null, null, runnable);
mItems.add(mItemStartWind);
}
private void initStartMode() {
mRacingProcedureType = getRaceState().getRacingProcedure().getType();
if (mRacingProcedureType != null) {
if (mRacingProcedureType.equals(RacingProcedureType.RRS26)) {
mStartModeView.setVisibility(View.VISIBLE);
Runnable runnableProcedure = new Runnable() {
@Override
public void run() {
openFragment(StartProcedureFragment.newInstance(0));
}
};
mItems.add(new MainScheduleItem(getString(R.string.start_procedure), null, mRacingProcedureType.toString(), runnableProcedure));
if (RacingProcedureType.RRS26.equals(mRacingProcedureType)) {
// LineStart
RRS26RacingProcedure procedure = getRaceState().getTypedRacingProcedure();
Flags flag = procedure.getStartModeFlag();
if (mStartModeTextView != null) {
mStartModeTextView.setText(flag.name());
}
if (mStartModeImageView != null) {
mStartModeImageView.setImageDrawable(FlagsResources.getFlagDrawable(getActivity(), flag.name(), 48));
}
} else {
mStartModeView.setVisibility(View.GONE);
}
if (mStartProcedureValue != null) {
mStartProcedureValue.setText(mRacingProcedureType.toString());
Runnable runnableMode = new Runnable() {
@Override
public void run() {
openFragment(StartModeFragment.newInstance(0));
}
};
Drawable drawable = FlagsResources.getFlagDrawable(getActivity(), flag.name(), mFlagSize);
mItems.add(new MainScheduleItem(getString(R.string.start_mode), drawable, flag.name(), runnableMode));
} if (RacingProcedureType.GateStart.equals(mRacingProcedureType)) {
// GateStart
mItems.add(new MainScheduleItem(getString(R.string.gate_start_pathfinder), null, null, null));
mItems.add(new MainScheduleItem(getString(R.string.gate_start_timing), null, null, null));
}
}
}
@@ -193,6 +185,15 @@ public class MainScheduleFragment extends BaseFragment implements View.OnClickLi
ManagedRace race = DataManager.create(getActivity()).getDataStore().getRace(mRaceId);
mStartTimeString = getString(R.string.minutes_after_long, mStartTimeDiff.asMinutes(), RaceHelper.getRaceName(race, " / "));
}
Runnable runnable = new Runnable() {
@Override
public void run() {
openFragment(StartTimeFragment.newInstance(getArguments()));
}
};
mItemStartTime = new MainScheduleItem(getString(R.string.start_time), null, mStartTimeString, runnable);
mItems.add(mItemStartTime);
}
@Override
@@ -207,30 +208,10 @@ public class MainScheduleFragment extends BaseFragment implements View.OnClickLi
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.start_course:
openFragment(CourseFragment.newInstance(0, getRace()));
break;
case R.id.start_mode:
openFragment(StartModeFragment.newInstance(0));
break;
case R.id.start_procedure:
openFragment(StartProcedureFragment.newInstance(0));
break;
case R.id.start_race:
startRace();
break;
case R.id.start_time:
openFragment(StartTimeFragment.newInstance(getArguments()));
break;
case R.id.wind:
openFragment(WindFragment.newInstance(0));
break;
default:
ExLog.i(getActivity(), TAG, "Clicked on " + v);
}
@@ -259,20 +240,24 @@ public class MainScheduleFragment extends BaseFragment implements View.OnClickLi
public void notifyTick(TimePoint now) {
super.notifyTick(now);
if (mStartTimeTextView != null && !TextUtils.isEmpty(mStartTimeString)) {
if (mItemStartTime != null && !TextUtils.isEmpty(mStartTimeString)) {
if (mRaceId == null && mStartTimeDiff == null) {
String startTimeValue = getString(R.string.start_time_value, mStartTimeString, calcCountdown(now));
mStartTimeTextView.setText(startTimeValue);
mItemStartTime.setValue(startTimeValue);
} else {
mStartTimeTextView.setText(mStartTimeString);
mItemStartTime.setValue(mStartTimeString);
}
}
if (mWindValue != null && getRace() != null && getRaceState() != null && getRaceState().getWindFix() != null) {
if (getRace() != null && getRaceState() != null && getRaceState().getWindFix() != null) {
Wind wind = getRaceState().getWindFix();
String sensorData = getString(R.string.wind_sensor, mDateFormat.format(wind.getTimePoint().asDate()), wind.getFrom().getDegrees(), wind
.getKnots());
mWindValue.setText(sensorData);
mItemStartWind.setValue(sensorData);
}
if (mAdapter != null) {
mAdapter.notifyDataSetChanged();
}
}
@@ -302,6 +287,14 @@ public class MainScheduleFragment extends BaseFragment implements View.OnClickLi
getFragmentManager().beginTransaction().replace(R.id.racing_view_container, fragment).commitAllowingStateLoss();
}
@Override
public void onItemClick(Runnable runnable) {
if (runnable != null) {
Handler handler = new Handler();
handler.post(runnable);
}
}
private class RaceStateChangedListener extends BaseRaceStateChangedListener {
@Override
public void onStatusChanged(ReadonlyRaceState state) {