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


Java OnMenuItemClickListener类代码示例

本文整理汇总了Java中android.widget.PopupMenu.OnMenuItemClickListener的典型用法代码示例。如果您正苦于以下问题:Java OnMenuItemClickListener类的具体用法?Java OnMenuItemClickListener怎么用?Java OnMenuItemClickListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: showPopupMenu

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
protected void showPopupMenu(View view, final int position) {
    final FavoriteArticle article = (FavoriteArticle) getItem(position);
    PopupMenu popup = new PopupMenu(this.context, view);
    popup.getMenu().add(0, 0, 0, "取消收藏");
    popup.show();
    popup.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
                case 0:
                    WebFavoriteFragment.this.deleteFavoriteArticle(article, position);
                    break;
            }
            return false;
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:WebFavoriteFragment.java

示例2: onBlockMenuClick

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
@Override
public void onBlockMenuClick(final View view, final StoredBlock block) {
    final PopupMenu popupMenu = new PopupMenu(activity, view);
    popupMenu.inflate(R.menu.blocks_context);
    popupMenu.getMenu().findItem(R.id.blocks_context_browse).setVisible(Constants.ENABLE_BROWSE);
    popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(final MenuItem item) {
            switch (item.getItemId()) {
            case R.id.blocks_context_browse:
                final String blockHash = block.getHeader().getHashAsString();
                final Uri blockExplorerUri = config.getBlockExplorer();
                log.info("Viewing block {} on {}", blockHash, blockExplorerUri);
                startActivity(new Intent(Intent.ACTION_VIEW,
                        Uri.withAppendedPath(blockExplorerUri, "block/" + blockHash)));
                return true;
            }
            return false;
        }
    });
    popupMenu.show();
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:23,代码来源:BlockListFragment.java

示例3: showAudioPopup

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
public void showAudioPopup(View v) {
	PopupMenu popup = new PopupMenu(this, v);
	Menu menu = popup.getMenu();
	menu.add(Menu.NONE, Menu.NONE, Menu.NONE, R.string.enable_background_audio);
	final MenuItem backgroundAudioItem = menu.findItem(0);
	backgroundAudioItem.setCheckable(true);
	backgroundAudioItem.setChecked(enableBackgroundAudio);
	OnMenuItemClickListener clickListener = new OnMenuItemClickListener() {
		@Override
		public boolean onMenuItemClick(MenuItem item) {
			if (item == backgroundAudioItem) {
				enableBackgroundAudio = !item.isChecked();
				return true;
			}
			return false;
		}
	};
	configurePopupWithTracks(popup, clickListener, DemoPlayer.TYPE_AUDIO);
	popup.show();
}
 
开发者ID:vuthanhict,项目名称:ExoPlayerController,代码行数:21,代码来源:PlayerActivity.java

示例4: showVerboseLogPopup

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
public void showVerboseLogPopup(View v) {
	PopupMenu popup = new PopupMenu(this, v);
	Menu menu = popup.getMenu();
	menu.add(Menu.NONE, 0, Menu.NONE, R.string.logging_normal);
	menu.add(Menu.NONE, 1, Menu.NONE, R.string.logging_verbose);
	menu.setGroupCheckable(Menu.NONE, true, true);
	menu.findItem((VerboseLogUtil.areAllTagsEnabled()) ? 1 : 0).setChecked(true);
	popup.setOnMenuItemClickListener(new OnMenuItemClickListener() {
		@Override
		public boolean onMenuItemClick(MenuItem item) {
			if (item.getItemId() == 0) {
				VerboseLogUtil.setEnableAllTags(false);
			} else {
				VerboseLogUtil.setEnableAllTags(true);
			}
			return true;
		}
	});
	popup.show();
}
 
开发者ID:vuthanhict,项目名称:ExoPlayerController,代码行数:21,代码来源:PlayerActivity.java

