Search in sources :

Example 1 with Menu

use of com.actionbarsherlock.view.Menu in project mobile-android by photo.

the class UploadManagerFragment method onItemClick.

@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    TrackerUtils.trackButtonClickEvent("upload_manager_item", UploadManagerFragment.this);
    mSelectedItem = mAdapter.getItem(position);
    PopupMenu contextMenu = new PopupMenu(getActivity(), view);
    contextMenu.setOnMenuItemClickListener(mOnMenuItemClickListener);
    MenuInflater inflater = getSupportActivity().getSupportMenuInflater();
    Menu menu = contextMenu.getMenu();
    inflater.inflate(R.menu.upload_manager_item, menu);
    UploadStatus uploadStatus = mSelectedItem.getUploadStatus();
    if (uploadStatus == UploadStatus.DONE) {
        menu.findItem(R.id.menu_cancel).setVisible(false);
    } else {
        menu.findItem(R.id.menu_clear).setVisible(false);
    }
    contextMenu.show();
}
Also used : MenuInflater(com.actionbarsherlock.view.MenuInflater) UploadStatus(com.trovebox.android.common.fragment.upload.UploadManagerFragment.PhotoUploadWrapper.UploadStatus) Menu(com.actionbarsherlock.view.Menu) PopupMenu(org.holoeverywhere.widget.PopupMenu) PopupMenu(org.holoeverywhere.widget.PopupMenu)

Aggregations

Menu (com.actionbarsherlock.view.Menu)1 MenuInflater (com.actionbarsherlock.view.MenuInflater)1 UploadStatus (com.trovebox.android.common.fragment.upload.UploadManagerFragment.PhotoUploadWrapper.UploadStatus)1 PopupMenu (org.holoeverywhere.widget.PopupMenu)1