public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.menu_search_advanced: if (App.Kp2a.CurrentDb == null) { App.Kp2a.CurrentDb = App.Kp2a.OpenDatabases.First(); } Intent i = new Intent(this, typeof(SearchActivity)); AppTask.ToIntent(i); StartActivityForResult(i, 0); return(true); case Resource.Id.menu_lock: App.Kp2a.Lock(); return(true); case Resource.Id.menu_donate: return(Util.GotoDonateUrl(this)); case Resource.Id.menu_app_settings: DatabaseSettingsActivity.Launch(this); return(true); default: break; } return(base.OnOptionsItemSelected(item)); }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.menu_donate: return(Util.GotoDonateUrl(this)); case Resource.Id.menu_lock: App.Kp2a.LockDatabase(); return(true); case Resource.Id.menu_search: case Resource.Id.menu_search_advanced: OnSearchRequested(); return(true); case Resource.Id.menu_app_settings: DatabaseSettingsActivity.Launch(this); return(true); case Resource.Id.menu_sync: Synchronize(); return(true); case Resource.Id.menu_work_offline: App.Kp2a.OfflineMode = App.Kp2a.OfflineModePreference = true; UpdateOfflineModeMenu(); return(true); case Resource.Id.menu_work_online: App.Kp2a.OfflineMode = App.Kp2a.OfflineModePreference = false; UpdateOfflineModeMenu(); Synchronize(); return(true); case Resource.Id.menu_sort: ChangeSort(); return(true); case Android.Resource.Id.Home: //Currently the action bar only displays the home button when we come from a previous activity. //So we can simply Finish. See this page for information on how to do this in more general (future?) cases: //http://developer.android.com/training/implementing-navigation/ancestral.html AppTask.SetActivityResult(this, KeePass.ExitNormal); Finish(); //OverridePendingTransition(Resource.Animation.anim_enter_back, Resource.Animation.anim_leave_back); return(true); } return(base.OnOptionsItemSelected(item)); }