diff options
author | Mason Tang <masontang@google.com> | 2010-08-18 16:10:25 -0700 |
---|---|---|
committer | Mason Tang <masontang@google.com> | 2010-08-20 13:54:15 -0700 |
commit | 1df2ca65a852fda463b1d787cd4f81680103b6a2 (patch) | |
tree | e330db83b7666c00c686ced846e345bc6deccec5 /src/com/android/calendar/SearchActivity.java | |
parent | c00ec3b69b75be7f58b97206dae4a7c70114b976 (diff) | |
download | android_packages_apps_Calendar-1df2ca65a852fda463b1d787cd4f81680103b6a2.tar.gz android_packages_apps_Calendar-1df2ca65a852fda463b1d787cd4f81680103b6a2.tar.bz2 android_packages_apps_Calendar-1df2ca65a852fda463b1d787cd4f81680103b6a2.zip |
Added in preliminary action bar support for search
Change-Id: I4b5b0ea40b5ef8b5f193eecf06617291fb7aa18f
Diffstat (limited to 'src/com/android/calendar/SearchActivity.java')
-rw-r--r-- | src/com/android/calendar/SearchActivity.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/com/android/calendar/SearchActivity.java b/src/com/android/calendar/SearchActivity.java index 880c1ad0..4239739d 100644 --- a/src/com/android/calendar/SearchActivity.java +++ b/src/com/android/calendar/SearchActivity.java @@ -46,6 +46,8 @@ import android.provider.Calendar.Events; import android.text.format.Time; import android.util.Log; import android.view.KeyEvent; +import android.view.Menu; +import android.view.MenuItem; import android.view.View; public class SearchActivity extends Activity implements CalendarController.EventHandler { @@ -203,6 +205,36 @@ public class SearchActivity extends Activity implements CalendarController.Event } @Override + public boolean onCreateOptionsMenu(Menu menu) { + super.onCreateOptionsMenu(menu); + getMenuInflater().inflate(R.menu.search_title_bar, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + Time t = null; + switch (item.getItemId()) { + case R.id.action_today: + t = new Time(); + t.setToNow(); + mController.sendEvent(this, EventType.GO_TO, t, null, -1, ViewType.CURRENT); + return true; + case R.id.action_search: + onSearchRequested(); + return true; + case R.id.action_manage_calendars: + mController.sendEvent(this, EventType.LAUNCH_MANAGE_CALENDARS, null, null, 0, 0); + return true; + case R.id.action_settings: + mController.sendEvent(this, EventType.LAUNCH_SETTINGS, null, null, 0, 0); + return true; + default: + return false; + } + } + + @Override protected void onNewIntent(Intent intent) { // From the Android Dev Guide: "It's important to note that when // onNewIntent(Intent) is called, the Activity has not been restarted, |