本文整理汇总了Java中android.support.v7.widget.PopupMenu.getMenuInflater方法的典型用法代码示例。如果您正苦于以下问题:Java PopupMenu.getMenuInflater方法的具体用法?Java PopupMenu.getMenuInflater怎么用?Java PopupMenu.getMenuInflater使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.PopupMenu
的用法示例。
在下文中一共展示了PopupMenu.getMenuInflater方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showFolderMenu
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
/**
* Folder Menu
*
* @param context
* @param view
*/
public static void showFolderMenu(Context context, View view, File file, RefreshData refreshData) {
PopupMenu popupMenu = new PopupMenu(context, view);
MenuInflater menuInflater = popupMenu.getMenuInflater();
menuInflater.inflate(R.menu.folder_menu, popupMenu.getMenu());
if (file == null) {
return;
}
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.exclude_folder:
excludeFolder(context, file, refreshData);
break;
}
return false;
}
});
popupMenu.show();
}
示例2: showPopup
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
/**
* Вызов диалога контекстного меню для своего комментария
*
* @param v
*/
private void showPopup(View v) {
PopupMenu popup = new PopupMenu(EventCommentsListActivity.this, v);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.comment, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
boolean result = false;
switch (menuItem.getItemId()) {
case R.id.action_edit:
updateComment();
result = true;
break;
case R.id.action_delete:
deleteComment();
result = true;
break;
}
return result;
}
});
popup.show();
}
示例3: showMenu
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
private void showMenu(final int position, View v) {
PopupMenu popup = new PopupMenu(getActivity(), v);
MenuInflater inflater = popup.getMenuInflater();
final Song song = mSongAdapert.getItem(position);
inflater.inflate(R.menu.search_song_item, popup.getMenu());
popup.setOnMenuItemClickListener(item -> {
switch (item.getItemId()) {
case R.id.action_add_to_queue:
mSearchActivity.addToQueue(song);
return true;
case R.id.action_add_to_playlist:
showPlaylistPicker(song);
return true;
default: //do nothing
break;
}
return false;
});
popup.show();
}
示例4: showPopupMenu
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
public void showPopupMenu(View view) {
PopupMenu popup = new PopupMenu(this, view);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.menu_main, popup.getMenu());
popup.setOnMenuItemClickListener(new MyMenuItemClickListener());
popup.show();
}
示例5: showPopupMenu
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
/**
* Method for inflation the popup menu.
* Gets used by all classes that implement ViewHolder.
*
* @param view the view of the post.
* @param position position in the feedAdapter.
*/
public void showPopupMenu(View view, int position) {
PopupMenu popup = new PopupMenu(view.getContext(), view);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.menu_cardview_popup, popup.getMenu());
popup.setOnMenuItemClickListener(new PostMenuItemClickListener(position, view.getContext(), post));
popup.show();
}
示例6: showPopupMenu
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
private void showPopupMenu(View overflow) {
PopupMenu menu=new PopupMenu(context,overflow);
MenuInflater inflater=menu.getMenuInflater();
inflater.inflate(R.menu.events_menu,menu.getMenu());
menu.setOnMenuItemClickListener(new MyMenuItemClickListener());
menu.show();
}
示例7: showPopUpMenu
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
private void showPopUpMenu(View view){
View item = view.findViewById(R.id.card_view);
PopupMenu popup = new PopupMenu(context,item);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.menu_toast, popup.getMenu());
popup.setOnMenuItemClickListener(new MyMenuItemClickListener());
popup.show();
Log.d("DEBUG", "showPopUpMenu: ");
}
示例8: showPopupMenu
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
/**
* Showing popup menu when tapping on 3 dots
*/
private void showPopupMenu(View view) {
// inflate menu
PopupMenu popup = new PopupMenu(mContext, view);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.menu_currency, popup.getMenu());
popup.setOnMenuItemClickListener(new MyMenuItemClickListener());
popup.show();
}
示例9: commentMoreMethod
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
protected void commentMoreMethod(View view, int position) {
popupMenu = new PopupMenu(view.getContext(), view);
MenuInflater inflater = popupMenu.getMenuInflater();
inflater.inflate(R.menu.comment_more_single, popupMenu.getMenu());
// this.menu = popupMenu.getMenu();
if (MySharedPreferences.getUserId(preferences).equals(mMessageList.get(mPosition).getCommentUserId())){
popupMenu.getMenu().setGroupVisible(R.id.menu_group_remove_comment, true);
} else {
popupMenu.getMenu().setGroupVisible(R.id.menu_group_remove_comment, false);
}
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()){
case R.id.commentDeleteSingle:
try {
deleteChat(view, mMessageList.get(mPosition).getCommentId());
// Toast.makeText(view.getContext(), "comment ID: " + mMessageList.get(position).getCommentId(), Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
}
remove(position);
notifyItemRemoved(position);
return true;
default:
return false;
}
}
});
popupMenu.show();
}
示例10: commentMoreMethod
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
protected void commentMoreMethod(View view, int position) {
popupMenu = new PopupMenu(view.getContext(), view);
MenuInflater inflater = popupMenu.getMenuInflater();
inflater.inflate(R.menu.comment_more, popupMenu.getMenu());
// this.menu = popupMenu.getMenu();
if (MySharedPreferences.getUserId(preferences).equals(mMessageList.get(position).getPostUserId())){
popupMenu.getMenu().setGroupVisible(R.id.menu_group_remove_comment_reply, true);
} else {
popupMenu.getMenu().setGroupVisible(R.id.menu_group_remove_comment_reply, false);
}
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()){
case R.id.commentDelete:
remove(position);
notifyItemRemoved(position);
try {
deleteChat(view, mMessageList.get(mPosition).getCommentId());
// Toast.makeText(view.getContext(), "comment ID: " + mMessageList.get(position).getCommentId(), Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
}
return true;
default:
return false;
}
}
});
popupMenu.show();
}
示例11: showMenu
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
private void showMenu(View view, Playlist playlist) {
PopupMenu popup = new PopupMenu(getActivity(), view);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.playlist_menu, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_playlist_delete:
PlaylistHelper.deletePlaylistDailog(getContext(), playlist.getName(), new RefreshPlaylist() {
@Override
public void refresh() {
load();
}
});
break;
case R.id.action_playlist_rename:
PlaylistHelper.showRenameDialog(getContext(), new RefreshPlaylist() {
@Override
public void refresh() {
load();
}
}, playlist.getId());
break;
}
return false;
}
});
popup.show();
}
示例12: showPopUpMenu
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
private void showPopUpMenu(View v){
PopupMenu popup = new PopupMenu(v.getContext(), v);
popup.setOnMenuItemClickListener(this);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.grid_actions, popup.getMenu());
popup.show();
}
示例13: showPopup
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
public void showPopup(View view) {
UtilMethods.hideKeyboard(this);
PopupMenu popupMenu = new PopupMenu(this, view);
MenuInflater inflater = popupMenu.getMenuInflater();
if (view.getId() == R.id.time_button) {
inflater.inflate(R.menu.time_filter, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(timePopupListener);
}
else if (view.getId() == R.id.sort_button) {
inflater.inflate(R.menu.sort_filter, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(sortPopupListener);
}
popupMenu.show();
}
示例14: showMenu
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
public void showMenu(final int position, View v) {
PopupMenu popup = new PopupMenu(getActivity(), v);
MenuInflater inflater = popup.getMenuInflater();
final Song song = mAdapter.getItem(position);
inflater.inflate(R.menu.song_list_item, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_add_to_queue:
((MainActivity) getActivity()).addToQueue(song);
return true;
case R.id.action_set_as_next_track:
((MainActivity) getActivity()).setAsNextTrack(song);
return true;
case R.id.action_edit_tags:
showID3TagEditor(song);
return true;
case R.id.action_add_to_playlist:
showPlaylistPicker(song);
return true;
}
return false;
}
});
popup.show();
}
示例15: showSongMenu
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
public void showSongMenu(final int position, View v) {
PopupMenu popup = new PopupMenu(getActivity(), v);
MenuInflater inflater = popup.getMenuInflater();
final Song song = mSongListAdapter.getItem(position);
inflater.inflate(R.menu.song_list_item, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_add_to_queue:
((MainActivity) getActivity()).addToQueue(song);
return true;
case R.id.action_set_as_next_track:
((MainActivity) getActivity()).setAsNextTrack(song);
return true;
case R.id.action_edit_tags:
showID3TagEditor(song);
return true;
case R.id.action_add_to_playlist:
showPlaylistPicker(song);
return true;
}
return false;
}
});
popup.show();
}