mirror of
				https://github.com/bspeice/UNCCGameDay
				synced 2025-11-04 02:10:35 -05:00 
			
		
		
		
	Add template Javadocs. Needs actual documentation yet.
This commit is contained in:
		@ -12,40 +12,99 @@ import android.content.Intent;
 | 
			
		||||
import android.support.v4.app.NotificationCompat;
 | 
			
		||||
import android.support.v4.app.TaskStackBuilder;
 | 
			
		||||
 | 
			
		||||
// TODO: Auto-generated Javadoc
 | 
			
		||||
/**
 | 
			
		||||
 * The Class Alert.
 | 
			
		||||
 */
 | 
			
		||||
public class Alert {
 | 
			
		||||
	
 | 
			
		||||
	/** The alarm date. */
 | 
			
		||||
	private Date alarmDate;
 | 
			
		||||
	
 | 
			
		||||
	/** The message. */
 | 
			
		||||
	private String message;
 | 
			
		||||
	
 | 
			
		||||
	/** The shown. */
 | 
			
		||||
	private boolean shown;
 | 
			
		||||
	
 | 
			
		||||
	// Default constructor
 | 
			
		||||
	/**
 | 
			
		||||
	 * Instantiates a new alert.
 | 
			
		||||
	 */
 | 
			
		||||
	public Alert(){}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Instantiates a new alert.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param alarmDate the alarm date
 | 
			
		||||
	 * @param message the message
 | 
			
		||||
	 * @param shown the shown
 | 
			
		||||
	 */
 | 
			
