示例#1
0
  @Subscribe
  public void onOverflowButtonClickEvent(OverflowButtonClickEvent event) {
    if (DDGControlVar.mDuckDuckGoContainer.currentFragmentTag.equals(getTag()) && webMenu != null) {
      if (overflowMenu != null && overflowMenu.isShowing()) {
        return;
      }

      onPrepareOptionsMenu(webMenu);

      overflowMenu = new DDGOverflowMenu(getActivity());
      overflowMenu.setHeaderMenu(headerMenu);
      overflowMenu.setMenu(webMenu);
      overflowMenu.setMenu(mainMenu, true);
      overflowMenu.show(event.anchor);
    }
  }
 private void showMenu(View anchor, FeedObject feed) {
   if (feedMenu == null) {
     feedMenu = new DDGOverflowMenu(context);
   }
   if (!feedMenu.isShowing()) {
     if (DDGApplication.getDB().isSaved(feed.getId())) {
       menu.findItem(R.id.action_add_favorite).setVisible(false);
       menu.findItem(R.id.action_remove_favorite).setVisible(true);
     } else {
       menu.findItem(R.id.action_add_favorite).setVisible(true);
       menu.findItem(R.id.action_remove_favorite).setVisible(false);
     }
     feedMenu.setFeed(feed);
     feedMenu.setMenu(menu);
     feedMenu.showFeedMenu(anchor);
   }
 }
示例#3
0
  @Subscribe
  public void onWebViewOpenMenuEvent(WebViewOpenMenuEvent event) {
    if (webMenu != null) {

      onPrepareOptionsMenu(webMenu);

      if (overflowMenu != null && overflowMenu.isShowing()) {
        return;
      }

      overflowMenu = new DDGOverflowMenu(getActivity());
      overflowMenu.setHeaderMenu(headerMenu);
      overflowMenu.setMenu(webMenu);
      overflowMenu.setMenu(mainMenu, true);
      overflowMenu.show(event.anchorView);
    }
  }
示例#4
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);
   }
 }
示例#5
0
 private void dismissMenu() {
   if (overflowMenu != null && overflowMenu.isShowing()) {
     overflowMenu.dismiss();
   }
 }