// 1. Creamos el Context Menu
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    getMenuInflater().inflate(R.menu.menu_context_menu, menu);
    menu.setHeaderTitle("Cambiar Fondo de pantalla");
  }
  @Override
  public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo info) {
    super.onCreateContextMenu(menu, view, info);
    final int viewId = view.getId();

    if (viewId == R.id.type) {
      for (final int typeOne : types) {
        menu.add(viewId, typeOne, 0, cgBase.logTypes2.get(typeOne));
        Log.w(cgSettings.tag, "Addig " + typeOne + " " + cgBase.logTypes2.get(typeOne));
      }
    } else if (viewId == R.id.changebutton) {
      final int textId = ((TextView) findViewById(viewId)).getId();

      menu.setHeaderTitle(res.getString(R.string.log_tb_changeall));
      for (final int logTbAction : cgBase.logTypesTrackable.keySet()) {
        menu.add(textId, logTbAction, 0, cgBase.logTypesTrackable.get(logTbAction));
      }
    } else {
      final int realViewId = ((LinearLayout) findViewById(viewId)).getId();

      for (final cgTrackableLog tb : trackables) {
        if (tb.id == realViewId) {
          menu.setHeaderTitle(tb.name);
        }
      }
      for (final int logTbAction : cgBase.logTypesTrackable.keySet()) {
        menu.add(realViewId, logTbAction, 0, cgBase.logTypesTrackable.get(logTbAction));
      }
    }
  }
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo info) {
    super.onCreateContextMenu(menu, v, info);

    boolean multi_data = handler.hasMultiSelectData();
    AdapterContextMenuInfo _info = (AdapterContextMenuInfo) info;
    selected_list_item = handler.getData(_info.position);

    if (flmg.isDirectory(selected_list_item)) {
      menu.setHeaderTitle("Folder operations");
      menu.add(0, D_MENU_DELETE, 0, "Delete Folder");
      menu.add(0, D_MENU_RENAME, 0, "Rename Folder");
      menu.add(0, D_MENU_COPY, 0, "Copy Folder");
      menu.add(0, D_MENU_ZIP, 0, "Zip Folder");
      menu.add(0, D_MENU_PASTE, 0, "Paste into folder").setEnabled(holding_file || multi_data);
      menu.add(0, D_MENU_UNZIP, 0, "Extract here").setEnabled(holding_zip);

    } else {
      menu.setHeaderTitle("File Operations");
      menu.add(0, F_MENU_DELETE, 0, "Delete File");
      menu.add(0, F_MENU_RENAME, 0, "Rename File");
      menu.add(0, F_MENU_COPY, 0, "Copy File");
      menu.add(0, F_MENU_ATTACH, 0, "Email File");
    }
  }
  @Override
  public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo info) {
    super.onCreateContextMenu(menu, view, info);
    final int viewId = view.getId();

    if (viewId == R.id.type) {
      for (final LogType typeOne : possibleLogTypes) {
        menu.add(viewId, typeOne.id, 0, typeOne.getL10n());
        Log.w("Adding " + typeOne + " " + typeOne.getL10n());
      }
    } else if (viewId == R.id.changebutton) {
      final int textId = ((TextView) findViewById(viewId)).getId();

      menu.setHeaderTitle(res.getString(R.string.log_tb_changeall));
      for (LogTypeTrackable logType : LogTypeTrackable.values()) {
        menu.add(textId, logType.id, 0, res.getString(logType.resourceId));
      }
    } else {
      final int realViewId = ((LinearLayout) findViewById(viewId)).getId();

      for (final cgTrackableLog tb : trackables) {
        if (tb.id == realViewId) {
          menu.setHeaderTitle(tb.name);
        }
      }
      for (LogTypeTrackable logType : LogTypeTrackable.values()) {
        menu.add(realViewId, logType.id, 0, res.getString(logType.resourceId));
      }
    }
  }
Exemple #5
0
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, v, menuInfo);
   switch (v.getId()) {
     case R.id.btn:
       menu.setHeaderTitle("Countries");
       listOfCoun = locationGet.getCountry();
       for (int i = 0; i < listOfCoun.size(); i++) {
         menu.add(0, v.getId(), 0, listOfCoun.get(i));
       }
       break;
     case R.id.btn2:
       menu.setHeaderTitle("Provinces/Territories");
       listOfProv = locationGet.getProvinces(setCoun);
       for (int i = 0; i < listOfProv.size(); i++) {
         menu.add(0, v.getId(), 0, listOfProv.get(i));
       }
       break;
     case R.id.btn3:
       menu.setHeaderTitle("Cities");
       listOfCity = locationGet.getCity(setProv);
       for (int i = 0; i < listOfCity.size(); i++) {
         menu.add(0, v.getId(), 0, listOfCity.get(i));
       }
       break;
   }
 }
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    if (v.getId() == R.id.layout_apps_list) {
      final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
      Application app = listApps.get(info.position);
      if (app.getName() == null) {
        menu.setHeaderTitle("Unknown application");
      } else {
        menu.setHeaderTitle(app.getName());
      }
      MenuItem menuItem = menu.add(Menu.NONE, MENUITEM_DETAILS, MENUITEM_DETAILS, "Details");
      menuItem.setOnMenuItemClickListener(
          new OnMenuItemClickListener() {

            @Override
            public boolean onMenuItemClick(MenuItem item) {
              editApplication(info.position);
              return true;
            }
          });
      menuItem = menu.add(Menu.NONE, MENUITEM_DELETE, MENUITEM_DELETE, "Delete");
      menuItem.setOnMenuItemClickListener(
          new OnMenuItemClickListener() {

            @Override
            public boolean onMenuItemClick(MenuItem item) {
              deleteApplication(info.position);
              return true;
            }
          });
    }
  }
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {

    super.onCreateContextMenu(menu, v, menuInfo);

    ExpandableListView.ExpandableListContextMenuInfo info =
        (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;

    int type = ExpandableListView.getPackedPositionType(info.packedPosition);

    int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);

    int child = ExpandableListView.getPackedPositionChild(info.packedPosition);

    Cursor parentCursor =
        ((MyExpandableListAdapter) expandableListView.getExpandableListAdapter()).getCursor();
    parentCursor.moveToPosition(group);

    selectedParentRowId =
        parentCursor.getString(parentCursor.getColumnIndexOrThrow(FoodsWeightDBAdapter.KEY_ROWID));
    selectedParentName =
        parentCursor.getString(parentCursor.getColumnIndexOrThrow(FoodsWeightDBAdapter.KEY_NAME));

    // Create a context menu for child items
    if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
      Cursor childCursor =
          ((MyExpandableListAdapter) expandableListView.getExpandableListAdapter())
              .getChildrenCursor(parentCursor);
      childCursor.moveToPosition(child);

      selectedChildRowId =
          parentCursor.getString(childCursor.getColumnIndexOrThrow(FoodsWeightDBAdapter.KEY_ROWID));
      selectedChildName =
          childCursor.getString(childCursor.getColumnIndexOrThrow(FoodsWeightDBAdapter.KEY_NAME));
      selectedChildGlass =
          childCursor.getString(childCursor.getColumnIndexOrThrow(FoodsWeightDBAdapter.KEY_GLASS));
      selectedChildSpoon =
          childCursor.getString(childCursor.getColumnIndexOrThrow(FoodsWeightDBAdapter.KEY_SPOON));
      selectedChildPcs =
          childCursor.getString(childCursor.getColumnIndexOrThrow(FoodsWeightDBAdapter.KEY_PCS));

      menu.setHeaderTitle(
          "<<" + selectedParentName + ">>" + Character.toString((char) 10) + selectedChildName);

      for (int i = 0; i < menuItems.length; i++) {
        menu.add(Menu.NONE, i, i, menuItems[i]);
      }
    }

    if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {

      selectedChildRowId = "-1";
      Log.i(getTag(), "group = " + group + " child = " + child);
      menu.setHeaderTitle(selectedParentName);

      for (int i = 0; i < menuItems.length; i++) {
        menu.add(Menu.NONE, i, i, menuItems[i]);
      }
    }
  }
 /**
  * @see android.app.Activity#onCreateContextMenu(android.view.ContextMenu, android.view.View,
  *     android.view.ContextMenu.ContextMenuInfo)
  */
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   if (v.getId() == R.id.query_history_all) {
     menu.setHeaderTitle(Preferences.getText(this, "履歴の編集"));
     menu.add(0, MENU_ITEM_DELETE, 1, "削除");
     menu.add(0, MENU_ITEM_CANCEL, 2, "キャンセル");
   } else if (v.getId() == R.id.query_history_location) {
     menu.setHeaderTitle(Preferences.getText(this, "目的地の編集"));
     menu.add(0, MENU_ITEM_SET_FROM, 1, "出発地に設定");
     menu.add(0, MENU_ITEM_SET_TO, 2, "到着地に設定");
     menu.add(0, MENU_ITEM_CANCEL, 3, "キャンセル");
   }
 }
  @Override
  public void onCreateContextMenu(
      final ContextMenu menu, final View view, final ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, view, menuInfo);
    if (view == cacheLimitTextView) {
      for (final SpannableString string : ContentUtils.cacheSizeStrings) {
        menu.add(string).setActionView(view);
      }
      menu.setHeaderTitle(ContentUtils.getCenteredString(setCacheSizeText));
    } else if (view.getId() == listView.getId()) {
      final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
      final ContentItem content = contentListItems.getItem(info.position).getContentItem();

      if (ContentState.REMOTE_DIRECTORY.equals(content.getContentState())) {
        menu.add(R.string.user_files_browser_context_menu_delete).setActionView(view);
      } else {
        final ContentState contentState = content.getContentState();
        final boolean isNewerVersionAvailable =
            ContentState.isCachedWithNewerVersionAvailableOrTransferring(contentState);
        final boolean isCached = contentState == ContentState.CACHED || isNewerVersionAvailable;
        final boolean isPinned = userFileManager.isContentPinned(content.getFilePath());

        // if item is downloaded
        if (isCached) {
          menu.add(getString(R.string.content_context_menu_open)).setActionView(view);
        } else {
          menu.add(R.string.content_context_menu_open_remote).setActionView(view);
          menu.add(getString(R.string.content_context_menu_download)).setActionView(view);
        }
        if (isNewerVersionAvailable) {
          menu.add(getString(R.string.content_context_menu_download_latest)).setActionView(view);
        }
        if (isCached && !isPinned) {
          menu.add(getString(R.string.content_context_menu_pin)).setActionView(view);
        }
        if (!isCached) {
          menu.add(getString(R.string.content_context_menu_download_pin)).setActionView(view);
        }
        if (isPinned) {
          menu.add(getString(R.string.content_context_menu_unpin)).setActionView(view);
        }
        if (isCached) {
          menu.add(getString(R.string.content_context_menu_delete_local)).setActionView(view);
        }
        menu.add(R.string.user_files_browser_context_menu_delete).setActionView(view);
      }
      menu.setHeaderTitle(content.getFilePath());
    }
  }
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   if (navigationPossible()) {
     menu.setHeaderTitle(res.getString(R.string.cache_menu_navigate));
     addNavigationMenuItems(menu);
   }
 }