		||||
	public Alert(Date alarmDate, String message, boolean shown) {
 | 
			
		||||
		this.setAlarmDate(alarmDate);
 | 
			
		||||
		this.setMessage(message);
 | 
			
		||||
		this.setShown(shown);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Gets the alarm date.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return the alarm date
 | 
			
		||||
	 */
 | 
			
		||||
	public Date getAlarmDate() {
 | 
			
		||||
		return alarmDate;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Sets the alarm date.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param alarmDate the new alarm date
 | 
			
		||||
	 */
 | 
			
		||||
	public void setAlarmDate(Date alarmDate) {
 | 
			
		||||
		this.alarmDate = alarmDate;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Gets the message.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return the message
 | 
			
		||||
	 */
 | 
			
		||||
	public String getMessage() {
 | 
			
		||||
		return message;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Sets the message.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param message the new message
 | 
			
		||||
	 */
 | 
			
		||||
	public void setMessage(String message) {
 | 
			
		||||
		this.message = message;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Checks if is shown.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return true, if is shown
 | 
			
		||||
	 */
 | 
			
		||||
	public boolean isShown() {
 | 
			
		||||
		return shown;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Sets the shown.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param shown the new shown
 | 
			
		||||
	 */
 | 
			
		||||
	public void setShown(boolean shown) {
 | 
			
		||||
		this.shown = shown;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Display notification.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param ctx the ctx
 | 
			
		||||
	 */
 | 
			
		||||
	public void displayNotification(Context ctx) {
 | 
			
		||||
		NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx)
 | 
			
		||||
			.setSmallIcon(R.drawable.ic_launcher)
 | 
			
		||||
 | 
			
		||||
@ -3,33 +3,69 @@ package com.uncc.gameday.alerts;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
// TODO: Auto-generated Javadoc
 | 
			
		||||
/* Responsible for handling persistence/fetching of alerts */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * The Class AlertDB.
 | 
			
		||||
 */
 | 
			
		||||
public class AlertDB {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Persist.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param a the a
 | 
			
		||||
	 */
 | 
			
		||||
	public void persist(Alert a) {
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Persist multiple.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param alerts the alerts
 | 
			
		||||
	 */
 | 
			
		||||
	public void persistMultiple(List<Alert> alerts) {
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Fetch.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param d the d
 | 
			
		||||
	 * @return the alert
 | 
			
		||||
	 */
 | 
			
		||||
	public Alert fetch(Date d) {
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Fetch multiple.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param dates the dates
 | 
			
		||||
	 * @return the list
 | 
			
		||||
	 */
 | 
			
		||||
	public List<Alert> fetchMultiple(List<Date> dates) {
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Fetch all.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return the list
 | 
			
		||||
	 */
 | 
			
		||||
	public List<Alert> fetchAll() {
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Fetch unread.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return the list
 | 
			
		||||
	 */
 | 
			
		||||
	public List<Alert> fetchUnread() {
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -14,11 +14,21 @@ import android.util.Log;
 | 
			
		||||
 | 
			
		||||
import com.uncc.gameday.R;
 | 
			
		||||
 | 
			
		||||
// TODO: Auto-generated Javadoc
 | 
			
		||||
/**
 | 
			
		||||
 * The Class AlertFetcher.
 | 
			
		||||
 */
 | 
			
		||||
public class AlertFetcher {
 | 
			
		||||
	// Class responsible for fetching all alerts as necessary.
 | 
			
		||||
	
 | 
			
		||||
	/** The max tweets. */
 | 
			
		||||
	private int maxTweets = 5;
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Fetch alerts.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param ctx the ctx
 | 
			
		||||
	 */
 | 
			
		||||
	public void fetchAlerts(Context ctx) {
 | 
			
		||||
		// Fetch all alerts. Responsible for discovering what sources need to be fetched.
 | 
			
		||||
		
 | 
			
		||||
@ -41,6 +51,12 @@ public class AlertFetcher {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Fetch organization alerts.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param ctx the ctx
 | 
			
		||||
	 * @throws TwitterException the twitter exception
 | 
			
		||||
	 */
 | 
			
		||||
	private void fetchOrganizationAlerts(Context ctx) throws TwitterException {
 | 
			
		||||
		// Process fetching organization alerts (alerts retweeted by us)
 | 
			
		||||
		// Will not necessarily fetch `maxTweets` tweets.
 | 
			
		||||
@ -58,6 +74,12 @@ public class AlertFetcher {
 | 
			
		||||
		// List contains all valid alerts now
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Fetch university alerts.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param ctx the ctx
 | 
			
		||||
	 * @throws TwitterException the twitter exception
 | 
			
		||||
	 */
 | 
			
		||||
	private void fetchUniversityAlerts(Context ctx) throws TwitterException {
 | 
			
		||||
		// Process fetching university alerts
 | 
			
		||||
		// Guaranteed to get `maxTweets` tweets
 | 
			
		||||
@ -68,6 +90,12 @@ public class AlertFetcher {
 | 
			
		||||
		// List contains all valid alerts now
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Fetch gameday alerts.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param ctx the ctx
 | 
			
		||||
	 * @throws TwitterException the twitter exception
 | 
			
		||||
	 */
 | 
			
		||||
	private void fetchGamedayAlerts(Context ctx) throws TwitterException {
 | 
			
		||||
		// Process fetching alerts generated by staff of UNCCGameDay
 | 
			
		||||
		// Not guaranteed to get `maxTweets` tweets
 | 
			
		||||
@ -86,6 +114,12 @@ public class AlertFetcher {
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Creates the timed alerts.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param ctx the ctx
 | 
			
		||||
	 * @return the list
 | 
			
		||||
	 */
 | 
			
		||||
	public static List<Alert> createTimedAlerts(Context ctx) {
 | 
			
		||||
		// Create the timed alerts so we can add or remove them from the DB
 | 
			
		||||
		return null;
 | 
			
		||||
 | 
			
		||||
@ -5,13 +5,25 @@ import java.util.List;
 | 
			
		||||
import android.app.IntentService;
 | 
			
		||||
import android.content.Intent;
 | 
			
		||||
 | 
			
		||||
// TODO: Auto-generated Javadoc
 | 
			
		||||
/**
 | 
			
		||||
 * The Class AlertService.
 | 
			
		||||
 */
 | 
			
		||||
public class AlertService extends IntentService {
 | 
			
		||||
	
 | 
			
		||||
	/** The Constant name. */
 | 
			
		||||
	private static final String name = "AlertService";
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Instantiates a new alert service.
 | 
			
		||||
	 */
 | 
			
		||||
	public AlertService() {
 | 
			
		||||
		super(name);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* (non-Javadoc)
 | 
			
		||||
	 * @see android.app.IntentService#onHandleIntent(android.content.Intent)
 | 
			
		||||
	 */
 | 
			
		||||
	@Override
 | 
			
		||||
	protected void onHandleIntent(Intent intent) {
 | 
			
		||||
		// Go fetch all the alerts!
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user