Further Alert cleanup >AGK

This commit is contained in:
agk512 2013-12-02 03:35:59 -05:00
parent 06f7c7933f
commit ca881b99bd

View File

@ -1,15 +1,10 @@
package com.uncc.gameday.alerts; package com.uncc.gameday.alerts;
import java.util.Date; import java.util.GregorianCalendar;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import twitter4j.Paging;
import twitter4j.Status; import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException; import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.conf.ConfigurationBuilder;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.util.Log; import android.util.Log;
@ -68,7 +63,7 @@ public class AlertFetcher {
// Filter for anything created by us (retweet) // Filter for anything created by us (retweet)
for (Iterator<Status> it = statuses.iterator(); it.hasNext();){ for (Iterator<Status> it = statuses.iterator(); it.hasNext();){
// May need to switch to isRetweetByMe, not sure if // May need to switch to isRetweetByMe, not sure if
// We're using the right function (documentation is awful) // We're using the right function (documentation is awful)
if (!it.next().isRetweet()) if (!it.next().isRetweet())
it.remove(); it.remove();
} }
@ -134,13 +129,15 @@ public class AlertFetcher {
//and persists to database //and persists to database
public void pushToDatabase(List<Status> statuses, String type, Context ctx) public void pushToDatabase(List<Status> statuses, String type, Context ctx)
{ {
AlertDB db = new AlertDB(ctx); GregorianCalendar todayDate = new GregorianCalendar();
Date todayDate = new Date(); long currentDate = todayDate.getTimeInMillis();
todayDate.getTime();
for(int i = 0; i < statuses.size(); i++) AlertDB db = new AlertDB(ctx);
{
Alert temp = new Alert(todayDate, statuses.get(i).getText(), 0, type); for(int i = 0; i < statuses.size(); i++)
db.persist(temp); {
} Alert temp = new Alert(currentDate, statuses.get(i).getText(), 0, type);
db.persist(temp);
}
} }
} }