示例5: configurePopupWithTracks

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
private void configurePopupWithTracks(PopupMenu popup, final OnMenuItemClickListener customActionClickListener,
		final int trackType) {
	if (player == null) {
		return;
	}
	int trackCount = player.getTrackCount(trackType);
	if (trackCount == 0) {
		return;
	}
	popup.setOnMenuItemClickListener(new OnMenuItemClickListener() {
		@Override
		public boolean onMenuItemClick(MenuItem item) {
			return (customActionClickListener != null && customActionClickListener.onMenuItemClick(item))
					|| onTrackItemClick(item, trackType);
		}
	});
	Menu menu = popup.getMenu();
	// ID_OFFSET ensures we avoid clashing with Menu.NONE (which equals 0)
	menu.add(MENU_GROUP_TRACKS, DemoPlayer.TRACK_DISABLED + ID_OFFSET, Menu.NONE, R.string.off);
	for (int i = 0; i < trackCount; i++) {
		menu.add(MENU_GROUP_TRACKS, i + ID_OFFSET, Menu.NONE, buildTrackName(player.getTrackFormat(trackType, i)));
	}
	menu.setGroupCheckable(MENU_GROUP_TRACKS, true, true);
	menu.findItem(player.getSelectedTrack(trackType) + ID_OFFSET).setChecked(true);
}
 
开发者ID:vuthanhict,项目名称:ExoPlayerController,代码行数:26,代码来源:PlayerActivity.java

示例6: showAudioPopup

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
public void showAudioPopup(View v) {
    PopupMenu popup = new PopupMenu(this, v);
    Menu menu = popup.getMenu();
    menu.add(Menu.NONE, Menu.NONE, Menu.NONE, R.string.enable_background_audio);
    final MenuItem backgroundAudioItem = menu.findItem(0);
    backgroundAudioItem.setCheckable(true);
    backgroundAudioItem.setChecked(enableBackgroundAudio);
    OnMenuItemClickListener clickListener = new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            if (item == backgroundAudioItem) {
                enableBackgroundAudio = !item.isChecked();
                return true;
            }
            return false;
        }
    };
    configurePopupWithTracks(popup, clickListener, DemoPlayer.TYPE_AUDIO);
    popup.show();
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:21,代码来源:PlayerActivity.java

示例7: showVerboseLogPopup

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
public void showVerboseLogPopup(View v) {
    PopupMenu popup = new PopupMenu(this, v);
    Menu menu = popup.getMenu();
    menu.add(Menu.NONE, 0, Menu.NONE, R.string.logging_normal);
    menu.add(Menu.NONE, 1, Menu.NONE, R.string.logging_verbose);
    menu.setGroupCheckable(Menu.NONE, true, true);
    menu.findItem((VerboseLogUtil.areAllTagsEnabled()) ? 1 : 0).setChecked(true);
    popup.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            if (item.getItemId() == 0) {
                VerboseLogUtil.setEnableAllTags(false);
            } else {
                VerboseLogUtil.setEnableAllTags(true);
            }
            return true;
        }
    });
    popup.show();
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:21,代码来源:PlayerActivity.java

示例8: onBlockMenuClick

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
@Override
public void onBlockMenuClick(final View view, final StoredBlock block)
{
    final PopupMenu popupMenu = new PopupMenu(activity, view);
    popupMenu.inflate(R.menu.blocks_context);

    popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener()
    {
        @Override
        public boolean onMenuItemClick(final MenuItem item)
        {
            switch (item.getItemId())
            {
                case R.id.blocks_context_browse:
                    startActivity(new Intent(Intent.ACTION_VIEW,
                            Uri.withAppendedPath(config.getBlockExplorer(), "block/" + block.getHeader().getHashAsString())));
                    return true;
            }
            return false;
        }
    });
    popupMenu.show();
}
 
开发者ID:soapboxsys,项目名称:ombuds-android,代码行数:24,代码来源:BlockListFragment.java

示例9: onPopupMenu

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onPopupMenu(View anchor, final int position) {
    if (!AndroidUtil.isHoneycombOrLater()) {
        // Call the "classic" context menu
        anchor.performLongClick();
        return;
    }

    PopupMenu popupMenu = new PopupMenu(getActivity(), anchor);
    popupMenu.getMenuInflater().inflate(R.menu.audio_list_browser, popupMenu.getMenu());
    setContextMenuItems(popupMenu.getMenu(), anchor, position);

    popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            return handleContextItemSelected(item, position);
        }
    });
    popupMenu.show();
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:22,代码来源:AudioAlbumsSongsFragment.java

示例10: onPopupMenu

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onPopupMenu(View anchor, final int position) {
    if (!AndroidUtil.isHoneycombOrLater()) {
        // Call the "classic" context menu
        anchor.performLongClick();
        return;
    }

    PopupMenu popupMenu = new PopupMenu(getActivity(), anchor);
    popupMenu.getMenuInflater().inflate(R.menu.audio_list_browser, popupMenu.getMenu());
    setContextMenuItems(popupMenu.getMenu(), anchor);

    popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            return handleContextItemSelected(item, position);
        }
    });
    popupMenu.show();
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:22,代码来源:AudioBrowserFragment.java

