Example usage for android.widget PopupMenu PopupMenu

List of usage examples for android.widget PopupMenu PopupMenu

Introduction

In this page you can find the example usage for android.widget PopupMenu PopupMenu.

Prototype

public PopupMenu(Context context, View anchor) 

Source Link

Document

Constructor to create a new popup menu with an anchor view.

Usage

From source file:com.vrs.reqdroid.fragments.HipotesesFragment.java

/**
 * Mostra o PopUpMenu das opcoes da hipotese
 * Funciona apenas para a versao 3.0 ou superior do Android.
 *
 * @param v a view da hipotese// w w  w  .  jav  a2  s.co  m
 *
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
void exibePopupMenuOpcoes(final View v) {
    PopupMenu popupMenu = new PopupMenu(getActivity(), v);
    popupMenu.getMenuInflater().inflate(R.menu.menu_opcoes_hipotese, popupMenu.getMenu());

    popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
            case R.id.opcaoEditarHipotese:
                menuEdita();
                break;
            case R.id.opcaoValidarHipotese:
                menuValida();
                break;
            case R.id.opcaoDeletarHipotese:
                menuDeleta();
                break;
            }
            return true;
        }
    });
    popupMenu.show();
}

From source file:com.vrs.reqdroid.fragments.RequisitosFragment.java

/**
 * Mostra o PopUpMenu das opcoes do requisito.
 * Funciona apenas para a versao 3.0 ou superior do Android.
 *
 * @param v a view do requisito//w w  w  .  j a v  a  2  s  .co  m
 *
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void exibePopupMenuOpcoes(final View v) {
    PopupMenu popupMenu = new PopupMenu(getActivity(), v);
    popupMenu.getMenuInflater().inflate(R.menu.menu_opcoes_requisito, popupMenu.getMenu());

    popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
            case R.id.opcaoEditarRequisito:
                menuEdita();
                break;
            case R.id.opcaoMoverRequisito:
                menuMove();
                break;
            case R.id.opcaoDeletarRequisito:
                menuDeleta();
                break;
            }
            return true;
        }
    });
    popupMenu.show();
}

From source file:com.twolinessoftware.smarterlist.activity.MainNavigationActivity.java

@Subscribe
public void onOverflowActionSelected(OnOverflowSelectedEvent event) {

    Ln.v("Showing Action Menu for " + event.getSmartList().getName());

    m_smartListSelected = event.getSmartList();

    m_popUpMenu = new PopupMenu(MainNavigationActivity.this, event.getAnchorView());
    if (m_accountUtils.isOwner(m_smartListSelected)) {
        m_popUpMenu.inflate(R.menu.popup_smartlist);
    } else {/*from w  w w . j a  v  a  2  s. c  o m*/
        m_popUpMenu.inflate(R.menu.popup_smartlist_shared);
    }

    m_popUpMenu.setOnMenuItemClickListener(this);
    m_popUpMenu.show();

}

From source file:com.battlelancer.seriesguide.ui.SeasonsFragment.java

private void setCollectedToggleState(int uncollectedEpisodes) {
    mCollectedAllEpisodes = uncollectedEpisodes == 0;
    mButtonCollectedAll.setImageResource(mCollectedAllEpisodes ? R.drawable.ic_collected_all
            : Utils.resolveAttributeToResourceId(getActivity().getTheme(), R.attr.drawableCollectAll));
    // set onClick listener not before here to avoid unexpected actions
    mButtonCollectedAll.setOnClickListener(new OnClickListener() {
        @Override/*  w  w  w . j  a  va2s . com*/
        public void onClick(View v) {
            PopupMenu popupMenu = new PopupMenu(v.getContext(), v);
            if (mCollectedAllEpisodes) {
                popupMenu.getMenu().add(0, CONTEXT_COLLECTED_SHOW_NONE_ID, 0, R.string.uncollect_all);
            } else {
                popupMenu.getMenu().add(0, CONTEXT_COLLECTED_SHOW_ALL_ID, 0, R.string.collect_all);
            }
            popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    switch (item.getItemId()) {
                    case CONTEXT_COLLECTED_SHOW_ALL_ID: {
                        onFlagShowCollected(true);
                        fireTrackerEvent("Flag all collected (inline)");
                        return true;
                    }
                    case CONTEXT_COLLECTED_SHOW_NONE_ID: {
                        onFlagShowCollected(false);
                        fireTrackerEvent("Flag all uncollected (inline)");
                        return true;
                    }
                    }
                    return false;
                }
            });
            popupMenu.show();
        }
    });
    CheatSheet.setup(mButtonCollectedAll,
            mCollectedAllEpisodes ? R.string.uncollect_all : R.string.collect_all);
}

