mirror of
https://github.com/bspeice/UNCCGameDay
synced 2024-11-05 07:38:13 -05:00
Add code to rate parking lots, and display their locations.
This commit is contained in:
parent
7edb481d70
commit
ae548625a3
@ -5,10 +5,52 @@
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:id="@+id/lotViewFilledStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Filled Status:"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lotViewRateLot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Rate Lot:"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lotViewEmpty"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Empty"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/lotViewLotRating"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lotViewFull"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Full"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/lotViewSubmitRating"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Submit Rating"
|
||||
android:onClick="onSubmitRating" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user