Handle the internet connection being down.

This commit is contained in:
bspeice 2013-12-04 13:17:37 -05:00
parent 4826a86706
commit a728025eed
4 changed files with 25 additions and 14 deletions

View File

@ -58,4 +58,5 @@
<string name="search_text">Find who else is attending the UNCC football game! \n \nEnter the name of a person or organization into the search bar above.</string> <string name="search_text">Find who else is attending the UNCC football game! \n \nEnter the name of a person or organization into the search bar above.</string>
<string name="button_refresh_alerts">Refresh Alerts</string> <string name="button_refresh_alerts">Refresh Alerts</string>
<string name="title_activity_search_rsvp">RSVP Search</string> <string name="title_activity_search_rsvp">RSVP Search</string>
<string name="internet_down_error">Internet access is currently unavailable.</string>
</resources> </resources>

View File

@ -1,13 +1,15 @@
package com.uncc.gameday.activities; package com.uncc.gameday.activities;
import retrofit.RetrofitError;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.widget.Button; import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.uncc.gameday.R; import com.uncc.gameday.R;
import com.uncc.gameday.registration.Attendee; import com.uncc.gameday.registration.Attendee;
@ -22,7 +24,6 @@ public class Registration extends MenuActivity {
* @see com.uncc.gameday.activities.MenuActivity#onCreate(android.os.Bundle) * @see com.uncc.gameday.activities.MenuActivity#onCreate(android.os.Bundle)
*/ */
private Button b;
private TextView t; private TextView t;
@ -115,8 +116,13 @@ public class Registration extends MenuActivity {
} }
public void run() { public void run() {
RegistrationClient client = new RegistrationClient(c); try {
client.registerAttendee(a); RegistrationClient client = new RegistrationClient(c);
client.registerAttendee(a);
} catch (RetrofitError e) {
Toast.makeText(c, R.string.internet_down_error, Toast.LENGTH_SHORT).show();
Log.e("Registration", e.getLocalizedMessage());
}
} }
} }
} }

View File

@ -2,8 +2,12 @@ package com.uncc.gameday.activities;
import java.util.List; import java.util.List;
import retrofit.RetrofitError;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.uncc.gameday.R; import com.uncc.gameday.R;
import com.uncc.gameday.registration.Attendee; import com.uncc.gameday.registration.Attendee;
@ -28,9 +32,14 @@ public class Search extends MenuActivity {
} }
public void run() { public void run() {
RegistrationClient client = new RegistrationClient(this.c); try {
rsvpList = client.listAttendees(); RegistrationClient client = new RegistrationClient(this.c);
listFetched = true; rsvpList = client.listAttendees();
listFetched = true;
} catch (RetrofitError e) {
Toast.makeText(c, R.string.internet_down_error, Toast.LENGTH_SHORT).show();
Log.e("Search", e.getLocalizedMessage());
}
} }
} }

View File

@ -2,7 +2,6 @@ package com.uncc.gameday.activities.parking;
import android.app.DialogFragment; import android.app.DialogFragment;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -17,7 +16,6 @@ import com.uncc.gameday.parking.ParkingClient;
import com.uncc.gameday.parking.ParkingLot; import com.uncc.gameday.parking.ParkingLot;
import com.uncc.gameday.parking.RatingChoices; import com.uncc.gameday.parking.RatingChoices;
// TODO: Auto-generated Javadoc
/** /**
* The Class LotViewFragment. * The Class LotViewFragment.
*/ */
@ -71,8 +69,6 @@ public class LotViewFragment extends DialogFragment {
view.findViewById(R.id.lotViewSubmitRating).setOnClickListener(new SubmitListener(this)); view.findViewById(R.id.lotViewSubmitRating).setOnClickListener(new SubmitListener(this));
if (view == null)
Log.e("LotViewFragment", "Unable to instantiate view!");
return view; return view;
} }
@ -144,7 +140,6 @@ public class LotViewFragment extends DialogFragment {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
// TODO Auto-generated method stub
f.onSubmitRating(v); f.onSubmitRating(v);
} }
} }