From source file:org.alfresco.mobile.android.application.fragments.fileexplorer.LibraryCursorAdapter.java

@Override
protected void updateIcon(TwoLinesViewHolder vh, Cursor cursor) {
    String data = cursor.getString(cursor.getColumnIndex(MediaStore.Files.FileColumns.DATA));
    File f = new File(data);

    switch (mediaTypeId) {
    case MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE:
        vh.icon.setImageResource(R.drawable.mime_img);
        renditionManager.getPicasso().load(f).resize(150, 150).centerCrop().placeholder(R.drawable.mime_256_img)
                .error(R.drawable.mime_256_img).into(vh.icon);
        break;//  w  w w  .j  a  v  a2  s .com
    case MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO:
        vh.icon.setImageResource(R.drawable.mime_video);
        break;
    case MediaStore.Files.FileColumns.MEDIA_TYPE_AUDIO:
        vh.icon.setImageResource(R.drawable.mime_audio);
        break;
    default:
        Uri uri = Uri.parse(cursor.getString(cursor.getColumnIndex(MediaStore.Files.FileColumns.DATA)));
        vh.icon.setImageResource(MimeTypeManager.getInstance(context).getIcon(uri.getLastPathSegment()));
        break;
    }

    if (mode == FileExplorerFragment.MODE_LISTING && fragmentRef.get().getActivity() instanceof MainActivity) {
        vh.choose.setImageResource(R.drawable.ic_more_options);
        vh.choose.setBackgroundResource(R.drawable.alfrescohololight_list_selector_holo_light);
        int d_16 = DisplayUtils.getPixels(context, R.dimen.d_16);
        vh.choose.setPadding(d_16, d_16, d_16, d_16);
        vh.choose.setVisibility(View.VISIBLE);
        vh.choose.setTag(R.id.node_action, f);
        vh.choose.setOnClickListener(new OnClickListener() {

            @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
            @Override
            public void onClick(View v) {
                File item = (File) v.getTag(R.id.node_action);
                selectedOptionItems.add(item);
                PopupMenu popup = new PopupMenu(context, v);
                getMenu(popup.getMenu(), item);
                popup.setOnDismissListener(new OnDismissListener() {
                    @Override
                    public void onDismiss(PopupMenu menu) {
                        selectedOptionItems.clear();
                    }
                });

                popup.setOnMenuItemClickListener(LibraryCursorAdapter.this);

                popup.show();
            }
        });
    } else {
        UIUtils.setBackground(vh.choose, null);
        vh.choose.setVisibility(View.GONE);
    }
}

From source file:org.rm3l.ddwrt.tiles.admin.nvram.AdminNVRAMTile.java

