public override bool OnMenuItemClick(IMenuItem menuItem) { if (menuItem.ItemId == Resource.Id.search) { string category = string.Empty; if (tv_blog.Selected) { category = "Blog"; } else if (tv_news.Selected) { if (newsFragment.currentPosition == 0) { category = "Kb"; } else { category = "News"; } System.Diagnostics.Debug.Write("position", newsFragment.currentPosition.ToString()); } else if (tv_question.Selected) { category = "Question"; } else { category = "Blog"; } SearchResultActivity.Enter(category, this); } if (menuItem.ItemId == Resource.Id.add) { if (tv_status.Selected) { AddStatusActivity.Enter(this); } else if (tv_question.Selected) { AddQuestionActivity.Enter(this); } AlertUtil.ToastShort(this, "添加"); } if (menuItem.ItemId == Resource.Id.setting) { if (tv_userCenter.Selected) { SettingActivity.Enter(this); } } return(true); }
public bool OnNavigationItemSelected(IMenuItem menuItem) { if (lastSelecteID != menuItem.ItemId) { switch (menuItem.ItemId) { case Resource.Id.Setting: SettingActivity.Start(this); break; case Resource.Id.Share: sharesWidget.Open(Resources.GetString(Resource.String.open_source_url), Resources.GetString(Resource.String.share_title), Resource.Mipmap.ic_launcher); break; default: SwitchNavigationBar(menuItem.ItemId); toolbar.Title = menuItem.ToString(); break; } } drawerLayout.CloseDrawer(GravityCompat.Start); return true; }
public bool OnNavigationItemSelected(IMenuItem menuItem) { if (lastSelecteID != menuItem.ItemId) { switch (menuItem.ItemId) { case Resource.Id.Setting: SettingActivity.Start(this); break; case Resource.Id.Share: shareAction.Open(); break; default: SwitchNavigationBar(menuItem.ItemId); toolbar.Title = menuItem.ToString(); break; } } drawerLayout.CloseDrawer(GravityCompat.Start); return(true); }
public override bool OnOptionsItemSelected(IMenuItem item) { int id = item.ItemId; switch (id) { case Resource.Id.action_search: StartActivity(new Intent(this, typeof(SearchActivity))); break; case Resource.Id.action_login: if (popupWindow == null) { popupWindow = new LoginPopupWindow(this); popupWindow.setLoginTypeListener(this); } popupWindow.ShowAtLocation(mCommonToolbar, GravityFlags.Center, 0, 0); break; case Resource.Id.action_my_message: if (popupWindow == null) { popupWindow = new LoginPopupWindow(this); popupWindow.setLoginTypeListener(this); } popupWindow.ShowAtLocation(mCommonToolbar, GravityFlags.Center, 0, 0); break; case Resource.Id.action_sync_bookshelf: showDialog(); syncBookShelf(); /* if (popupWindow == null) { * popupWindow = new LoginPopupWindow(this); * popupWindow.setLoginTypeListener(this); * } * popupWindow.showAtLocation(mCommonToolbar, GravityFlags.Center, 0, 0);*/ break; case Resource.Id.action_scan_local_book: ScanLocalBookActivity.startActivity(this); break; case Resource.Id.action_wifi_book: // TODO:WifiBookActivity.startActivity(this); ToastUtils.showSingleToast("等待开发中"); break; case Resource.Id.action_feedback: FeedbackActivity.startActivity(this); break; case Resource.Id.action_night_mode: if (SharedPreferencesUtil.getInstance().getBoolean(Constant.ISNIGHT, false)) { SharedPreferencesUtil.getInstance().putBoolean(Constant.ISNIGHT, false); AppCompatDelegate.DefaultNightMode = (AppCompatDelegate.ModeNightNo); } else { SharedPreferencesUtil.getInstance().putBoolean(Constant.ISNIGHT, true); AppCompatDelegate.DefaultNightMode = (AppCompatDelegate.ModeNightYes); } Recreate(); break; case Resource.Id.action_settings: SettingActivity.startActivity(this); break; default: break; } return(base.OnOptionsItemSelected(item)); }