mirror of
				https://github.com/bspeice/UNCCGameDay
				synced 2025-11-03 18:00:43 -05:00 
			
		
		
		
	Add code to rate parking lots, and display their locations.
This commit is contained in:
		@ -1,7 +1,13 @@
 | 
			
		||||
package com.uncc.gameday.activities.parking;
 | 
			
		||||
 | 
			
		||||
import javax.xml.datatype.Duration;
 | 
			
		||||
 | 
			
		||||
import com.uncc.gameday.R;
 | 
			
		||||
import com.uncc.gameday.parking.ParkingChoice;
 | 
			
		||||
import com.uncc.gameday.parking.ParkingClient;
 | 
			
		||||
import com.uncc.gameday.parking.ParkingCoordinate;
 | 
			
		||||
import com.uncc.gameday.parking.ParkingRating;
 | 
			
		||||
import com.uncc.gameday.parking.RatingChoices;
 | 
			
		||||
 | 
			
		||||
import android.app.DialogFragment;
 | 
			
		||||
import android.os.Bundle;
 | 
			
		||||
@ -9,14 +15,20 @@ import android.util.Log;
 | 
			
		||||
import android.view.LayoutInflater;
 | 
			
		||||
import android.view.View;
 | 
			
		||||
import android.view.ViewGroup;
 | 
			
		||||
import android.widget.SeekBar;
 | 
			
		||||
import android.widget.Toast;
 | 
			
		||||
 | 
			
		||||
public class LotViewFragment extends DialogFragment {
 | 
			
		||||
	
 | 
			
		||||
	ParkingChoice pc;
 | 
			
		||||
	
 | 
			
		||||
	public LotViewFragment(){
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private void initializeData(ParkingChoice pc){
 | 
			
		||||
		
 | 
			
		||||
		ParkingClient client = new ParkingClient(this.getActivity());
 | 
			
		||||
		ParkingCoordinate coord = client.listLotLocation(pc).getCoordinate();
 | 
			
		||||
		// Set up the MapView here.
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
@ -31,6 +43,7 @@ public class LotViewFragment extends DialogFragment {
 | 
			
		||||
		else
 | 
			
		||||
			pc = ParkingChoice.BLACK;
 | 
			
		||||
		
 | 
			
		||||
		this.pc = pc;
 | 
			
		||||
		initializeData(pc);
 | 
			
		||||
		
 | 
			
		||||
        View view = inflater.inflate(R.layout.lot_view, container);
 | 
			
		||||
@ -40,5 +53,26 @@ public class LotViewFragment extends DialogFragment {
 | 
			
		||||
        	Log.e("LotViewFragment", "Unable to instantiate view!");
 | 
			
		||||
        return view;
 | 
			
		||||
    }
 | 
			
		||||
	
 | 
			
		||||
	public void onSubmitRating() {
 | 
			
		||||
		// Submit a rating to the server
 | 
			
		||||
		SeekBar bar = (SeekBar)this.getView().findViewById(R.id.lotViewRateLot);
 | 
			
		||||
		int rating = bar.getProgress();
 | 
			
		||||
		// Switch between values of parking rating
 | 
			
		||||
		RatingChoices rc;
 | 
			
		||||
		if (rating < 25)
 | 
			
		||||
			rc = RatingChoices.EMP;
 | 
			
		||||
		else if (rating < 50)
 | 
			
		||||
			rc = RatingChoices.SCT;
 | 
			
		||||
		else if (rating < 75)
 | 
			
		||||
			rc = RatingChoices.BSY;
 | 
			
		||||
		else
 | 
			
		||||
			rc = RatingChoices.FLL;
 | 
			
		||||
		
 | 
			
		||||
		ParkingClient pc = new ParkingClient(this.getActivity());
 | 
			
		||||
		pc.rateLot(rc, this.pc);
 | 
			
		||||
		
 | 
			
		||||
		Toast.makeText(this.getActivity(), "Rating submitted!", Toast.LENGTH_SHORT).show();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user