mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-27 06:17:27 +00:00
TRACKING APP: regatta in progress view
This commit is contained in:
1 parent
265d708689
commit
f34f7bb044
5 files changed
+37
-19
No files matched your search
Binary file not shown.
BIN
Binary file not shown.
@@ -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>
|
||||
+35
-19
@@ -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;
|
||||
@@ -74,6 +69,30 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
|
||||
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() {
|
||||
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 {
|
||||
|
||||
Reference in new issue
Block a user