Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getSocialMediaPosts() {
- get twitterPage;
- get instagramPage;
- get facebookPage; // all 3 of these gotten through API
- get announcementList;
- foreach(Tweet tweet in twitterPage) {
- Announcement a = Announcement(tweet);
- announcementList.add(a);
- }
- foreach(InstagramPost post in instagramPage) {
- Announcement a = Announcement(post);
- announcementList.add(a);
- }
- foreach(FacebookPost post in facebookPage) {
- Announcement a = Announcement(post);
- announcementList.add(a);
- }
- }
- displayAnnouncements() {
- get announcementList;
- get separator;
- get displayPanel;
- sortByTimePosted(announementList);
- foreach(int i = 0; i < announcementList.size(); i++) {
- if(i > 0) {
- separator.display(displayPanel);
- }
- announcement.display(displayPanel);
- }
- }
- class Announcement {
- int type; //0 for regular in-app announcement, 1 for tweet, 2 for Instagram post, 3 for Facebook post
- AnnouncementContents content;
- public Announcement(String text) {
- type = 0;
- content = AnnouncementContents(text);
- }
- public Announcement(Tweet tweet) {
- type = 1;
- content = AnnouncementContents(tweet);
- }
- public Announcement(InstagramPost post) {
- type = 2;
- content = AnnouncementContents(post);
- }
- public Announcement(FacebookPost post) {
- type = 3;
- content = AnnouncementContents(post);
- }
- void display(Panel panel) {
- content.display(panel);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement