Java 类android.widget.PopupMenu.OnMenuItemClickListener 实例源码
项目:boohee_v5.6
文件:WebFavoriteFragment.java
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;
}
});
}
项目:okwallet
文件:BlockListFragment.java
@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();
}
项目:ExoPlayerController
文件:PlayerActivity.java
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();
}
项目:ExoPlayerController
文件:PlayerActivity.java
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();
}
项目:ExoPlayerController
文件:PlayerActivity.java
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);
}
项目:ExoPlayer-Demo
文件:PlayerActivity.java
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();
}
项目:ExoPlayer-Demo
文件:PlayerActivity.java
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();
}
项目:Android-Example-HLS-ExoPlayer
文件:PlayerActivity.java
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();
}
项目:Android-Example-HLS-ExoPlayer
文件:PlayerActivity.java
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();
}
项目:ombuds-android
文件:BlockListFragment.java
@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();
}
项目:vlc_android_win
文件:AudioAlbumsSongsFragment.java
@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();
}
项目:vlc_android_win
文件:AudioBrowserFragment.java
@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();
}
项目:vlc_android_win
文件:VideoGridFragment.java
@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();
}
项目:sagetv-miniclient
文件:ServerItemPresenter.java
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);
}
项目:VCL-Android
文件:AudioAlbumsSongsFragment.java
@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();
}
项目:VCL-Android
文件:AudioBrowserFragment.java
@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();
}
项目:VCL-Android
文件:VideoGridFragment.java
@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();
}
项目:android-exoplayer
文件:FullPlayerActivity.java
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();
}
项目:android-exoplayer
文件:FullPlayerActivity.java
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();
}
项目:QuickControlPanel
文件:NotificationViewProvider.java
@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();
}
项目:Android-Birdcopy-Application
文件:FlyingPlayerActivity.java
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, FlyingPlayer.TYPE_AUDIO);
popup.show();
}
项目:Android-Birdcopy-Application
文件:FlyingPlayerActivity.java
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();
}
项目:vlc-android
文件:AudioAlbumsSongsFragment.java
@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();
}
项目:vlc-android
文件:AudioBrowserFragment.java
@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();
}
项目:vlc-android
文件:VideoGridFragment.java
@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();
}
项目:Exoplayer_VLC
文件:PlayerActivity.java
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();
}
项目:Exoplayer_VLC
文件:PlayerActivity.java
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();
}
项目:MAST-MOBILE
文件:PersonListWithDPActivity.java
public void showPopupForDP(View v, int position) {
PopupMenu popup = new PopupMenu(context, v);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.attribute_listing_options_for_poi, popup.getMenu());
final DeceasedPerson person = deceasedPersons.get(position);
popup.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.edit:
edit_DP(person);
return true;
case R.id.delete_entry:
delete_DP(person);
return true;
default:
return false;
}
}
});
if (!readOnly) {
popup.show();
}
}
项目:ExoPlayer
文件:PlayerActivity.java
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();
}
项目:ExoPlayer
文件:PlayerActivity.java
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();
}
项目:VlcTest
文件:AudioAlbumsSongsFragment.java
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onPopupMenu(View anchor, final int position) {
if (!LibVlcUtil.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();
}
项目:VlcTest
文件:AudioBrowserFragment.java
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onPopupMenu(View anchor, final int position) {
if (!LibVlcUtil.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();
}
项目:VlcTest
文件:VideoGridFragment.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onContextPopupMenu(View anchor, final int position) {
if (!LibVlcUtil.isHoneycombOrLater()) {
// Call the "classic" context menu
anchor.performLongClick();
return;
}
PopupMenu popupMenu = new PopupMenu(getActivity(), anchor);
popupMenu.getMenuInflater().inflate(R.menu.video_list, popupMenu.getMenu());
Media media = mVideoAdapter.getItem(position);
setContextMenuItems(popupMenu.getMenu(), media);
popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
return handleContextItemSelected(item, position);
}
});
popupMenu.show();
}
项目:QuickControlPanel
文件:NotificationViewProvider.java
@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();
}
项目:popcorntime-android-kitkat
文件:AudioAlbumsSongsFragment.java
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onPopupMenu(View anchor, final int position) {
if (!Util.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();
}
项目:popcorntime-android-kitkat
文件:AudioBrowserFragment.java
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onPopupMenu(View anchor, final int position) {
if (!Util.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();
}
项目:popcorntime-android-kitkat
文件:VideoGridFragment.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onContextPopupMenu(View anchor, final int position) {
if (!Util.isHoneycombOrLater()) {
// Call the "classic" context menu
anchor.performLongClick();
return;
}
PopupMenu popupMenu = new PopupMenu(getActivity(), anchor);
popupMenu.getMenuInflater().inflate(R.menu.video_list, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
return handleContextItemSelected(item, position);
}
});
popupMenu.show();
}
项目:scanvine-android
文件:SourceListActivity.java
public void openSectionPopup() {
final String[] sections = {"All","World","Tech","Business","Entertainment","Sports","Life"};
PopupMenu popupMenu = new PopupMenu(this, findViewById(R.id.action_section));
Menu menu = popupMenu.getMenu();
for (int i=0; i<sections.length; i++) {
boolean addCheck = currentSection!=null &&
(currentSection.equalsIgnoreCase(sections[i]) ||
currentSection.length()==0 && "All".equalsIgnoreCase(sections[i]));
menu.add(Menu.NONE, i, Menu.NONE, addCheck ? sections[i]+"✓" : sections[i]);
}
popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
currentSection = item.getItemId()==0 ? null : (""+item.getTitle()).replace("✓","");
SourceListFragment slf = (SourceListFragment) getSupportFragmentManager().findFragmentById(R.id.source_list);
slf.refreshList(currentSection);
return false;
}
});
popupMenu.show();
}
项目:scanvine-android
文件:SourceListActivity.java
public void openSortPopup() {
PopupMenu popupMenu = new PopupMenu(this, findViewById(R.id.action_section));
Menu menu = popupMenu.getMenu();
menu.add(Menu.NONE, 0, Menu.NONE, sortByName ? "Name✓" : "Name");
menu.add(Menu.NONE, 1, Menu.NONE, sortByName ? "Score" : "Score✓");
popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
sortByName = item.getItemId()==0;
SourceListFragment slf = (SourceListFragment) getSupportFragmentManager().findFragmentById(R.id.source_list);
slf.sortList(sortByName);
return false;
}
});
popupMenu.show();
}
项目:scanvine-android
文件:StoryListActivity.java
public void openTimePopup() {
final String[] times = {"Firehose","Latest","Last Day","Last Week","Last Month"};
final String[] timeKeys = {"Firehose","Latest","Last1","Last7","Last30"};
PopupMenu popupMenu = new PopupMenu(this, findViewById(R.id.action_time));
Menu menu = popupMenu.getMenu();
for (int i=0; i<times.length; i++) {
boolean addCheck = currentTime!=null && currentTime.equalsIgnoreCase(timeKeys[i]);
menu.add(Menu.NONE, i, Menu.NONE, addCheck ? times[i]+"✓" : times[i]);
}
popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
currentTime = timeKeys[item.getItemId()];
StoryListFragment slf = (StoryListFragment) getSupportFragmentManager().findFragmentById(R.id.story_list);
slf.refreshList(currentTime, currentSection, getSourceSlug());
return false;
}
});
popupMenu.show();
}