Exemple #11
0
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;

    int actualPos = info.position - tagListView.getHeaderViewsCount();
    if (actualPos < 0) return;
    Tag tagClicked = tags.getTags().get(actualPos);

    // Log.i("occm", tagClicked.getParent_id() + " " +
    // tagClicked.getComment().toString());

    String userId = tagInfo.getString("user_id", "error");

    boolean isOwnTag = (tagClicked.getUser_id().equals(userId));

    menu.setHeaderTitle(R.string.context_menu_header);
    menu.add(0, v.getId(), 6, R.string.context_menu_reply);
    if (!tagClicked.getParent_id().equals("0")) {
      menu.add(0, v.getId(), 5, R.string.context_menu_show_orig);
    }
    if (isOwnTag) return;

    if (!tagClicked.getIs_thumbedup()) menu.add(0, v.getId(), 1, R.string.context_menu_thumbup);

    if (Session.getFollowerSet().contains(tagClicked.getUser_id()))
      menu.add(0, v.getId(), 3, R.string.context_menu_unfollow);
    else menu.add(0, v.getId(), 4, R.string.context_menu_follow);
  }
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, v, menuInfo);
   menu.setHeaderTitle("Choose");
   menu.add(Menu.NONE, 1, 0, "Copy");
   menu.add(Menu.NONE, 2, 1, "Share");
 }
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    final SipProfile account = profileFromContextMenuInfo(menuInfo);
    if (account == null) {
      return;
    }
    WizardInfo wizardInfos = WizardUtils.getWizardClass(account.wizard);

    // Setup the menu header
    menu.setHeaderTitle(account.display_name);
    if (wizardInfos != null) {
      menu.setHeaderIcon(wizardInfos.icon);
    }

    menu.add(
        0,
        MENU_ITEM_ACTIVATE,
        0,
        account.active ? R.string.deactivate_account : R.string.activate_account);
    menu.add(0, MENU_ITEM_MODIFY, 0, R.string.modify_account);
    menu.add(0, MENU_ITEM_DELETE, 0, R.string.delete_account);
    if (!VoXMobile.isVoXMobile(account.proxies)) {
      menu.add(0, MENU_ITEM_WIZARD, 0, R.string.choose_wizard);
    }
  }
  protected void createFileMenu(final ContextMenu menu, final String path) {
    final BookSettings bs = SettingsManager.getBookSettings(path);
    final MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.book_menu, menu);
    menu.setHeaderTitle(path);
    menu.findItem(R.id.bookmenu_recentgroup).setVisible(bs != null);
    menu.findItem(R.id.bookmenu_openbookshelf).setVisible(false);
    menu.findItem(R.id.bookmenu_openbookfolder).setVisible(false);

    final MenuItem om = menu.findItem(R.id.bookmenu_open);
    final SubMenu osm = om != null ? om.getSubMenu() : null;
    if (osm == null) {
      return;
    }
    osm.clear();

    final List<Bookmark> list = new ArrayList<Bookmark>();
    list.add(new Bookmark(true, getString(R.string.bookmark_start), PageIndex.FIRST, 0, 0));
    list.add(new Bookmark(true, getString(R.string.bookmark_end), PageIndex.LAST, 0, 1));
    if (bs != null) {
      if (LengthUtils.isNotEmpty(bs.bookmarks)) {
        list.addAll(bs.bookmarks);
      }
      list.add(
          new Bookmark(
              true, getString(R.string.bookmark_current), bs.currentPage, bs.offsetX, bs.offsetY));
    }

    Collections.sort(list);
    for (final Bookmark b : list) {
      addBookmarkMenuItem(osm, b);
    }
  }
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo;

    XboxLiveFriendListItem item = (XboxLiveFriendListItem) acmi.targetView;
    ViewHolder vh = (ViewHolder) acmi.targetView.getTag();
    menu.setHeaderTitle(vh.gamertag.getText());

    getActivity().getMenuInflater().inflate(R.menu.xbl_friend_list_context, menu);

    int statusCode = Friends.getStatusCode(getActivity(), item.mFriendId);

    if (statusCode == XboxLive.STATUS_INVITE_RCVD) {
      menu.setGroupVisible(R.id.menu_group_invite_rcvd, true);
      menu.setGroupVisible(R.id.menu_group_invite_sent, false);
      menu.setGroupVisible(R.id.menu_group_friend, false);
      menu.setGroupVisible(R.id.menu_group_gold, false);
    } else if (statusCode == XboxLive.STATUS_INVITE_SENT) {
      menu.setGroupVisible(R.id.menu_group_invite_rcvd, false);
      menu.setGroupVisible(R.id.menu_group_invite_sent, true);
      menu.setGroupVisible(R.id.menu_group_friend, false);
      menu.setGroupVisible(R.id.menu_group_gold, false);
    } else {
      menu.setGroupVisible(R.id.menu_group_invite_rcvd, false);
      menu.setGroupVisible(R.id.menu_group_invite_sent, false);
      menu.setGroupVisible(R.id.menu_group_friend, true);
      menu.setGroupVisible(R.id.menu_group_gold, mAccount.isGold());
    }
  }
  public void onCreateContextMenu(ContextMenu menu) {
    super.onCreateContextMenu(menu);

    menu.setHeaderTitle("MyImage Menu");
    menu.add(0, 100, 0, "이미지 회전");
    menu.add(0, 101, 0, "크기 변경");
  }
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    if (v.getId() == R.id.uuid_list_view_tango_space) {
      menu.setHeaderTitle(mTangoSpaceAdfDataList.get(info.position).uuid);
      menu.add(mTangoSpaceMenuStrings[0]);
      menu.add(mTangoSpaceMenuStrings[1]);
      menu.add(mTangoSpaceMenuStrings[2]);
    }

    if (v.getId() == R.id.uuid_list_view_application_space) {
      menu.setHeaderTitle(mAppSpaceAdfDataList.get(info.position).uuid);
      menu.add(mAppSpaceMenuStrings[0]);
      menu.add(mAppSpaceMenuStrings[1]);
    }
  }
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, v, menuInfo);
   menu.setHeaderTitle("select action");
   menu.add(0, v.getId(), 0, "update");
   menu.add(0, v.getId(), 0, "delete");
 }
