Skip to content

Instantly share code, notes, and snippets.

@mgarnerdev
Created January 14, 2016 23:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mgarnerdev/41ee994ef38c0dd1a5a3 to your computer and use it in GitHub Desktop.
Save mgarnerdev/41ee994ef38c0dd1a5a3 to your computer and use it in GitHub Desktop.
import android.app.Presentation;
import android.content.Context;
import android.location.Location;
import android.provider.CalendarContract;
import android.widget.Toast;
import java.util.ArrayList;
/**
* Created by mgarner on 12/11/2015.
* This class helps with planning and executing meetups.
*/
public class Meetup {
private Context mContext;
private Location mLocation;
private ArrayList<Attendee> mAttendees;
private Presentation mFirstPresentation;
private Presentation mSecondPresentation;
private Presentation mThirdPresentation;
private Presentation mCorePresentation;
private Time mTime;
private Date mDate;
private Food mFood;
private Drinks mDrinks;
public Meetup(Context context, Date date, Time time, Location location, ArrayList<Attendee> attendees, Presentation firstPresentation, Presentation secondPresentation, Presentation thirdPresentation, Presentation corePresentation, Food food, Drinks drinks) {
this.mContext = context;
this.mDate = date;
this.mTime = time;
this.mLocation = location;
this.mAttendees = attendees;
this.mFirstPresentation = firstPresentation;
this.mSecondPresentation = secondPresentation;
this.mThirdPresentation = thirdPresentation;
this.mCorePresentation = corePresentation;
this.mFood = food;
this.mDrinks = drinks;
}
public Happiness startMeetup() {
for (int minuteCounter = 0; minuteCounter < 91; minuteCounter++) {
switch (minuteCounter) {
case 0:
announceTime("6:00pm");
startMeetupWithIntroductions();
for (Attendee attendee : mAttendees) {
attendee.eat(mFood);
attendee.drink(mDrinks);
}
break;
case 15:
announceTime("6:15pm");
startPresentation(mFirstPresentation);
break;
case 25:
announceTime("6:25pm");
startPresentation(mSecondPresentation);
break;
case 35:
announceTime("6:35pm");
startPresentation(mThirdPresentation);
break;
case 45:
announceTime("6:45pm");
startPresentation(mCorePresentation);
break;
}
try {
Thread.sleep(60 * 1000); //Performed on the UI thread to create a sluggish and janky user experience.
} catch (InterruptedException e) {
e.printStackTrace();
}
}
MeetupUtils.socialize(attendees);
Happiness happiness = new Happiness();
for(Attendee attendee : mAttendees){
attendee.addKnowledge();
happiness.giveTo(attendee);
}
return happiness;
}
public void announceTime(String time) {
Toast.makeText(mContext, "It's " + time, Toast.LENGTH_SHORT); //WHY YOU NO WORKZ???
}
public void startPresentation(Presentation presentation) {
Speaker speaker = presentation.getSpeaker();
String topic = presentation.getTopic();
speaker.talksAbout(topic);
speaker.sharesCode();
speaker.answersBriefQuestionsFromAttendees(mAttendees);
for (Attendee attendee : mAttendees) {
attendee.listensTo(presentation);
attendee.learns();
}
}
}
Meetup januaryMeetup = new Meetup(
context,
new Date("January 14th, 2016"),
new Time("18:00", "21:00"),
new Location("Vivint.Solar Lehi", "3301 N Thanksgiving Way Suite 500, Lehi, UT", "Go in the building, up the elevators to the 5th floor"),
new ArrayList<Attendee>(),
new Presentation("Jake Wilson", "Location, Location, Location"),
new Presentation("Bryan Bryce", "Data Binding"),
new Presentation("Cassidy Ellis", "Broadcast Receivers"),
new Presentation("Jacob Moncur", "Kotlin: The Future of Android Development"),
new Food("Pizza"),
new Drinks("Pepsi Products, water, etc.")
);
januaryMeetup.startMeetup(new ArrayList<Attendee>());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment