当前位置: 首页>>代码示例>>Java>>正文


Java ContextMenu.findItem方法代码示例

本文整理汇总了Java中android.view.ContextMenu.findItem方法的典型用法代码示例。如果您正苦于以下问题:Java ContextMenu.findItem方法的具体用法?Java ContextMenu.findItem怎么用?Java ContextMenu.findItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.ContextMenu的用法示例。


在下文中一共展示了ContextMenu.findItem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo)
{
	super.onCreateContextMenu(menu, view, menuInfo);

	MenuInflater inflater = getMenuInflater();
	if (Util.isOffline(this)) inflater.inflate(R.menu.select_playlist_context_offline, menu);
	else inflater.inflate(R.menu.select_playlist_context, menu);

	MenuItem downloadMenuItem = menu.findItem(R.id.album_menu_download);

	if (downloadMenuItem != null)
	{
		downloadMenuItem.setVisible(!Util.isOffline(this));
	}
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:17,代码来源:SelectPlaylistActivity.java

示例2: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
public void onCreateContextMenu(ContextMenu menu, View v,
		ContextMenuInfo menuInfo) {
	super.onCreateContextMenu(menu, v, menuInfo);

	MenuInflater inflater = getMenuInflater();
	inflater.inflate(R.menu.volume_list_context, menu);

	// Change the text of the lock/unlock item based on volume status
	AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
	EDVolume selected = mAdapter.getItem((int) info.id);

	MenuItem lockItem = menu.findItem(R.id.volume_list_menu_lock);

	if (selected.isLocked()) {
		lockItem.setTitle(getString(R.string.menu_unlock_volume));
	} else {
		lockItem.setTitle(getString(R.string.menu_lock_volume));
	}
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:20,代码来源:EDVolumeListActivity.java

示例3: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
	public void onCreateContextMenu(ContextMenu menu, View v,
			ContextMenuInfo menuInfo) {
		super.onCreateContextMenu(menu, v, menuInfo);
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.volume_browser_context, menu);
//		if (!this.mEDVolume.getFileProvider().allowRemoteCopy()){
//			MenuItem MenuItem =(MenuItem )menu.findItem(R.id.volume_browser_menu_copy);
//			MenuItem.setVisible(false);
//		}
		
		  AdapterView.AdapterContextMenuInfo info =
		            (AdapterView.AdapterContextMenuInfo) menuInfo;

		  int pos = info.position;
		  
		  EDFileChooserItem selectedFile = mCurFileList.get(pos-1);
		  MenuItem MenuItem =(MenuItem )menu.findItem(R.id.volume_browser_generage_thumbnail);
		  if (selectedFile != null && (MimeManagement.isImage(selectedFile.getName()) || MimeManagement.isVideo(selectedFile.getName()))){
			  MenuItem.setVisible(true);
		  } else {
			  MenuItem.setVisible(false);
		  }
		
	}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:26,代码来源:EDVolumeBrowserActivity.java

示例4: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo)
{
	super.onCreateContextMenu(menu, view, menuInfo);
	AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;

	MusicDirectory.Entry entry = (MusicDirectory.Entry) albumListView.getItemAtPosition(info.position);

	if (entry != null && entry.isDirectory())
	{
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.select_album_context, menu);
	}

	shareButton = menu.findItem(R.id.menu_item_share);

	if (shareButton != null)
	{
		shareButton.setVisible(!Util.isOffline(this));
	}

	MenuItem downloadMenuItem = menu.findItem(R.id.album_menu_download);

	if (downloadMenuItem != null)
	{
		downloadMenuItem.setVisible(!Util.isOffline(this));
	}
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:29,代码来源:SelectAlbumActivity.java

示例5: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo)
{
	super.onCreateContextMenu(menu, view, menuInfo);

	AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;

	if (artistListView.getItemAtPosition(info.position) instanceof Artist)
	{
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.select_artist_context, menu);
	}
	else if (info.position == 1)
	{
		String musicFolderId = Util.getSelectedMusicFolderId(this);
		MenuItem menuItem = menu.add(MENU_GROUP_MUSIC_FOLDER, -1, 0, R.string.select_artist_all_folders);

		if (musicFolderId == null)
		{
			menuItem.setChecked(true);
		}

		if (musicFolders != null)
		{
			for (int i = 0; i < musicFolders.size(); i++)
			{
				MusicFolder musicFolder = musicFolders.get(i);
				menuItem = menu.add(MENU_GROUP_MUSIC_FOLDER, i, i + 1, musicFolder.getName());

				if (musicFolder.getId().equals(musicFolderId))
				{
					menuItem.setChecked(true);
				}
			}
		}

		menu.setGroupCheckable(MENU_GROUP_MUSIC_FOLDER, true, true);
	}

	MenuItem downloadMenuItem = menu.findItem(R.id.artist_menu_download);

	if (downloadMenuItem != null)
	{
		downloadMenuItem.setVisible(!Util.isOffline(this));
	}
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:47,代码来源:SelectArtistActivity.java

