Beispiel #1
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   HashMap<Integer, Boolean> newStates;
   switch (item.getItemId()) {
     case R.id.action_reload:
       actionReload();
       overflowMenu.dismiss();
       return true;
     case R.id.action_add_favorite:
       actionSave();
       return true;
     case R.id.action_remove_favorite:
       actionDelete();
       return true;
     case R.id.action_share:
       actionShare();
       return true;
     case R.id.action_external:
       actionExternalBrowser();
       return true;
     case R.id.action_back:
       mainWebView.backPressAction(false);
       newStates = new HashMap<Integer, Boolean>();
       newStates.put(R.id.action_back, mainWebView.canGoBack());
       newStates.put(R.id.action_forward, mainWebView.canGoForward());
       BusProvider.getInstance().post(new WebViewUpdateMenuNavigationEvent(newStates));
       return true;
     case R.id.action_forward:
       mainWebView.forwardPressAction();
       newStates = new HashMap<Integer, Boolean>();
       newStates.put(R.id.action_back, mainWebView.canGoBack());
       newStates.put(R.id.action_forward, mainWebView.canGoForward());
       BusProvider.getInstance().post(new WebViewUpdateMenuNavigationEvent(newStates));
       return true; /*
                    case R.id.action_close:
                        overflowMenu.dismiss();*/
     default:
       return super.onOptionsItemSelected(item);
   }
 }
Beispiel #2
0
 private void dismissMenu() {
   if (overflowMenu != null && overflowMenu.isShowing()) {
     overflowMenu.dismiss();
   }
 }