public AdminNVRAMTile(@NotNull SherlockFragment parentFragment, @NotNull Bundle arguments,
        @Nullable Router router) {//w w w  .j a v a 2s .  c o  m
    super(parentFragment, arguments, router, R.layout.tile_admin_nvram, R.id.tile_admin_nvram_togglebutton);

    sortIds.put(R.id.tile_admin_nvram_sort_default, 11);
    sortIds.put(R.id.tile_admin_nvram_sort_asc, 12);
    sortIds.put(R.id.tile_admin_nvram_sort_desc, 13);

    this.mNvramInfoDefaultSorting = new NVRAMInfo();
    mRecyclerView = (RecyclerView) layout.findViewById(R.id.tile_admin_nvram_ListView);

    // use this setting to improve performance if you know that changes
    // in content do not change the layout size of the RecyclerView
    // allows for optimizations if all items are of the same size:
    mRecyclerView.setHasFixedSize(true);

    // use a linear layout manager
    mLayoutManager = new LinearLayoutManager(mParentFragmentActivity);
    mLayoutManager.scrollToPosition(0);
    mRecyclerView.setLayoutManager(mLayoutManager);

    // specify an adapter (see also next example)
    mAdapter = new NVRAMDataRecyclerViewAdapter(mParentFragmentActivity, router, mNvramInfoDefaultSorting);
    mRecyclerView.setAdapter(mAdapter);

    //Create Options Menu
    final ImageButton tileMenu = (ImageButton) layout.findViewById(R.id.tile_admin_nvram_menu);

    if (!isThemeLight(mParentFragmentActivity, mRouter.getUuid())) {
        //Set menu background to white
        tileMenu.setImageResource(R.drawable.abs__ic_menu_moreoverflow_normal_holo_dark);
    }

    tileMenu.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            final PopupMenu popup = new PopupMenu(mParentFragmentActivity, v);
            popup.setOnMenuItemClickListener(AdminNVRAMTile.this);
            final MenuInflater inflater = popup.getMenuInflater();

            final Menu menu = popup.getMenu();

            inflater.inflate(R.menu.tile_admin_nvram_options, menu);

            //Disable menu item from preference
            Integer currentSort = null;
            if (mParentFragmentPreferences != null) {
                currentSort = sortIds.inverse().get(mParentFragmentPreferences.getInt(getFormattedPrefKey(SORT),
                        sortIds.get(R.id.tile_admin_nvram_sort_default)));
            }

            if (currentSort == null) {
                currentSort = R.id.tile_admin_nvram_sort_default;
            }

            final MenuItem currentSortMenuItem = menu.findItem(currentSort);
            if (currentSortMenuItem != null) {
                currentSortMenuItem.setEnabled(false);
            }

            // Locate MenuItem with ShareActionProvider
            final MenuItem shareMenuItem = menu.findItem(R.id.tile_admin_nvram_share);

            // Fetch and store ShareActionProvider
            mShareActionProvider = (ShareActionProvider) shareMenuItem.getActionProvider();

            popup.show();
        }

    });

    //Handle for Search EditText
    final EditText filterEditText = (EditText) this.layout.findViewById(R.id.tile_admin_nvram_filter);
    //Initialize with existing search data
    filterEditText.setText(mParentFragmentPreferences != null
            ? mParentFragmentPreferences.getString(getFormattedPrefKey(LAST_SEARCH), EMPTY_STRING)
            : EMPTY_STRING);

    filterEditText.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            final int DRAWABLE_LEFT = 0;
            final int DRAWABLE_TOP = 1;
            final int DRAWABLE_RIGHT = 2;
            final int DRAWABLE_BOTTOM = 3;

            if (event.getAction() == MotionEvent.ACTION_UP) {
                if (event.getRawX() >= (filterEditText.getRight()
                        - filterEditText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) {
                    //'Clear' button - clear data, and reset everything out
                    //Reset everything
                    filterEditText.setText(EMPTY_STRING);

                    final Properties mNvramInfoDefaultSortingData = mNvramInfoDefaultSorting.getData();
                    //Update adapter in the preferences
                    if (mParentFragmentPreferences != null) {
                        final Integer currentSort = sortIds.inverse()
                                .get(mParentFragmentPreferences.getInt(getFormattedPrefKey(SORT), -1));
                        if (currentSort == null || currentSort <= 0) {
                            mNvramInfoToDisplay = new HashMap<>(mNvramInfoDefaultSortingData);
                        } else {
                            switch (currentSort) {
                            case R.id.tile_admin_nvram_sort_asc:
                                //asc
                                mNvramInfoToDisplay = new TreeMap<>(COMPARATOR_STRING_CASE_INSENSITIVE);
                                break;
                            case R.id.tile_admin_nvram_sort_desc:
                                //desc
                                mNvramInfoToDisplay = new TreeMap<>(COMPARATOR_REVERSE_STRING_CASE_INSENSITIVE);
                                break;
                            case R.id.tile_admin_nvram_sort_default:
                            default:
                                mNvramInfoToDisplay = new HashMap<>();
                                break;
                            }
                            mNvramInfoToDisplay.putAll(mNvramInfoDefaultSortingData);
                        }
                    } else {
                        mNvramInfoToDisplay = new HashMap<>(mNvramInfoDefaultSortingData);
                    }

                    ((NVRAMDataRecyclerViewAdapter) mAdapter).setEntryList(mNvramInfoToDisplay);
                    mAdapter.notifyDataSetChanged();

                    if (mParentFragmentPreferences != null) {
                        final SharedPreferences.Editor editor = mParentFragmentPreferences.edit();
                        editor.putString(getFormattedPrefKey(LAST_SEARCH), EMPTY_STRING);
                        editor.apply();
                    }
                    return true;
                }
            }
            return false;
        }
    });

    filterEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {

            if (actionId == EditorInfo.IME_ACTION_SEARCH) {
                final String textToFind = filterEditText.getText().toString();
                if (isNullOrEmpty(textToFind)) {
                    //extra-check, even though we can be pretty sure the button is enabled only if textToFind is present
                    return true;
                }
                final String existingSearch = mParentFragmentPreferences != null
                        ? mParentFragmentPreferences.getString(getFormattedPrefKey(LAST_SEARCH), null)
                        : null;

                if (mParentFragmentPreferences != null) {
                    if (textToFind.equalsIgnoreCase(existingSearch)) {
                        //No need to go further as this is already the string we are looking for
                        return true;
                    }
                    final SharedPreferences.Editor editor = mParentFragmentPreferences.edit();
                    editor.putString(getFormattedPrefKey(LAST_SEARCH), textToFind);
                    editor.apply();
                }

                //Filter out (and sort by user-preference)
                final Properties mNvramInfoDefaultSortingData = mNvramInfoDefaultSorting.getData();
                //Update adapter in the preferences
                final Map<Object, Object> mNvramInfoToDisplayCopy;
                if (mParentFragmentPreferences != null) {
                    final Integer currentSort = sortIds.inverse()
                            .get(mParentFragmentPreferences.getInt(getFormattedPrefKey(SORT), -1));
                    if (currentSort == null || currentSort <= 0) {
                        mNvramInfoToDisplayCopy = new HashMap<>(mNvramInfoDefaultSortingData);
                    } else {
                        switch (currentSort) {
                        case R.id.tile_admin_nvram_sort_asc:
                            //asc
                            mNvramInfoToDisplayCopy = new TreeMap<>(COMPARATOR_STRING_CASE_INSENSITIVE);
                            break;
                        case R.id.tile_admin_nvram_sort_desc:
                            //desc
                            mNvramInfoToDisplayCopy = new TreeMap<>(COMPARATOR_REVERSE_STRING_CASE_INSENSITIVE);
                            break;
                        case R.id.tile_admin_nvram_sort_default:
                        default:
                            mNvramInfoToDisplayCopy = new HashMap<>();
                            break;
                        }
                        //noinspection ConstantConditions
                        for (Map.Entry<Object, Object> entry : mNvramInfoDefaultSortingData.entrySet()) {
                            final Object key = entry.getKey();
                            final Object value = entry.getValue();
                            if (key == null) {
                                continue;
                            }
                            if (containsIgnoreCase(key.toString(), textToFind)
                                    || containsIgnoreCase(value.toString(), textToFind)) {
                                mNvramInfoToDisplayCopy.put(key, value);
                            }
                        }
                    }
                } else {
                    mNvramInfoToDisplayCopy = new HashMap<>();
                    //noinspection ConstantConditions
                    for (Map.Entry<Object, Object> entry : mNvramInfoDefaultSortingData.entrySet()) {
                        final Object key = entry.getKey();
                        final Object value = entry.getValue();
                        if (key == null) {
                            continue;
                        }
                        if (containsIgnoreCase(key.toString(), textToFind)
                                || containsIgnoreCase(value.toString(), textToFind)) {
                            mNvramInfoToDisplayCopy.put(key, value);
                        }
                    }
                }

                ((NVRAMDataRecyclerViewAdapter) mAdapter).setEntryList(mNvramInfoToDisplayCopy);
                mAdapter.notifyDataSetChanged();

                return true;
            }
            return false;
        }
    });

}

