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


Java PopupMenu.getMenuInflater方法代码示例

本文整理汇总了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();
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:27,代码来源:Helper.java

示例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();
}
 
开发者ID:active-citizen,项目名称:android.java,代码行数:29,代码来源:EventCommentsListActivity.java

示例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();
    }
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:24,代码来源:SearchSongFragment.java

示例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();

}
 
开发者ID:braulio94,项目名称:Quadro,代码行数:9,代码来源:BaseActivity.java

示例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();
}
 
开发者ID:BakkerTom,项目名称:happy-news,代码行数:15,代码来源:ViewHolder.java

示例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();
}
 
开发者ID:rishabh115,项目名称:Odyssey2017,代码行数:8,代码来源:EventAdapter.java

示例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: ");
}
 
开发者ID:mahto56,项目名称:Qeet-Remote,代码行数:10,代码来源:ToastViewHolder.java

示例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();
}
 
开发者ID:levitnudi,项目名称:CryptoSasa,代码行数:12,代码来源:CurrencyAdapter.java

示例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();
}
 
开发者ID:sciage,项目名称:FinalProject,代码行数:38,代码来源:MessageAdapter.java

示例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();
}
 
开发者ID:sciage,项目名称:FinalProject,代码行数:38,代码来源:CommentReplyAdapter.java

示例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();
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:34,代码来源:PlaylistListFragment.java

示例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();
}
 
开发者ID:mosamabinomar,项目名称:RootPGPExplorer,代码行数:8,代码来源:ViewHolder.java

示例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();
}
 
开发者ID:chaitanyanettem,项目名称:SearchforReddit,代码行数:15,代码来源:LauncherActivity.java

示例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();
}
 
开发者ID:andryr,项目名称:Harmony-Music-Player,代码行数:29,代码来源:AlbumFragment.java

示例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();
}
 
开发者ID:andryr,项目名称:Harmony-Music-Player,代码行数:29,代码来源:ArtistFragment.java


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