Exemple #19
0
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, v, menuInfo);
   MenuInflater inflater = getMenuInflater();
   inflater.inflate(R.menu.cardeletemenu, menu);
   menu.setHeaderTitle("Delete Car?");
 }
Exemple #20
0
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   MenuInflater inflater = mCoolReader.getMenuInflater();
   menu.clear();
   inflater.inflate(
       mList.isShortcutMode()
           ? R.menu.cr3_bookmark_shortcut_context_menu
           : R.menu.cr3_bookmark_context_menu,
       menu);
   AdapterContextMenuInfo mi = (AdapterContextMenuInfo) menuInfo;
   if (mi != null) selectedItem = mi.position;
   Bookmark bm = mList.getSelectedBookmark();
   menu.setHeaderTitle(getContext().getString(R.string.context_menu_title_bookmark));
   for (int i = 0; i < menu.size(); i++) {
     MenuItem menuItem = menu.getItem(i);
     if (menuItem.getItemId() == R.id.bookmark_shortcut_goto
         || menuItem.getItemId() == R.id.bookmark_edit
         || menuItem.getItemId() == R.id.bookmark_delete) menuItem.setEnabled(bm != null);
     if (menuItem.getItemId() == R.id.bookmark_edit)
       menuItem.setEnabled(
           bm != null
               && (bm.getType() == Bookmark.TYPE_COMMENT
                   || bm.getType() == Bookmark.TYPE_CORRECTION));
     menuItem.setOnMenuItemClickListener(
         new OnMenuItemClickListener() {
           public boolean onMenuItemClick(MenuItem item) {
             onContextItemSelected(item);
             return true;
           }
         });
   }
 }
