mirror of
				https://github.com/bspeice/UNCCGameDay
				synced 2025-11-04 02:10:35 -05:00 
			
		
		
		
	Add the new (and tested!) RegistrationClient
This commit is contained in:
		
							
								
								
									
										32
									
								
								src/com/uncc/gameday/registration/RegistrationClient.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/com/uncc/gameday/registration/RegistrationClient.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					package com.uncc.gameday.registration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.uncc.gameday.R;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import android.content.Context;
 | 
				
			||||||
 | 
					import android.util.Log;
 | 
				
			||||||
 | 
					import retrofit.RestAdapter;
 | 
				
			||||||
 | 
					import retrofit.RetrofitError;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class RegistrationClient {
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						private GamedayService gds;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public RegistrationClient(Context c) {
 | 
				
			||||||
 | 
							RestAdapter ra = new RestAdapter.Builder()
 | 
				
			||||||
 | 
								.setServer("http://" + c.getString(R.string.server_hostname))
 | 
				
			||||||
 | 
								.build();
 | 
				
			||||||
 | 
							gds = ra.create(GamedayService.class);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public List<ParkingLot> listLots() {
 | 
				
			||||||
 | 
							try {
 | 
				
			||||||
 | 
								return gds.listLots();
 | 
				
			||||||
 | 
							} catch (RetrofitError e) {
 | 
				
			||||||
 | 
								Log.w("Registration.listLots()", e);
 | 
				
			||||||
 | 
								return null;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user