Exemplo n.º 1
0
        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));
        }