Exemple #21
0
  @Override
  public ContextMenuSubject getSubject(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
    ContextMenuSubject subject = null;

    if (!(menuInfo instanceof AdapterView.AdapterContextMenuInfo)) {
      Log.e(LOGTAG, "menuInfo is not AdapterContextMenuInfo");
      return subject;
    }

    ListView list = (ListView) view;
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    subject = ((AwesomeBarItem) list.getItemAtPosition(info.position)).getSubject();

    if (subject == null) return subject;

    MenuInflater inflater = new MenuInflater(mContext);
    inflater.inflate(R.menu.awesomebar_contextmenu, menu);
    menu.findItem(R.id.remove_bookmark).setVisible(false);
    menu.findItem(R.id.edit_bookmark).setVisible(false);
    menu.findItem(R.id.open_in_reader).setVisible(subject.display == Combined.DISPLAY_READER);

    // Hide "Remove" item if there isn't a valid history ID
    if (subject.id < 0) menu.findItem(R.id.remove_history).setVisible(false);

    menu.setHeaderTitle(subject.title);
    return subject;
  }
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   // TODO Auto-generated method stub
   super.onCreateContextMenu(menu, v, menuInfo);
   getActivity().getMenuInflater().inflate(R.menu.set_profile_picture, menu);
   menu.setHeaderTitle("Set a profile picture");
 }
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, v, menuInfo);
   menu.setHeaderTitle("Select The Action");
   menu.add(0, v.getId(), 0, "Call");
   menu.add(0, v.getId(), 0, "Send SMS");
 }
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, v, menuInfo);
   menu.setHeaderTitle("Select action");
   menu.add(1, 1001, 1, "Call");
   menu.add(1, 1002, 2, "SMS");
 }
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    itemposition = info.position;
    if (itemposition > 0) itemposition--; // hay que restar 1 porque la lista tiene un header

    Comment comment = listaComments.get(itemposition);
    // Cuando pulsamos nos aparece como título la fecha y la hora para saber cual seleccionamos
    final int MAXLENGHT = 10;
    String txt = comment.getTxt();
    if (txt.length() > MAXLENGHT) { // truncamos por la longitud maxima
      txt = txt.substring(0, MAXLENGHT) + " ...";
    }
    menu.setHeaderTitle(comment.getUsername() + " : \"" + txt + "\"");

    byte[] img = comment.getImage();
    if (img != null) {
      ByteArrayInputStream is = new ByteArrayInputStream(img);
      menu.setHeaderIcon(Drawable.createFromStream(is, "image"));
    }

    // si somos supervaca o somos los dueños del mensaje
    if ((BuildConfig.SUPERAPP) || (comment.getDevid() == Utilidades.getDevId(getActivity()))) {
      menu.add(
          FRAGMENT_GROUPID,
          R.id.action_borrar_comentario,
          0,
          "Borrar comentario"); // podremos borrar
    }
  }
