TRACKING APP: regatta in progress view

This commit is contained in:
Lukas Zielinski committed 2014-12-05 12:06:14 +01:00
1 parent 265d708689
commit f34f7bb044
5 files changed
+37 -19

No files matched your search

@@ -75,5 +75,6 @@
<string name="no_qr_code_popup_message">Bitte kontaktieren Sie die Rennleitung, falls Sie keinen QR-Code erhalten haben.</string> <string name="no_qr_code_popup_message">Bitte kontaktieren Sie die Rennleitung, falls Sie keinen QR-Code erhalten haben.</string>
<string name="tracking_colon">Tracke:</string> <string name="tracking_colon">Tracke:</string>
<string name="tracking_gps_accuracy">GPS Genauigkeit</string> <string name="tracking_gps_accuracy">GPS Genauigkeit</string>
<string name="regatta_in_progress">Die Regatta findet gerade statt.</string>
</resources> </resources>
@@ -64,5 +64,6 @@
<string name="no_qr_code_popup_title">No QR-Code?</string> <string name="no_qr_code_popup_title">No QR-Code?</string>
<string name="no_qr_code_popup_message">Please contact race management if you have not received a QR-Code.</string> <string name="no_qr_code_popup_message">Please contact race management if you have not received a QR-Code.</string>
<string name="tracking_colon">Tracking:</string> <string name="tracking_colon">Tracking:</string>
<string name="regatta_in_progress">The regatta is in progress.</string>
</resources> </resources>
@@ -44,23 +44,18 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
Bundle savedInstanceState) { Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState); super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_regatta, container, View view = inflater.inflate(R.layout.fragment_regatta, container, false);
false);
Button startTrackingButton = (Button) view Button startTrackingButton = (Button) view.findViewById(R.id.start_tracking);
.findViewById(R.id.start_tracking);
startTrackingButton.setOnClickListener(this); startTrackingButton.setOnClickListener(this);
Button changePhotoButton = (Button) view Button changePhotoButton = (Button) view.findViewById(R.id.change_photo_button);
.findViewById(R.id.change_photo_button);
changePhotoButton.setOnClickListener(this); changePhotoButton.setOnClickListener(this);
ImageButton addPhotoButton = (ImageButton) view ImageButton addPhotoButton = (ImageButton) view.findViewById(R.id.add_photo_button);
.findViewById(R.id.add_photo_button);
addPhotoButton.setOnClickListener(this); addPhotoButton.setOnClickListener(this);
TextView addPhotoText = (TextView) view TextView addPhotoText = (TextView) view.findViewById(R.id.add_photo_text);
.findViewById(R.id.add_photo_text);
addPhotoText.setOnClickListener(this); addPhotoText.setOnClickListener(this);
return view; return view;
@@ -74,6 +69,30 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
switchToThankYouScreen(); switchToThankYouScreen();
} }
} }
/**
* If the regatta started, don't display the countdown any more.
*/
private void checkAndHideCountdownIfRegattaIsInProgress() {
TextView textView = (TextView)getActivity().findViewById(R.id.regatta_starts_in);
RegattaActivity regattaActivity = (RegattaActivity) getActivity();
long regattaStart = regattaActivity.getEventStartMillis();
LinearLayout threeBoxesLayout = (LinearLayout) getActivity()
.findViewById(R.id.three_boxes_regatta_starts);
if (System.currentTimeMillis() > regattaStart)
{
textView.setText(getString(R.string.regatta_in_progress));
threeBoxesLayout.setVisibility(View.INVISIBLE);
}
else
{
textView.setText(getString(R.string.regatta_starts_in));
threeBoxesLayout.setVisibility(View.VISIBLE);
}
}
private void switchToThankYouScreen() { private void switchToThankYouScreen() {
showingThankYouNote = true; showingThankYouNote = true;
@@ -82,18 +101,14 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
.findViewById(R.id.start_date_layout); .findViewById(R.id.start_date_layout);
startsInLayout.setVisibility(View.INVISIBLE); startsInLayout.setVisibility(View.INVISIBLE);
Button startTrackingButton = (Button) getActivity().findViewById( Button startTrackingButton = (Button) getActivity().findViewById(R.id.start_tracking);
R.id.start_tracking); startTrackingButton.setBackgroundColor(getActivity().getResources().getColor(R.color.sap_yellow));
startTrackingButton.setBackgroundColor(getActivity().getResources()
.getColor(R.color.sap_yellow));
startTrackingButton.setText(getActivity().getString(R.string.close)); startTrackingButton.setText(getActivity().getString(R.string.close));
TextView bottomAnnouncement = (TextView) getActivity().findViewById( TextView bottomAnnouncement = (TextView) getActivity().findViewById(R.id.bottom_announcement);
R.id.bottom_announcement);
bottomAnnouncement.setVisibility(View.INVISIBLE); bottomAnnouncement.setVisibility(View.INVISIBLE);
RelativeLayout thankYouLayout = (RelativeLayout) getActivity() RelativeLayout thankYouLayout = (RelativeLayout) getActivity().findViewById(R.id.thank_you_layout);
.findViewById(R.id.thank_you_layout);
thankYouLayout.setVisibility(View.VISIBLE); thankYouLayout.setVisibility(View.VISIBLE);
} }
@@ -103,6 +118,7 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
timer = new TimerRunnable(); timer = new TimerRunnable();
timer.start(); timer.start();
checkAndSwitchToThankYouScreenIfRegattaOver(); checkAndSwitchToThankYouScreenIfRegattaOver();
checkAndHideCountdownIfRegattaIsInProgress();
} }
@Override @Override
@@ -228,7 +244,7 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
private void updateCountdownTimer(long startTime) { private void updateCountdownTimer(long startTime) {
long diff = startTime - System.currentTimeMillis(); long diff = startTime - System.currentTimeMillis();
if (diff < 0) // event is in the past if (diff < 0) // start of event is in the past
{ {
setCountdownTime(0, 0, 0); setCountdownTime(0, 0, 0);
} else { } else {