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="tracking_colon">Tracke:</string>
<string name="tracking_gps_accuracy">GPS Genauigkeit</string>
<string name="regatta_in_progress">Die Regatta findet gerade statt.</string>
</resources>
@@ -64,5 +64,6 @@
<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="tracking_colon">Tracking:</string>
<string name="regatta_in_progress">The regatta is in progress.</string>
</resources>
@@ -44,23 +44,18 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_regatta, container,
false);
View view = inflater.inflate(R.layout.fragment_regatta, container, false);
Button startTrackingButton = (Button) view
.findViewById(R.id.start_tracking);
Button startTrackingButton = (Button) view.findViewById(R.id.start_tracking);
startTrackingButton.setOnClickListener(this);
Button changePhotoButton = (Button) view
.findViewById(R.id.change_photo_button);
Button changePhotoButton = (Button) view.findViewById(R.id.change_photo_button);
changePhotoButton.setOnClickListener(this);
ImageButton addPhotoButton = (ImageButton) view
.findViewById(R.id.add_photo_button);
ImageButton addPhotoButton = (ImageButton) view.findViewById(R.id.add_photo_button);
addPhotoButton.setOnClickListener(this);
TextView addPhotoText = (TextView) view
.findViewById(R.id.add_photo_text);
TextView addPhotoText = (TextView) view.findViewById(R.id.add_photo_text);
addPhotoText.setOnClickListener(this);
return view;
@@ -75,6 +70,30 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
}
}
/**
* 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() {
showingThankYouNote = true;
@@ -82,18 +101,14 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
.findViewById(R.id.start_date_layout);
startsInLayout.setVisibility(View.INVISIBLE);
Button startTrackingButton = (Button) getActivity().findViewById(
R.id.start_tracking);
startTrackingButton.setBackgroundColor(getActivity().getResources()
.getColor(R.color.sap_yellow));
Button startTrackingButton = (Button) getActivity().findViewById(R.id.start_tracking);
startTrackingButton.setBackgroundColor(getActivity().getResources().getColor(R.color.sap_yellow));
startTrackingButton.setText(getActivity().getString(R.string.close));
TextView bottomAnnouncement = (TextView) getActivity().findViewById(
R.id.bottom_announcement);
TextView bottomAnnouncement = (TextView) getActivity().findViewById(R.id.bottom_announcement);
bottomAnnouncement.setVisibility(View.INVISIBLE);
RelativeLayout thankYouLayout = (RelativeLayout) getActivity()
.findViewById(R.id.thank_you_layout);
RelativeLayout thankYouLayout = (RelativeLayout) getActivity().findViewById(R.id.thank_you_layout);
thankYouLayout.setVisibility(View.VISIBLE);
}
@@ -103,6 +118,7 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
timer = new TimerRunnable();
timer.start();
checkAndSwitchToThankYouScreenIfRegattaOver();
checkAndHideCountdownIfRegattaIsInProgress();
}
@Override
@@ -228,7 +244,7 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
private void updateCountdownTimer(long startTime) {
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);
} else {