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


Java PopupMenu.getMenuInflater方法代码示例

本文整理汇总了Java中android.widget.PopupMenu.getMenuInflater方法的典型用法代码示例。如果您正苦于以下问题:Java PopupMenu.getMenuInflater方法的具体用法?Java PopupMenu.getMenuInflater怎么用?Java PopupMenu.getMenuInflater使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.PopupMenu的用法示例。


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

示例1: PopupMenu

import android.widget.PopupMenu; //导入方法依赖的package包/类
/**
 * Method shows Popup menu on chosen deck menu.
 * Access to method is package-private due to ButterKnife
 *
 * @param v clicked view
 */
@OnClick(R.id.deck_popup_menu)
/* default */ void showPopup(final View v) {
    PopupMenu popup = new PopupMenu(v.getContext(), v);
    popup.setOnMenuItemClickListener(this);
    MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.deck_menu, popup.getMenu());
    manageSharingMenu(popup.getMenu());
    // mDeckAccess can be null due to asynchronous operations.
    if (mDeckAccess != null) {
        popup.show();
        return;
    }
    Toast.makeText(mDeckTextView.getContext(),
            R.string.not_all_data_loaded_user_warning, Toast.LENGTH_SHORT).show();
    LOGGER.warn("mDeckAccess is null in DeckViewHolder", new Throwable());
}
 
开发者ID:dasfoo,项目名称:delern,代码行数:23,代码来源:DeckViewHolder.java

示例2: onMenuClick

import android.widget.PopupMenu; //导入方法依赖的package包/类
private void onMenuClick(@NonNull final View btnView, final int position) {
    if (getItemViewType(position) == VIEW_TYPE_PLAYLIST) {
        final PopupMenu popup = new PopupMenu(btnView.getContext(), btnView);
        final Menu popupMenu = popup.getMenu();

        final MenuInflater inflater = popup.getMenuInflater();
        inflater.inflate(R.menu.list_item_playlist, popupMenu);

        final Cursor item = getCursorItem(position);
        if (item != null) {
            final long id = item.getLong(QueueProviderPlaylists.COLUMN_ID);
            final String name = item.getString(QueueProviderPlaylists.COLUMN_NAME);
            popup.setOnMenuItemClickListener(
                    menuItem -> onMenuItemClick(menuItem, id, name));
            popup.show();
        }
    }
}
 
开发者ID:Doctoror,项目名称:PainlessMusicPlayer,代码行数:19,代码来源:PlaylistsRecyclerAdapter.java

示例3: onMenuClick

import android.widget.PopupMenu; //导入方法依赖的package包/类
private void onMenuClick(@NonNull final View btnView, final int position) {
    final PopupMenu popup = new PopupMenu(btnView.getContext(), btnView);
    final Menu popupMenu = popup.getMenu();

    final MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.list_item_album, popupMenu);

    final long id = getItemId(position);
    final Cursor item = getCursor();

    if (item.moveToPosition(position)) {
        final String albumName = item.getString(AlbumsProvider.COLUMN_ALBUM);
        popup.setOnMenuItemClickListener(menuItem -> onMenuItemClick(menuItem, id, albumName));
        popup.show();
    }
}
 
开发者ID:Doctoror,项目名称:PainlessMusicPlayer,代码行数:17,代码来源:AlbumsRecyclerAdapter.java

示例4: onMenuOptionClick

import android.widget.PopupMenu; //导入方法依赖的package包/类
@OnClick(R.id.menu)
void onMenuOptionClick(View view) {
    PopupMenu popupMenu = new PopupMenu(this, view);
    MenuInflater menuInflater = popupMenu.getMenuInflater();
    menuInflater.inflate(R.menu.options_main, popupMenu.getMenu());
    popupMenu.setOnMenuItemClickListener(this);
    popupMenu.show();
}
 
开发者ID:rumaan,项目名称:file.io-app,代码行数:9,代码来源:MainActivity.java

示例5: showMenu

import android.widget.PopupMenu; //导入方法依赖的package包/类
/**
 * popup menu that allows the user to edit their profile and view all of their requests
 * @param v
 */