From source file:com.android.deskclock.DeskClock.java

private void showMenu(View v) {
    PopupMenu popupMenu = new PopupMenu(this, v);
    popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        @Override// w w w  .  j  av  a  2 s  . c o m
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
            case R.id.menu_item_settings:
                startActivity(new Intent(DeskClock.this, SettingsActivity.class));
                return true;
            case R.id.menu_item_help:
                Intent i = item.getIntent();
                if (i != null) {
                    try {
                        startActivity(i);
                    } catch (ActivityNotFoundException e) {
                        // No activity found to match the intent - ignore
                    }
                }
                return true;
            case R.id.menu_item_night_mode:
                startActivity(new Intent(DeskClock.this, ScreensaverActivity.class));
            default:
                break;
            }
            return true;
        }
    });
    popupMenu.inflate(R.menu.desk_clock_menu);

    Menu menu = popupMenu.getMenu();
    MenuItem help = menu.findItem(R.id.menu_item_help);
    if (help != null) {
        Utils.prepareHelpMenuItem(this, help);
    }
    popupMenu.show();
}

From source file:com.vrs.reqdroid.fragments.RequisitosAtrasadosFragment.java

/**
 * Mostra o PopUpMenu das opcoes do requisito.
 * Funciona apenas para a versao 3.0 ou superior do Android.
 *
 * @param v a view do requisito//w ww  .  j  a  v  a  2s . c o  m
 *
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void exibePopupMenuOpcoes(final View v) {
    PopupMenu popupMenu = new PopupMenu(getActivity(), v);
    popupMenu.getMenuInflater().inflate(R.menu.menu_opcoes_requisito_atrasado, popupMenu.getMenu());

    popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
            case R.id.opcaoEditarRequisitoAtrasado:
                menuEdita();
                break;
            case R.id.opcaoMoverRequisitoAtrasado:
                menuMove();
                break;
            case R.id.opcaoDeletarRequisitoAtrasado:
                menuDeleta();
                break;
            }
            return true;
        }
    });
    popupMenu.show();
}

From source file:com.arcgis.android.samples.localdata.localrasterdata.FileBrowserFragment.java

private void initializeFileListView() {
    ListView lView = (ListView) (getView().findViewById(R.id.fileListView));
    lView.setBackgroundColor(Color.LTGRAY);
    LinearLayout.LayoutParams lParam = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT);//from w  w  w  . j  a v a 2 s.  co m
    lParam.setMargins(15, 5, 15, 5);
    lView.setAdapter(this.adapter);
    lView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            chosenFile = fileList.get(position).file;
            final File sel = new File(path + "/" + chosenFile);
            if (sel.isDirectory()) {
                // Directory
                if (sel.canRead()) {
                    // Adds chosen directory to list
                    pathDirsList.add(chosenFile);
                    path = new File(sel + "");
                    loadFileList();
                    adapter.notifyDataSetChanged();
                    updateCurrentDirectoryTextView();
                } else {
                    showToast("Path does not exist or cannot be read");
                }
            } else {
                // File picked or an empty directory message clicked
                if (!mDirectoryShownIsEmpty) {
                    // show a popup menu to allow users to open a raster layer for
                    // different purpose including basemap layer, operational layer,
                    // elevation data source for BlendRenderer, or some combinations.
                    PopupMenu popupMenu = new PopupMenu(getActivity(), view);
                    popupMenu.inflate(R.menu.file_browser_popup_menu);
                    popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {

                        @Override
                        public boolean onMenuItemClick(MenuItem item) {
                            switch (item.getItemId()) {
                            case R.id.menu_raster_base_layer:
                                returnFileFinishActivity(sel.getAbsolutePath(),
                                        RasterLayerAction.BASEMAP_LAYER);
                                break;
                            case R.id.menu_raster_operational_layer:
                                returnFileFinishActivity(sel.getAbsolutePath(),
                                        RasterLayerAction.OPERATIONAL_LAYER);
                                break;
                            case R.id.menu_raster_elevation_source:
                                returnFileFinishActivity(sel.getAbsolutePath(),
                                        RasterLayerAction.ELEVATION_SOURCE);
                                break;
                            case R.id.menu_raster_base_elevation:
                                returnFileFinishActivity(sel.getAbsolutePath(),
                                        RasterLayerAction.BASEMAP_LAYER_AND_ELEVATION_SOURCE);
                                break;
                            case R.id.menu_raster_operational_elevation:
                                returnFileFinishActivity(sel.getAbsolutePath(),
                                        RasterLayerAction.OPERATIONAL_LAYER_AND_ELEVATION_SOURCE);
                                break;
                            }
                            return true;
                        }
                    });
                    popupMenu.show();
                }
            }
        }
    });

}

From source file:org.alfresco.mobile.android.application.fragments.fileexplorer.FileExplorerAdapter.java

@Override
protected void updateIcon(TwoLinesProgressViewHolder vh, File item) {
    if (item.isFile()) {
        Drawable drawable = getContext().getResources()
                .getDrawable(MimeTypeManager.getInstance(getContext()).getIcon(item.getName()));
        renditionManager.getPicasso().load(item).placeholder(drawable).error(drawable).into(vh.icon);
        AccessibilityUtils.addContentDescription(vh.icon, R.string.mime_document);
    } else if (item.isDirectory()) {
        vh.icon.setImageDrawable(getContext().getResources().getDrawable(R.drawable.mime_folder));
        AccessibilityUtils.addContentDescription(vh.icon, R.string.mime_folder);
    }//  w  w  w .jav  a  2s .com

    if (mode == FileExplorerFragment.MODE_LISTING && fragmentRef.get().getActivity() instanceof MainActivity
            && ((downloadPath != null && item.getPath().startsWith(downloadPath)) || (item.isFile()))) {
        vh.choose.setImageResource(R.drawable.ic_more_options);
        vh.choose.setBackgroundResource(R.drawable.alfrescohololight_list_selector_holo_light);
        int d_16 = DisplayUtils.getPixels(getContext(), R.dimen.d_16);
        vh.choose.setPadding(d_16, d_16, d_16, d_16);
        vh.choose.setVisibility(View.VISIBLE);
        AccessibilityUtils.addContentDescription(vh.choose,
                String.format(getContext().getString(R.string.more_options_file), item.getName()));
        vh.choose.setTag(R.id.node_action, item);
        vh.choose.setOnClickListener(new OnClickListener() {

            @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
            @Override
            public void onClick(View v) {
                File item = (File) v.getTag(R.id.node_action);
                selectedOptionItems.add(item);
                PopupMenu popup = new PopupMenu(getContext(), v);
                getMenu(popup.getMenu(), item);
                popup.setOnDismissListener(new OnDismissListener() {
                    @Override
                    public void onDismiss(PopupMenu menu) {
                        selectedOptionItems.clear();
                    }
                });

                popup.setOnMenuItemClickListener(FileExplorerAdapter.this);

                popup.show();
            }
        });
    } else {
        UIUtils.setBackground(vh.choose, null);
        vh.choose.setVisibility(View.GONE);
    }
}