mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-30 15:57:11 +00:00
# working towards finishing fragment
This commit is contained in:
1 parent
dce68f9427
commit
137f5544c8
10 files changed
+383
-93
No files matched your search
@@ -0,0 +1,216 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/raceCountUp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/currentlyLoading"
|
||||
android:textAppearance="@style/TextAppearance.Welter.ExtraBigTitleLabel" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nextFlagCountdown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.Welter.BigTitleLabel" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="500dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingBottom="2dp"
|
||||
android:scaleType="fitXY"
|
||||
android:contentDescription="@string/app_name"
|
||||
android:src="@android:drawable/divider_horizontal_textfield" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="10dip"
|
||||
android:layout_marginLeft="10dip"
|
||||
android:layout_marginRight="10dip"
|
||||
android:layout_marginTop="10dip"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<!-- DISPLAY SECTION -->
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/InnerRelativeLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.618"
|
||||
android:gravity="fill_horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/blueFlag"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="130dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="50dp"
|
||||
android:contentDescription="@string/flag_blue"
|
||||
android:src="@drawable/blue_flag_mini" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/xrayFlag"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="130dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:contentDescription="@string/flag_Xray"
|
||||
android:src="@drawable/xray_flag"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/golfFlag"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="130dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:contentDescription="@string/flag_golf"
|
||||
android:src="@drawable/golf_flag"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!-- END DISPLAY SECTION -->
|
||||
|
||||
<com.sap.sailing.racecommittee.app.ui.views.VerticalTextView
|
||||
android:id="@+id/flagsUpLable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/flags_up"
|
||||
android:textAppearance="@style/TextAppearance.Welter.VeryBigTitleLabel" />
|
||||
|
||||
<com.sap.sailing.racecommittee.app.ui.views.VerticalTextView
|
||||
android:id="@+id/flagsDownLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:text="@string/flags_down"
|
||||
android:textAppearance="@style/TextAppearance.Welter.VeryBigTitleLabel" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="#DADADA" />
|
||||
|
||||
<!-- SELECTION SECTION -->
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.99"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<!-- <ImageButton
|
||||
android:id="@+id/xrayButton"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="80dp"
|
||||
android:contentDescription="@string/choose_xray_flag_up"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/xray_flag"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ChooseXrayLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/choose_xray_flag_up"
|
||||
android:textAppearance="@style/TextAppearance.Welter.TitleLabel"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/golfButton"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="80dp"
|
||||
android:contentDescription="@string/choose_xray_flag_up"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/golf_flag"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ChooseGolfLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/choose_golf_flag_down"
|
||||
android:textAppearance="@style/TextAppearance.Welter.TitleLabel"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/firstSubstituteButton"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="80dp"
|
||||
android:contentDescription="@string/choose_first_substitute_flag"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/first_substitute_flag" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ChooseFirstSubstituteLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/choose_first_substitute_flag"
|
||||
android:textAppearance="@style/TextAppearance.Welter.TitleLabel" /> -->
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/blueFlagButton"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="80dp"
|
||||
android:contentDescription="@string/choose_blue_flag"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/blue_flag" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ChooseBlueFlagLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/choose_blue_flag"
|
||||
android:textAppearance="@style/TextAppearance.Welter.TitleLabel" />
|
||||
|
||||
<!-- <ImageButton
|
||||
android:id="@+id/novemberButton"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="80dp"
|
||||
android:contentDescription="@string/abort_running_race"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ap_november_flag" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/novemberButtonLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/abort_running_race"
|
||||
android:textAppearance="@style/TextAppearance.Welter.TitleLabel" /> -->
|
||||
</LinearLayout>
|
||||
|
||||
<!-- END SELECTION SECTION -->
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -15,7 +15,7 @@
|
||||
<TextView
|
||||
android:id="@+id/nextFlagCountdown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.Welter.BigTitleLabel" />
|
||||
|
||||
<ImageView
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
<!-- END DISPLAY SECTION -->
|
||||
|
||||
<com.sap.sailing.racecommittee.app.utils.views.MyVerticalTextView
|
||||
<com.sap.sailing.racecommittee.app.ui.views.VerticalTextView
|
||||
android:id="@+id/flagsUpLable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -92,7 +92,7 @@
|
||||
android:text="@string/flags_up"
|
||||
android:textAppearance="@style/TextAppearance.Welter.VeryBigTitleLabel" />
|
||||
|
||||
<com.sap.sailing.racecommittee.app.utils.views.MyVerticalTextView
|
||||
<com.sap.sailing.racecommittee.app.ui.views.VerticalTextView
|
||||
android:id="@+id/flagsDownLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -102,7 +102,8 @@
|
||||
android:text="@string/flags_down"
|
||||
android:textAppearance="@style/TextAppearance.Welter.VeryBigTitleLabel" />
|
||||
</RelativeLayout>
|
||||
␍
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
@@ -119,7 +120,7 @@
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ImageButton
|
||||
<!-- <ImageButton
|
||||
android:id="@+id/xrayButton"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="80dp"
|
||||
@@ -172,7 +173,7 @@
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/choose_first_substitute_flag"
|
||||
android:textAppearance="@style/TextAppearance.Welter.TitleLabel" />
|
||||
android:textAppearance="@style/TextAppearance.Welter.TitleLabel" /> -->
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/blueFlagButton"
|
||||
@@ -191,7 +192,7 @@
|
||||
android:text="@string/choose_blue_flag"
|
||||
android:textAppearance="@style/TextAppearance.Welter.TitleLabel" />
|
||||
|
||||
<ImageButton
|
||||
<!-- <ImageButton
|
||||
android:id="@+id/novemberButton"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="80dp"
|
||||
@@ -206,11 +207,11 @@
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/abort_running_race"
|
||||
android:textAppearance="@style/TextAppearance.Welter.TitleLabel" />
|
||||
android:textAppearance="@style/TextAppearance.Welter.TitleLabel" /> -->
|
||||
</LinearLayout>
|
||||
|
||||
<!-- END SELECTION SECTION -->
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
+15
@@ -55,10 +55,25 @@ public interface RaceState {
|
||||
* @return the status of the race.
|
||||
*/
|
||||
RaceLogRaceStatus getStatus();
|
||||
|
||||
/**
|
||||
* TODO: remove when start procedures are ready
|
||||
*/
|
||||
void onRaceAborted(TimePoint eventTime);
|
||||
|
||||
/**
|
||||
* TODO: remove when start procedures are ready
|
||||
*/
|
||||
void onRaceStarted(TimePoint eventTime);
|
||||
|
||||
/**
|
||||
* TODO: remove when start procedures are ready
|
||||
*/
|
||||
void onRaceFinishing(TimePoint now);
|
||||
|
||||
/**
|
||||
* TODO: remove when start procedures are ready
|
||||
*/
|
||||
void onRaceFinished(TimePoint now);
|
||||
|
||||
}
|
||||
+14
-2
@@ -82,7 +82,7 @@ public class RaceStateImpl implements RaceState, RaceLogChangedListener {
|
||||
public void setStartTime(TimePoint eventTime, TimePoint newStartTime) {
|
||||
RaceLogRaceStatus status = getStatus();
|
||||
if (status != RaceLogRaceStatus.UNSCHEDULED) {
|
||||
abortRace(eventTime.minus(1));
|
||||
onRaceAborted(eventTime.minus(1));
|
||||
}
|
||||
|
||||
RaceLogEvent event = new RaceLogStartTimeEventImpl(eventTime, UUID.randomUUID(),
|
||||
@@ -91,7 +91,7 @@ public class RaceStateImpl implements RaceState, RaceLogChangedListener {
|
||||
this.raceLog.add(event);
|
||||
}
|
||||
|
||||
public void abortRace(TimePoint eventTime) {
|
||||
public void onRaceAborted(TimePoint eventTime) {
|
||||
RaceLogEvent abortEvent = new RaceLogRaceStatusEventImpl(eventTime.minus(1), UUID.randomUUID(),
|
||||
Collections.<Competitor> emptyList(), raceLog.getCurrentPassId(), RaceLogRaceStatus.UNSCHEDULED);
|
||||
this.raceLog.add(abortEvent);
|
||||
@@ -107,6 +107,18 @@ public class RaceStateImpl implements RaceState, RaceLogChangedListener {
|
||||
this.raceLog.add(startEvent);
|
||||
}
|
||||
|
||||
public void onRaceFinishing(TimePoint eventTime) {
|
||||
RaceLogEvent startEvent = new RaceLogRaceStatusEventImpl(eventTime, UUID.randomUUID(),
|
||||
Collections.<Competitor> emptyList(), raceLog.getCurrentPassId(), RaceLogRaceStatus.FINISHING);
|
||||
this.raceLog.add(startEvent);
|
||||
}
|
||||
|
||||
public void onRaceFinished(TimePoint eventTime) {
|
||||
RaceLogEvent startEvent = new RaceLogRaceStatusEventImpl(eventTime, UUID.randomUUID(),
|
||||
Collections.<Competitor> emptyList(), raceLog.getCurrentPassId(), RaceLogRaceStatus.FINISHED);
|
||||
this.raceLog.add(startEvent);
|
||||
}
|
||||
|
||||
public RaceLogRaceStatus updateStatus() {
|
||||
setStatus(statusAnalyzer.getStatus());
|
||||
return getStatus();
|
||||
|
||||
+7
-5
@@ -3,8 +3,10 @@ package com.sap.sailing.racecommittee.app.ui.fragments.chooser;
|
||||
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
|
||||
import com.sap.sailing.racecommittee.app.logging.ExLog;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.RaceFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.ErrorInfoFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.ErrorRaceFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.FinishedRaceFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.FinishingRaceFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.RunningRaceFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.SetTimeRaceFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.StartphaseRaceFragment;
|
||||
|
||||
@@ -19,13 +21,13 @@ public class RaceInfoFragmentChooser {
|
||||
case STARTPHASE:
|
||||
return createInfoFragment(StartphaseRaceFragment.class, managedRace);
|
||||
case RUNNING:
|
||||
return createInfoFragment(ErrorInfoFragment.class, managedRace);
|
||||
return createInfoFragment(RunningRaceFragment.class, managedRace);
|
||||
case FINISHING:
|
||||
return createInfoFragment(ErrorInfoFragment.class, managedRace);
|
||||
return createInfoFragment(FinishingRaceFragment.class, managedRace);
|
||||
case FINISHED:
|
||||
return createInfoFragment(FinishedRaceFragment.class, managedRace);
|
||||
default:
|
||||
return createInfoFragment(ErrorInfoFragment.class, managedRace);
|
||||
return createInfoFragment(ErrorRaceFragment.class, managedRace);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +38,7 @@ public class RaceInfoFragmentChooser {
|
||||
return fragment;
|
||||
} catch (Exception e) {
|
||||
ExLog.e(TAG, String.format("Exception while instantiating race info fragment:\n%s", e.toString()));
|
||||
return new ErrorInfoFragment();
|
||||
return new ErrorRaceFragment();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.fragments.raceinfo;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.sap.sailing.racecommittee.app.logging.ExLog;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.RaceFragment;
|
||||
|
||||
public class ErrorInfoFragment extends RaceFragment {
|
||||
private static final String TAG = ErrorInfoFragment.class.getName();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ExLog.e(TAG, "Somehow the error race info fragment got selected...");
|
||||
}
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.fragments.raceinfo;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.sap.sailing.racecommittee.app.logging.ExLog;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.RaceFragment;
|
||||
|
||||
public class ErrorRaceFragment extends RaceFragment {
|
||||
private static final String TAG = ErrorRaceFragment.class.getName();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
ExLog.e(TAG, "Somehow the error race fragment got selected...");
|
||||
}
|
||||
|
||||
}
|
||||
+63
-58
@@ -16,66 +16,71 @@ import com.sap.sailing.racecommittee.app.ui.fragments.RaceFragment;
|
||||
|
||||
/**
|
||||
* @author Klaus Trophie
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class FinishedRaceFragment extends RaceFragment {
|
||||
|
||||
TextView headerView;
|
||||
TextView startTimeView;
|
||||
TextView firstBoatFinishedView;
|
||||
TextView finishTimeView;
|
||||
TextView protestStartTimeView;
|
||||
/// TODO: some time limit time is missing?! Dunno why it exists...
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.race_finished_view, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
headerView = (TextView) getView().findViewById(R.id.textFinishedRace);
|
||||
startTimeView = (TextView) getView().findViewById(R.id.textFinishedRaceStarted);
|
||||
firstBoatFinishedView = (TextView) getView().findViewById(R.id.textFirstBoatFinished);
|
||||
finishTimeView = (TextView) getView().findViewById(R.id.textFinishedRaceEnded);
|
||||
protestStartTimeView = (TextView) getView().findViewById(R.id.textProtestStartTime);
|
||||
|
||||
String raceFinishedText = String.format(String.valueOf(getText(R.string.race_finished_template)), getRace().getName());
|
||||
|
||||
headerView.setText(raceFinishedText);
|
||||
|
||||
Date startTime = new Date(); /// TODO: get real start time
|
||||
if (startTime != null) {
|
||||
startTimeView.setText(getString(R.string.race_finished_start_time) + " " + getFormattedTime(startTime));
|
||||
}
|
||||
|
||||
Date firstBoatFinishedViewTime = new Date();/// TODO: get real first boat finished time
|
||||
if (firstBoatFinishedViewTime != null) {
|
||||
firstBoatFinishedView.setText(getString(R.string.race_first_boat_finished) + " " + getFormattedTime(firstBoatFinishedViewTime));
|
||||
}
|
||||
|
||||
Date finishTime = new Date();/// TODO: get real finish time
|
||||
if (finishTime != null) {
|
||||
finishTimeView.setText(getString(R.string.race_finished_end_time) + " " + getFormattedTime(finishTime));
|
||||
}
|
||||
|
||||
Date protestStartTime = new Date(); /// TODO: get real protest start time
|
||||
if (protestStartTime != null) {
|
||||
String raceProtestStartTimeText = String.format(String.valueOf(getText(R.string.protest_start_time)), getFormattedTime(protestStartTime));
|
||||
protestStartTimeView.setText(raceProtestStartTimeText);
|
||||
protestStartTimeView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private String getFormattedTime(Date time) {
|
||||
return getFormattedTimePart(time.getHours()) + ":" + getFormattedTimePart(time.getMinutes()) + ":" + getFormattedTimePart(time.getSeconds());
|
||||
}
|
||||
private String getFormattedTimePart(int timePart) {
|
||||
return (timePart < 10) ? "0" + timePart : String.valueOf(timePart);
|
||||
}
|
||||
|
||||
TextView headerView;
|
||||
TextView startTimeView;
|
||||
TextView firstBoatFinishedView;
|
||||
TextView finishTimeView;
|
||||
TextView protestStartTimeView;
|
||||
|
||||
// / TODO: some time limit time is missing?! Dunno why it exists...
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.race_finished_view, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
headerView = (TextView) getView().findViewById(R.id.textFinishedRace);
|
||||
startTimeView = (TextView) getView().findViewById(R.id.textFinishedRaceStarted);
|
||||
firstBoatFinishedView = (TextView) getView().findViewById(R.id.textFirstBoatFinished);
|
||||
finishTimeView = (TextView) getView().findViewById(R.id.textFinishedRaceEnded);
|
||||
protestStartTimeView = (TextView) getView().findViewById(R.id.textProtestStartTime);
|
||||
|
||||
String raceFinishedText = String.format(String.valueOf(getText(R.string.race_finished_template)), getRace()
|
||||
.getName());
|
||||
|
||||
headerView.setText(raceFinishedText);
|
||||
|
||||
Date startTime = new Date(); // / TODO: get real start time
|
||||
if (startTime != null) {
|
||||
startTimeView.setText(getString(R.string.race_finished_start_time) + " " + getFormattedTime(startTime));
|
||||
}
|
||||
|
||||
Date firstBoatFinishedViewTime = new Date();// / TODO: get real first boat finished time
|
||||
if (firstBoatFinishedViewTime != null) {
|
||||
firstBoatFinishedView.setText(getString(R.string.race_first_boat_finished) + " "
|
||||
+ getFormattedTime(firstBoatFinishedViewTime));
|
||||
}
|
||||
|
||||
Date finishTime = new Date();// / TODO: get real finish time
|
||||
if (finishTime != null) {
|
||||
finishTimeView.setText(getString(R.string.race_finished_end_time) + " " + getFormattedTime(finishTime));
|
||||
}
|
||||
|
||||
Date protestStartTime = new Date(); // / TODO: get real protest start time
|
||||
if (protestStartTime != null) {
|
||||
String raceProtestStartTimeText = String.format(String.valueOf(getText(R.string.protest_start_time)),
|
||||
getFormattedTime(protestStartTime));
|
||||
protestStartTimeView.setText(raceProtestStartTimeText);
|
||||
protestStartTimeView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private String getFormattedTime(Date time) {
|
||||
return getFormattedTimePart(time.getHours()) + ":" + getFormattedTimePart(time.getMinutes()) + ":"
|
||||
+ getFormattedTimePart(time.getSeconds());
|
||||
}
|
||||
|
||||
private String getFormattedTimePart(int timePart) {
|
||||
return (timePart < 10) ? "0" + timePart : String.valueOf(timePart);
|
||||
}
|
||||
|
||||
}
|
||||
+8
-1
@@ -12,7 +12,14 @@ public class FinishingRaceFragment extends RaceFragment {
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.race_finished_view, container, false);
|
||||
return inflater.inflate(R.layout.race_finishing_view, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.fragments.raceinfo;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.RaceFragment;
|
||||
|
||||
public class RunningRaceFragment extends RaceFragment {
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.race_running_view, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
ImageButton blueFlagButton = (ImageButton) getView().findViewById(R.id.blueFlagButton);
|
||||
blueFlagButton.setOnClickListener(new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
getRace().getState().onRaceFinishing(MillisecondsTimePoint.now());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user