public void showMenu(View v){
    PopupMenu popup = new PopupMenu(this, v);
    MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.rider_main_menu, popup.getMenu());
    popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
        public boolean onMenuItemClick(MenuItem item){
            switch(item.getItemId()){
                case R.id.mainRiderMenuEditUserInfo:
                    resetText();
                    Intent editInfoIntent = new Intent(RiderMainView.this, EditProfileView.class);
                    editInfoIntent.putExtra("Name", riderName);
                    startActivity(editInfoIntent);
                    return true;
                case R.id.mainRiderMenuViewRequests:
                    resetText();
                    Intent viewRequestsIntent = new Intent(RiderMainView.this, RiderRequestView.class);
                    viewRequestsIntent.putExtra("Name", riderName);
                    startActivity(viewRequestsIntent);
                    return true;
                case R.id.mainRiderMenuViewRides:
                    resetText();
                    Intent viewRidesIntent = new Intent(RiderMainView.this, RiderRidesView.class);
                    viewRidesIntent.putExtra("Name", riderName);
                    startActivity(viewRidesIntent);
                    return true;
                default:
                    return false;
            }
        }
    });

    popup.show();
}
 
开发者ID:CMPUT301F16T04,项目名称:Ridr,代码行数:38,代码来源:RiderMainView.java

示例6: showMenu

import android.widget.PopupMenu; //导入方法依赖的package包/类
/**
 * Show menu.
 *
 * @param v the view
 */
public void showMenu(View v){
    PopupMenu popup = new PopupMenu(this, v);
    MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.rider_main_menu, popup.getMenu());
    popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
        public boolean onMenuItemClick(MenuItem item){
            switch(item.getItemId()){
                case R.id.mainRiderMenuEditUserInfo:
                    Toast.makeText(SearchResultsView.this, "Edit User Info", Toast.LENGTH_SHORT).show();
                    Intent editInfoIntent = new Intent(SearchResultsView.this, EditProfileView.class);
                    editInfoIntent.putExtra("Name", username);
                    startActivity(editInfoIntent);
                    return true;
                case R.id.mainRiderMenuViewRequests:
                    Toast.makeText(SearchResultsView.this, "View Requests", Toast.LENGTH_SHORT).show();
                    Intent viewRequestsIntent = new Intent(SearchResultsView.this, DriverRequestsView.class);
                    viewRequestsIntent.putExtra("Name", username);
                    startActivity(viewRequestsIntent);
                    return true;
                case R.id.mainRiderMenuViewRides:
                    Toast.makeText(SearchResultsView.this, "View Rides", Toast.LENGTH_SHORT).show();
                    Intent viewRidesIntent = new Intent(SearchResultsView.this, DriverRidesView.class);
                    viewRidesIntent.putExtra("Name", username);
                    startActivity(viewRidesIntent);
                    return true;
                default:
                    return false;
            }
        }
    });

    popup.show();
}
 
开发者ID:CMPUT301F16T04,项目名称:Ridr,代码行数:39,代码来源:SearchResultsView.java

示例7: showPopupMenu

import android.widget.PopupMenu; //导入方法依赖的package包/类
@Override
public void showPopupMenu() {
    PopupMenu popup = new PopupMenu(this, mMenuView);
    MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.menu_detail, popup.getMenu());
    popup.setOnMenuItemClickListener(this);
    popup.show();
}
 
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:9,代码来源:DetailActivity.java

示例8: optionsOverflowClick

import android.widget.PopupMenu; //导入方法依赖的package包/类
@OnClick(R.id.more_options)
void optionsOverflowClick(View v)
{
    PopupMenu popup = new PopupMenu(context, v);
    MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.item_category_item_overflow, popup.getMenu());
    popup.setOnMenuItemClickListener(this);
    popup.show();
}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-Distributor-Android-app,代码行数:10,代码来源:ItemCategoriesAdapterEditStock.java

示例9: optionsOverflowClick