示例6: onCreateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo info) {
    super.onCreateContextMenu(menu, v, info);

    boolean shouldShowContextMenu = true;
    boolean showCurrentLayerItems = false;
    boolean hasClipboardContents = mViewModel.hasClipboardContents();

    if (v instanceof DocumentView) {
        DocumentView dv = (DocumentView) v;
        shouldShowContextMenu = dv.shouldShowContextMenu();
        showCurrentLayerItems = dv.shouldShowCurrentLayerContextItems();
    } else if (v instanceof LayerListView) {
        //LayerListView llv = (LayerListView) v;
        showCurrentLayerItems = true;
    }

    if (shouldShowContextMenu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu_context, menu);

        MenuItem item = menu.findItem(CUT);
        item.setVisible(showCurrentLayerItems);

        item = menu.findItem(COPY);
        item.setVisible(showCurrentLayerItems);

        item = menu.findItem(PASTE);
        item.setVisible(showCurrentLayerItems || hasClipboardContents);
        item.setEnabled(hasClipboardContents);

        item = menu.findItem(DUPLICATE);
        item.setVisible(showCurrentLayerItems);

        item = menu.findItem(DELETE);
        item.setVisible(showCurrentLayerItems);

        item = menu.findItem(GROUP);
        item.setVisible(showCurrentLayerItems);
    }
}
 
开发者ID:google,项目名称:spline,代码行数:42,代码来源:EditorActivity.java

示例7: initializeItem

import android.view.ContextMenu; //导入方法依赖的package包/类
public void initializeItem(ContextMenu menu, int id, TGActionProcessorListener actionProcessor, boolean enabled, boolean checked) {
	MenuItem menuItem = menu.findItem(id);
	menuItem.setOnMenuItemClickListener(actionProcessor);
	menuItem.setEnabled(enabled);
	menuItem.setChecked(checked);
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:7,代码来源:TGContextMenuBase.java

示例8: populateContextMenu

import android.view.ContextMenu; //导入方法依赖的package包/类
@Override
public void populateContextMenu(ContextMenu menu, AdapterView.AdapterContextMenuInfo acmi, int num)
{
    try
    {
        if (readWriteAdapter)
        {
            menu.add(0, R.id.fman_action_refresh, 0, R.string.fman_refresh_title);
            menu.add(0, R.id.fman_action_create_folder, 0, R.string.fman_create_folder_title);
            if (num > 0)
            {
                menu.add(0, R.id.fman_action_rename, 0, R.string.fman_rename_title);
                menu.add(0, R.id.fman_action_delete, 0, R.string.fman_delete_title);
            }
        }
        MenuItem activeSort = null;
        menu.add(0, R.id.fman_action_sort_by_name, 0, R.string.fman_sort_by_name);
        if ((mode & MODE_SORTING) == SORT_NAME)
        {
            activeSort = menu.findItem(R.id.fman_action_sort_by_name);
        }
        menu.add(0, R.id.fman_action_sort_by_ext, 0, R.string.fman_sort_by_ext);
        if ((mode & MODE_SORTING) == SORT_EXT)
        {
            activeSort = menu.findItem(R.id.fman_action_sort_by_ext);
        }
        menu.add(0, R.id.fman_action_sort_by_size, 0, R.string.fman_sort_by_size);
        if ((mode & MODE_SORTING) == SORT_SIZE)
        {
            activeSort = menu.findItem(R.id.fman_action_sort_by_size);
        }
        menu.add(0, R.id.fman_action_sort_by_date, 0, R.string.fman_sort_by_date);
        if ((mode & MODE_SORTING) == SORT_DATE)
        {
            activeSort = menu.findItem(R.id.fman_action_sort_by_date);
        }
        if (activeSort != null)
        {
            activeSort.setCheckable(true);
            activeSort.setChecked(true);
        }
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:48,代码来源:AdapterBaseImpl.java


注:本文中的android.view.ContextMenu.findItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。