示例11: onContextPopupMenu

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onContextPopupMenu(View anchor, final int position) {
    if (!AndroidUtil.isHoneycombOrLater()) {
        // Call the "classic" context menu
        anchor.performLongClick();
        return;
    }

    PopupMenu popupMenu = new PopupMenu(getActivity(), anchor);
    popupMenu.getMenuInflater().inflate(R.menu.video_list, popupMenu.getMenu());
    MediaWrapper media = mVideoAdapter.getItem(position);
    if (media == null)
        return;
    setContextMenuItems(popupMenu.getMenu(), media);
    popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            return handleContextItemSelected(item, position);
        }
    });
    popupMenu.show();
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:23,代码来源:VideoGridFragment.java

示例12: ServerViewHolder

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
public ServerViewHolder(View view) {
    super(view);
    view.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(final View v) {
            PopupMenu menu = ServerInfoUtil.createContextMenu(context, v, new OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    return ServerInfoUtil.onMenuItemClick(context, item, serverInfo, after);
                }
            });
            menu.show();
            return true;
        }
    });
    icon = (ImageView) view.findViewById(R.id.icon);
    serverName = (TextView) view.findViewById(R.id.server_name);
    serverAddress = (TextView) view.findViewById(R.id.server_address);
    serverLocator = (TextView) view.findViewById(R.id.server_locator_id);
    serverLastConnected = (TextView) view.findViewById(R.id.server_last_connect);
}
 
开发者ID:OpenSageTV,项目名称:sagetv-miniclient,代码行数:22,代码来源:ServerItemPresenter.java

示例13: showAudioPopup

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
public void showAudioPopup(View v) {
  PopupMenu popup = new PopupMenu(this, v);
  Menu menu = popup.getMenu();
  menu.add(Menu.NONE, Menu.NONE, Menu.NONE, R.string.enable_background_audio);
  final MenuItem backgroundAudioItem = menu.findItem(0);
  backgroundAudioItem.setCheckable(true);
  backgroundAudioItem.setChecked(enableBackgroundAudio);
  OnMenuItemClickListener clickListener = new OnMenuItemClickListener() {
    @Override
    public boolean onMenuItemClick(MenuItem item) {
      if (item == backgroundAudioItem) {
        enableBackgroundAudio = !item.isChecked();
        return true;
      }
      return false;
    }
  };
  configurePopupWithTracks(popup, clickListener, DemoPlayer.TYPE_AUDIO);
  popup.show();
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:21,代码来源:FullPlayerActivity.java

示例14: showVerboseLogPopup

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
public void showVerboseLogPopup(View v) {
  PopupMenu popup = new PopupMenu(this, v);
  Menu menu = popup.getMenu();
  menu.add(Menu.NONE, 0, Menu.NONE, R.string.logging_normal);
  menu.add(Menu.NONE, 1, Menu.NONE, R.string.logging_verbose);
  menu.setGroupCheckable(Menu.NONE, true, true);
  menu.findItem((VerboseLogUtil.areAllTagsEnabled()) ? 1 : 0).setChecked(true);
  popup.setOnMenuItemClickListener(new OnMenuItemClickListener() {
    @Override
    public boolean onMenuItemClick(MenuItem item) {
      if (item.getItemId() == 0) {
        VerboseLogUtil.setEnableAllTags(false);
      } else {
        VerboseLogUtil.setEnableAllTags(true);
      }
      return true;
    }
  });
  popup.show();
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:21,代码来源:FullPlayerActivity.java

示例15: onLongPress

import android.widget.PopupMenu.OnMenuItemClickListener; //导入依赖的package包/类
@Override
public void onLongPress(MotionEvent e) {
	mView.setPressed(false);
	PopupMenu menu = new PopupMenu(mContext, mView);
	menu.inflate(R.menu.notification_menu);
	menu.setOnMenuItemClickListener(new OnMenuItemClickListener() {

		@Override
		public boolean onMenuItemClick(MenuItem item) {
			if(item.getItemId() == R.id.action_info) {
				ControlService service = (ControlService) ControlService.getInstance();
				if(service != null && service.isAttachedToWindow() && ControlService.isRunning()) {
					service.close();
				}
				startApplicationDetailsActivity(mPkg);
				return true;
			}
			return false;
		}

	});
	menu.show();
}
 
开发者ID:hvmunlimited,项目名称:QuickControlPanel,代码行数:24,代码来源:NotificationViewProvider.java


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