import android.widget.PopupMenu; //导入方法依赖的package包/类
@OnClick(R.id.more_options)
void optionsOverflowClick(View v)
{
    PopupMenu popup = new PopupMenu(context, v);
    MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.item_category_item_overflow_parent_selection, popup.getMenu());
    popup.setOnMenuItemClickListener(this);
    popup.show();
}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-Distributor-Android-app,代码行数:10,代码来源:ItemCategoriesParentAdapter.java

示例10: optionsOverflowClick

import android.widget.PopupMenu; //导入方法依赖的package包/类
@OnClick(R.id.more_options)
void optionsOverflowClick(View v)
{
    PopupMenu popup = new PopupMenu(context, v);
    MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.item_image_item_overflow, popup.getMenu());
    popup.setOnMenuItemClickListener(this);
    popup.show();
}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-Distributor-Android-app,代码行数:10,代码来源:AdapterItemImages.java

示例11: optionsOverflowClick

import android.widget.PopupMenu; //导入方法依赖的package包/类
@OnClick(R.id.more_options)
void optionsOverflowClick(View v)
{
    PopupMenu popup = new PopupMenu(context, v);
    MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.item_overflow, popup.getMenu());
    popup.setOnMenuItemClickListener(this);
    popup.show();
}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-Distributor-Android-app,代码行数:10,代码来源:AdapterSimple.java

示例12: optionsOverflowClick

import android.widget.PopupMenu; //导入方法依赖的package包/类
@OnClick(R.id.moreOptions)
void optionsOverflowClick(View v)
{
    PopupMenu popup = new PopupMenu(context, v);
    MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.item_category_item_overflow, popup.getMenu());
    popup.setOnMenuItemClickListener(this);
    popup.show();
}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-End-User-Android-app,代码行数:10,代码来源:AdapterItemCategories.java

示例13: onMenuClick

import android.widget.PopupMenu; //导入方法依赖的package包/类
private void onMenuClick(@NonNull final View itemView, final int position) {
    final PopupMenu popup = new PopupMenu(itemView.getContext(), itemView);
    final Menu popupMenu = popup.getMenu();

    final MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.list_item_media, popupMenu);

    final Media item = getItem(position);
    popup.setOnMenuItemClickListener(menuItem -> onMenuItemClick(menuItem, item));
    popup.show();
}
 
开发者ID:Doctoror,项目名称:PainlessMusicPlayer,代码行数:12,代码来源:QueueRecyclerAdapter.java

示例14: onMenuClicked

import android.widget.PopupMenu; //导入方法依赖的package包/类
public void onMenuClicked(View v, @NonNull RepoFile item) {
        if (isRefreshing) return;

        boolean isOwner = repoDetailViewModel.isOwnerOrCollaborator();

        PopupMenu popup = new PopupMenu(getContext(), v);
        MenuInflater inflater = popup.getMenuInflater();
        inflater.inflate(R.menu.download_share_menu, popup.getMenu());
        popup.getMenu().findItem(R.id.download).setVisible(item.getType() == FilesType.file);
        boolean canOpen = canOpen(item);
        popup.getMenu().findItem(R.id.editFile).setVisible(isOwner && item.getType() == FilesType.file && canOpen);
        popup.getMenu().findItem(R.id.deleteFile).setVisible(isOwner && item.getType() == FilesType.file);
        popup.setOnMenuItemClickListener(item1 -> {
            switch (item1.getItemId()) {
                case R.id.share:
                    ActivityHelper.shareUrl(getContext(), item.getHtmlUrl());
                    break;
                case R.id.download:
                    if (ActivityHelper.checkAndRequestReadWritePermission(getActivity())) {
                        DownloadHelper.downloadFile(getContext().getApplicationContext(), item.getDownloadUrl());
                    }
                    break;
                case R.id.copy:
                    AppHelper.copyToClipboard(getContext(), !InputHelper.isEmpty(item.getHtmlUrl()) ? item.getHtmlUrl() : item.getUrl());
                    break;
                case R.id.editFile:
                    AlertUtils.showToastShortMessage(getContext(), "Coming soon...");
//                    if (PrefGetter.isProEnabled() || PrefGetter.isAllFeaturesUnlocked()) {
//                        if (canOpen) {
//                            EditRepoFileModel fileModel = new EditRepoFileModel(getPresenter().login, getPresenter().repoId,
//                                    item.getPath(), getPresenter().ref, item.getSha(), item.getDownloadUrl(), item.getName(), true);
//                            EditRepoFileActivity.Companion.startForResult(this, fileModel, isEnterprise());
//                        }
//                    } else {
//                        PremiumActivity.Companion.startActivity(getContext());
//                    }
                    break;
                case R.id.deleteFile:
                    AlertUtils.showToastShortMessage(getContext(), "Coming soon...");
//                    if (PrefGetter.isProEnabled() || PrefGetter.isAllFeaturesUnlocked()) {
//                        DeleteFileBottomSheetFragment.Companion.newInstance(position, item.getName())
//                                .show(getChildFragmentManager(), DeleteFileBottomSheetFragment.class.getSimpleName());
//                    } else {
//                        PremiumActivity.Companion.startActivity(getContext());
//                    }
                    break;
            }
            return true;
        });
        popup.show();
    }
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:52,代码来源:RepoFilesFragment.java

