Пример #1
0
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menuInfo.toString();

    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    final Cursor show =
        getActivity()
            .getContentResolver()
            .query(
                Shows.buildShowUri(String.valueOf(info.id)),
                new String[] {Shows.FAVORITE, Shows.HIDDEN},
                null,
                null,
                null);
    show.moveToFirst();
    if (show.getInt(0) == 0) {
      menu.add(0, CONTEXT_FAVORITE_ID, 2, R.string.context_favorite);
    } else {
      menu.add(0, CONTEXT_UNFAVORITE_ID, 2, R.string.context_unfavorite);
    }
    if (show.getInt(1) == 0) {
      menu.add(0, CONTEXT_HIDE_ID, 3, R.string.context_hide);
    } else {
      menu.add(0, CONTEXT_UNHIDE_ID, 3, R.string.context_unhide);
    }
    show.close();

    menu.add(0, CONTEXT_CHECKIN_ID, 0, R.string.checkin);
    menu.add(0, CONTEXT_FLAG_NEXT_ID, 1, R.string.context_marknext);
    menu.add(0, CONTEXT_MANAGE_LISTS_ID, 4, R.string.list_item_manage);
    menu.add(0, CONTEXT_UPDATE_ID, 5, R.string.context_updateshow);
    menu.add(0, CONTEXT_DELETE_ID, 6, R.string.delete_show);
  }
Пример #2
0
  /** {@inheritDoc} */
  @Override
  public void onCreateContextMenu(
      final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    // Get the position of the selected item
    final AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    mSelectedPosition = info.position;
    // Creat a new song
    mSong = mAdapter.getItem(mSelectedPosition);
    mSelectedId = Long.valueOf(mSong.mSongId);
    mSongName = mSong.mSongName;
    mAlbumName = mSong.mAlbumName;
    mArtistName = mSong.mArtistName;

    // Play the song
    menu.add(
        GROUP_ID,
        FragmentMenuItems.PLAY_SELECTION,
        Menu.NONE,
        getString(R.string.context_menu_play_selection));

    // Add the song to the queue
    menu.add(GROUP_ID, FragmentMenuItems.ADD_TO_QUEUE, Menu.NONE, getString(R.string.add_to_queue));

    // Add the song to a playlist
    final SubMenu subMenu =
        menu.addSubMenu(
            GROUP_ID, FragmentMenuItems.ADD_TO_PLAYLIST, Menu.NONE, R.string.add_to_playlist);
    MusicUtils.makePlaylistMenu(getSherlockActivity(), GROUP_ID, subMenu, true);

    // View more content by the song artist
    menu.add(
        GROUP_ID,
        FragmentMenuItems.MORE_BY_ARTIST,
        Menu.NONE,
        getString(R.string.context_menu_more_by_artist));

    // Make the song a ringtone
    menu.add(
        GROUP_ID,
        FragmentMenuItems.USE_AS_RINGTONE,
        Menu.NONE,
        getString(R.string.context_menu_use_as_ringtone));

    // Delete the song
    menu.add(
        GROUP_ID, FragmentMenuItems.DELETE, Menu.NONE, getString(R.string.context_menu_delete));
  }
 /* (non-Javadoc)
  * @see android.support.v4.app.Fragment#onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo)
  */
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, v, menuInfo);
   getActivity().getMenuInflater().inflate(R.menu.channel_list_context, menu);
 }
Пример #4
0
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, v, menuInfo);
   menu.add("Remove");
   menu.add("Configure");
 }