Search in sources :

Example 1 with TripEntry

use of garbagecollectors.com.unipool.TripEntry in project UniPool by divya21raj.

the class NewEntryActivity method finalSave.

public void finalSave(View view) throws ParseException {
    switch(checkInvalidEntry()) {
        case 0:
            String entryId = entryDatabaseReference.push().getKey();
            String name = currentUser.getDisplayName();
            System.currentTimeMillis();
            TripEntry tripEntry = new TripEntry(name, entryId, currentUser.getUid(), time, date, source, destination, null);
            finalCurrentUser.getUserTripEntries().put(tripEntry.getEntry_id(), tripEntry);
            entryDatabaseReference.child(entryId).setValue(tripEntry);
            userDatabaseReference.child("userTripEntries").setValue(finalCurrentUser.getUserTripEntries());
            Toast.makeText(this, "TripEntry created!", Toast.LENGTH_SHORT).show();
            finish();
            startActivity(new Intent(this, HomeActivity.class));
            break;
        case 1:
            Toast.makeText(this, "The pickup point and drop location can't be the same, silly!", Toast.LENGTH_SHORT).show();
            break;
        case 2:
            Toast.makeText(this, "The developers are still working on time travel...", Toast.LENGTH_LONG).show();
            break;
        case 3:
            Toast.makeText(this, "Fill in all the details!", Toast.LENGTH_SHORT).show();
            break;
        case 4:
            Toast.makeText(this, "Planning way too ahead of time, eh?", Toast.LENGTH_LONG).show();
            break;
        case 5:
            Toast.makeText(this, "You already have 4 entries, give others a chance too...", Toast.LENGTH_LONG).show();
    }
}
Also used : TripEntry(garbagecollectors.com.unipool.TripEntry) Intent(android.content.Intent)

Aggregations

Intent (android.content.Intent)1 TripEntry (garbagecollectors.com.unipool.TripEntry)1