From 412f894d92afab6e685227c1269580912e3a4838 Mon Sep 17 00:00:00 2001 From: bspeice Date: Thu, 3 Oct 2013 18:35:39 -0400 Subject: [PATCH] Move to a generic Menu activity from which actual App-level functionality will be built. This way, we can program the menus once for all. --- src/com/uncc/gameday/activities/Alerts.java | 31 +---------------- src/com/uncc/gameday/activities/Home.java | 33 +------------------ src/com/uncc/gameday/activities/Parking.java | 20 +---------- .../uncc/gameday/activities/Registration.java | 22 +------------ 4 files changed, 4 insertions(+), 102 deletions(-) diff --git a/src/com/uncc/gameday/activities/Alerts.java b/src/com/uncc/gameday/activities/Alerts.java index 3bf3e6e..042ac62 100644 --- a/src/com/uncc/gameday/activities/Alerts.java +++ b/src/com/uncc/gameday/activities/Alerts.java @@ -1,35 +1,6 @@ package com.uncc.gameday.activities; -import com.uncc.gameday.R; -import android.os.Bundle; -import android.app.Activity; -import android.content.Intent; -import android.view.Menu; -import android.view.MenuItem; +public class Alerts extends MenuActivity { -public class Alerts extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_alerts); - } - - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.alerts, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()){ - case R.id.action_alert_settings: - startActivity(new Intent(this, Alerts.class)); - } - return true; - } } diff --git a/src/com/uncc/gameday/activities/Home.java b/src/com/uncc/gameday/activities/Home.java index 8f63f28..d939aad 100644 --- a/src/com/uncc/gameday/activities/Home.java +++ b/src/com/uncc/gameday/activities/Home.java @@ -1,37 +1,6 @@ package com.uncc.gameday.activities; -import com.uncc.gameday.R; -import com.uncc.gameday.R.layout; -import com.uncc.gameday.R.menu; -import android.os.Bundle; -import android.app.Activity; -import android.content.Intent; -import android.view.Menu; -import android.view.MenuItem; - -public class Home extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_home); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.home, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()){ - case R.id.action_alert_settings: - startActivity(new Intent(this, Alerts.class)); - } - return true; - } +public class Home extends MenuActivity { } diff --git a/src/com/uncc/gameday/activities/Parking.java b/src/com/uncc/gameday/activities/Parking.java index d662d3c..0ddd0e7 100644 --- a/src/com/uncc/gameday/activities/Parking.java +++ b/src/com/uncc/gameday/activities/Parking.java @@ -1,24 +1,6 @@ package com.uncc.gameday.activities; -import com.uncc.gameday.R; -import android.os.Bundle; -import android.app.Activity; -import android.view.Menu; - -public class Parking extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_parking); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.parking, menu); - return true; - } +public class Parking extends MenuActivity { } diff --git a/src/com/uncc/gameday/activities/Registration.java b/src/com/uncc/gameday/activities/Registration.java index 94acdae..dfade64 100644 --- a/src/com/uncc/gameday/activities/Registration.java +++ b/src/com/uncc/gameday/activities/Registration.java @@ -1,26 +1,6 @@ package com.uncc.gameday.activities; -import com.uncc.gameday.R; -import com.uncc.gameday.R.layout; -import com.uncc.gameday.R.menu; -import android.os.Bundle; -import android.app.Activity; -import android.view.Menu; - -public class Registration extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_registration); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.registration, menu); - return true; - } +public class Registration extends MenuActivity { }