From 188d6e0961da626cde2e65d7c02e5a3c3f7e00ad Mon Sep 17 00:00:00 2001 From: bspeice Date: Fri, 4 Oct 2013 21:17:50 -0400 Subject: [PATCH] Add some skeleton code for fetching alerts. --- res/layout/activity_home.xml | 27 ++++++++++++++++- res/values/strings.xml | 1 + src/com/uncc/gameday/activities/Alerts.java | 33 +++++++++++++++++++++ src/com/uncc/gameday/activities/Home.java | 25 +++++++++++++++- 4 files changed, 84 insertions(+), 2 deletions(-) diff --git a/res/layout/activity_home.xml b/res/layout/activity_home.xml index 0d504af..99dc975 100644 --- a/res/layout/activity_home.xml +++ b/res/layout/activity_home.xml @@ -9,8 +9,33 @@ tools:context=".Home" > - + + + + + + + + + + + \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 7ed3a92..20af5f9 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -11,5 +11,6 @@ Timed (Reserve Ticket...) Organizations University + Recent Alerts: diff --git a/src/com/uncc/gameday/activities/Alerts.java b/src/com/uncc/gameday/activities/Alerts.java index f33e662..a7a7a94 100644 --- a/src/com/uncc/gameday/activities/Alerts.java +++ b/src/com/uncc/gameday/activities/Alerts.java @@ -18,6 +18,39 @@ public class Alerts extends MenuActivity { setContentView(R.layout.activity_alerts); } + public void fetchAlerts() { + // Fetch all alerts. Responsible for discovering what sources need to be fetched. + + if (((CheckBox)findViewById(R.id.alerts_check_timed)).isChecked()) + // Fetch timed alerts + this.fetchTimedAlerts(); + else if (((CheckBox)findViewById(R.id.alerts_check_organizations)).isChecked()) + // Fetch organization alerts + this.fetchOrganizationAlerts(); + else if (((CheckBox)findViewById(R.id.alerts_check_university)).isChecked()) + // Fetch university alerts + this.fetchUniversityAlerts(); + + // And always fetch alerts made by us. Period. + this.fetchGamedayAlerts(); + } + + private void fetchTimedAlerts() { + // Process the rules for all timed alerts. + } + + private void fetchOrganizationAlerts() { + // Process fetching organization alerts (alerts retweeted by us) + } + + private void fetchUniversityAlerts() { + // Process fetching university alerts + } + + private void fetchGamedayAlerts() { + // Process fetching alerts generated by staff of UNCCGameDay + } + public void onClickTimedAlerts(View view) { int toastDuration = Toast.LENGTH_SHORT; if (((CheckBox) view).isChecked()) diff --git a/src/com/uncc/gameday/activities/Home.java b/src/com/uncc/gameday/activities/Home.java index 54c11a4..8fcb067 100644 --- a/src/com/uncc/gameday/activities/Home.java +++ b/src/com/uncc/gameday/activities/Home.java @@ -1,7 +1,30 @@ package com.uncc.gameday.activities; +import java.util.List; +import twitter4j.Status; +import twitter4j.Twitter; +import twitter4j.TwitterException; +import twitter4j.TwitterFactory; + +import android.content.Context; +import android.os.Bundle; + +import com.uncc.gameday.R; public class Home extends MenuActivity { - + + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_home); + + Context ctx = getApplicationContext(); + + } + + private void getRecentAlerts() { + // Responsible for discovering what the most recent alerts are and showing them. + // Likely should be implemented by querying a local DB of alerts, grabbing recent 20. + new Alerts().fetchAlerts(); + } }