mirror of
				https://github.com/bspeice/UNCCGameDay
				synced 2025-11-04 02:10:35 -05:00 
			
		
		
		
	Add some skeleton code for fetching alerts.
This commit is contained in:
		@ -9,8 +9,33 @@
 | 
				
			|||||||
    tools:context=".Home" >
 | 
					    tools:context=".Home" >
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <TextView
 | 
					    <TextView
 | 
				
			||||||
 | 
					        android:id="@+id/home_label_welcome"
 | 
				
			||||||
        android:layout_width="wrap_content"
 | 
					        android:layout_width="wrap_content"
 | 
				
			||||||
        android:layout_height="wrap_content"
 | 
					        android:layout_height="wrap_content"
 | 
				
			||||||
        android:text="@string/hello_world" />
 | 
					        android:text="@string/hello_world" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <LinearLayout
 | 
				
			||||||
 | 
					        android:id="@+id/home_layout_alerts_root"
 | 
				
			||||||
 | 
					        android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					        android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					        android:layout_alignLeft="@+id/home_label_welcome"
 | 
				
			||||||
 | 
					        android:layout_below="@+id/home_label_welcome"
 | 
				
			||||||
 | 
					        android:orientation="vertical" >
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <TextView
 | 
				
			||||||
 | 
					            android:id="@+id/home_label_recent_alerts"
 | 
				
			||||||
 | 
					            android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					            android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					            android:text="@string/home_label_recent_alerts" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <LinearLayout
 | 
				
			||||||
 | 
					            android:id="@+id/home_layout_alerts"
 | 
				
			||||||
 | 
					            android:layout_width="match_parent"
 | 
				
			||||||
 | 
					            android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					            android:orientation="vertical" >
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        </LinearLayout>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    </LinearLayout>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</RelativeLayout>
 | 
					</RelativeLayout>
 | 
				
			||||||
@ -11,5 +11,6 @@
 | 
				
			|||||||
    <string name="alerts_check_timed">Timed (Reserve Ticket...)</string>
 | 
					    <string name="alerts_check_timed">Timed (Reserve Ticket...)</string>
 | 
				
			||||||
    <string name="alerts_check_organizations">Organizations</string>
 | 
					    <string name="alerts_check_organizations">Organizations</string>
 | 
				
			||||||
    <string name="alerts_check_university">University</string>
 | 
					    <string name="alerts_check_university">University</string>
 | 
				
			||||||
 | 
					    <string name="home_label_recent_alerts">Recent Alerts:</string>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</resources>
 | 
					</resources>
 | 
				
			||||||
 | 
				
			|||||||
@ -18,6 +18,39 @@ public class Alerts extends MenuActivity {
 | 
				
			|||||||
		setContentView(R.layout.activity_alerts);
 | 
							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) {
 | 
						public void onClickTimedAlerts(View view) {
 | 
				
			||||||
		int toastDuration = Toast.LENGTH_SHORT;
 | 
							int toastDuration = Toast.LENGTH_SHORT;
 | 
				
			||||||
		if (((CheckBox) view).isChecked())
 | 
							if (((CheckBox) view).isChecked())
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,30 @@
 | 
				
			|||||||
package com.uncc.gameday.activities;
 | 
					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 {
 | 
					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();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user