本文整理汇总了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));
}
}
示例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));
}
}
示例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);
}
}
示例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));
}
}
示例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));
}
}
示例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);
}
}
示例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);
}
示例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();
}
}