Exemple #26
0
    @Override
    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
      super.onCreateContextMenu(menu, v, menuInfo);

      menu.setHeaderTitle(R.string.codecs_move);
      menu.add(Menu.NONE, MENU_UP, 0, R.string.codecs_move_up);
      menu.add(Menu.NONE, MENU_DOWN, 0, R.string.codecs_move_down);
    }
 // 创建上下文菜单时触发该方法
 @Override
 public void onCreateContextMenu(
     ContextMenu menu, View source, ContextMenu.ContextMenuInfo menuInfo) {
   MenuInflater inflator = new MenuInflater(this);
   // 装填R.menu.context对应的菜单,并添加到menu中
   inflator.inflate(R.menu.context, menu);
   menu.setHeaderTitle("请选择背景色");
 }
  @Override
  public void onCreateContextMenu(
      ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
    getMenuInflater().inflate(R.menu.properties_context_menu, menu);
    menu.setHeaderTitle(R.string.context_title_options);

    super.onCreateContextMenu(menu, view, menuInfo);
  }
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   // TODO Auto-generated method stub
   getMenuInflater().inflate(R.menu.context_history, menu);
   //		menu.add(0, 001, 0,  "刪除");
   menu.setHeaderTitle("要怎麼處理這筆項目?");
   super.onCreateContextMenu(menu, v, menuInfo);
 }
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   Resources res = getResources();
   super.onCreateContextMenu(menu, v, menuInfo);
   menu.setHeaderTitle(res.getString(R.string.menu_context_titulo));
   MenuInflater inflater = getMenuInflater();
   inflater.inflate(R.menu.menu_context_mostrar_lista, menu);
 }