Created
January 14, 2016 23:56
-
-
Save mgarnerdev/c6bbb48a3d87b9d898d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 Lehi", "3401 Ashton Blvd, Lehi, UT 84043, Lehi, UT", "Ground floor to the right from front doors"), | |
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