示例15: onClick

import android.widget.PopupMenu; //导入方法依赖的package包/类
@Override
public void onClick(View buttonView) {
    PopupMenu popup = new PopupMenu(parentActivity, buttonView);
    MenuInflater inflater = popup.getMenuInflater();
    JVCParser.MessageInfos itemSelected;

    currentItemIdSelected = (int) buttonView.getTag();
    itemSelected = getItem(currentItemIdSelected);
    popup.setOnMenuItemClickListener(actionWhenItemMenuClicked);

    if (!itemSelected.pseudoIsBlacklisted) {
        if (itemSelected.pseudo.toLowerCase().equals(currentSettings.pseudoOfUser.toLowerCase())) {
            inflater.inflate(R.menu.menu_message_user, popup.getMenu());
        } else if (userIsModo) {
            inflater.inflate(R.menu.menu_message_moderable, popup.getMenu());
        } else {
            inflater.inflate(R.menu.menu_message_others, popup.getMenu());
        }

        if (itemSelected.numberOfOverlyQuote > currentSettings.maxNumberOfOverlyQuotes) {
            if (itemSelected.showOverlyQuote) {
                popup.getMenu().add(Menu.NONE, R.id.menu_hide_quote_message, Menu.NONE, R.string.hideQuoteMessage);
            } else {
                popup.getMenu().add(Menu.NONE, R.id.menu_show_quote_message, Menu.NONE, R.string.showQuoteMessage);
            }
        }

        if (itemSelected.messageContentContainSpoil || (showSignatures && itemSelected.signatureContainSpoil)) {
            if (itemSelected.listOfSpoilIdToShow.isEmpty()) {
                popup.getMenu().add(Menu.NONE, R.id.menu_show_spoil_message, Menu.NONE, R.string.showSpoilMessage);
            } else {
                popup.getMenu().add(Menu.NONE, R.id.menu_hide_spoil_message, Menu.NONE, R.string.hideSpoilMessage);
            }
        }

        if (currentSettings.hideUglyImages && itemSelected.containUglyImages) {
            if (itemSelected.showUglyImages) {
                popup.getMenu().add(Menu.NONE, R.id.menu_hide_ugly_images_message, Menu.NONE, R.string.hideUglyImagesMessage);
            } else {
                popup.getMenu().add(Menu.NONE, R.id.menu_show_ugly_images_message, Menu.NONE, R.string.showUglyImagesMessage);
            }
        }

        if (itemSelected.messageIsDeleted) {
            popup.getMenu().removeItem(R.id.menu_delete_message);
        }
    } else {
        popup.getMenu().add(Menu.NONE, R.id.menu_show_blacklisted_message, Menu.NONE, R.string.showBlacklistedMessage);
    }

    popup.show();
}
 
开发者ID:FranckRJ,项目名称:RespawnIRC-Android,代码行数:53,代码来源:JVCTopicAdapter.java


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