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


Java ContextMenu类代码示例

本文整理汇总了Java中android.view.ContextMenu的典型用法代码示例。如果您正苦于以下问题:Java ContextMenu类的具体用法?Java ContextMenu怎么用?Java ContextMenu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onCreateContextMenu

import android.view.ContextMenu; //导入依赖的package包/类
@Override
    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
        super.onCreateContextMenu(menu, v, menuInfo);
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
        MainActivity.BlockModel model = models.get(info.position);
        if (deleteList.size() > 0) {
            menu.add(0, 4, Menu.NONE, R.string.delete_selections);
            menu.add(0, 5, Menu.NONE, R.string.share_selections);
            return;
        }
        menu.add(0, 1, Menu.NONE, R.string.delete_item);
//        if (!model.className.equals("*")) {
//            menu.add(0, 2, Menu.NONE, "设为不按类名定位");
//        }
        menu.add(0, 3, Menu.NONE, R.string.share);
        menu.add(0, 6, Menu.NONE, model.enable ?R.string.disable_item: R.string.enable_item);
    }
 
开发者ID:w568w,项目名称:fuckView,代码行数:18,代码来源:MainFragment.java

示例2: initializeItems

import android.view.ContextMenu; //导入依赖的package包/类
public void initializeItems(ContextMenu menu) {
	TGContext context = findContext();
	TGCaret caret = TGSongViewController.getInstance(context).getCaret();
	TGNote note = caret.getSelectedNote();
	boolean restBeat = caret.isRestBeatSelected();
	boolean running = TuxGuitar.getInstance(context).getPlayer().isRunning();
	
	this.initializeItem(menu, R.id.menu_beat_change_tied_note, this.createActionProcessor(TGChangeTiedNoteAction.NAME), !running, note != null && note.isTiedNote());
	this.initializeItem(menu, R.id.menu_beat_clean_beat, this.createActionProcessor(TGCleanBeatAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_beat_decrement_note_semitone, this.createActionProcessor(TGDecrementNoteSemitoneAction.NAME), (!running && note != null));
	this.initializeItem(menu, R.id.menu_beat_delete_note_or_rest, this.createActionProcessor(TGDeleteNoteOrRestAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_beat_increment_note_semitone, this.createActionProcessor(TGIncrementNoteSemitoneAction.NAME), (!running && note != null));
	this.initializeItem(menu, R.id.menu_beat_insert_rest_beat, this.createActionProcessor(TGInsertRestBeatAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_beat_move_beats_left, this.createActionProcessor(TGMoveBeatsLeftAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_beat_move_beats_right, this.createActionProcessor(TGMoveBeatsRightAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_beat_remove_unused_voice, this.createActionProcessor(TGRemoveUnusedVoiceAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_beat_set_voice_auto, this.createActionProcessor(TGSetVoiceAutoAction.NAME), (!running && !restBeat));
	this.initializeItem(menu, R.id.menu_beat_set_voice_down, this.createActionProcessor(TGSetVoiceDownAction.NAME), (!running && !restBeat));
	this.initializeItem(menu, R.id.menu_beat_set_voice_up, this.createActionProcessor(TGSetVoiceUpAction.NAME), (!running && !restBeat));
	this.initializeItem(menu, R.id.menu_beat_shift_note_down, this.createActionProcessor(TGShiftNoteDownAction.NAME), (!running && note != null));
	this.initializeItem(menu, R.id.menu_beat_shift_note_up, this.createActionProcessor(TGShiftNoteUpAction.NAME), (!running && note != null));
	this.initializeItem(menu, R.id.menu_beat_stroke, new TGStrokeDialogController(), !running);
	this.initializeItem(menu, R.id.menu_beat_edit_text, new TGTextDialogController(), !running);
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:25,代码来源:TGBeatMenu.java

示例3: onCreateContextMenu

import android.view.ContextMenu; //导入依赖的package包/类
/**
 * Creates context menu for certain actions on a specific item.
 */
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
                                ContextMenuInfo menuInfo) {
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    if (v instanceof ListView) {
        ListView listView = (ListView) v;
        Object item = listView.getAdapter().getItem(info.position);
        if (item instanceof DIDLObject) {
            selectedDIDLObject = (DIDLObject) item;
        }
    }
    menu.setHeaderTitle(v.getContext().getString(
            R.string.browse_context_title));
    ArrayList<String> menuItems = new ArrayList<String>();
    menuItems.add(v.getContext().getString(R.string.browse_context_play_all));
    menuItems.add(v.getContext().getString(R.string.browse_context_play));
    //menuItems.add(v.getContext().getString( R.string.browse_context_add_to_playplist));
    menuItems.add(v.getContext()
            .getString(R.string.browse_context_download));
    for (int i = 0; i < menuItems.size(); i++) {
        menu.add(Menu.NONE, i, i, menuItems.get(i));
    }
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:27,代码来源:ContentListActivity.java

示例4: onCreateContextMenu

import android.view.ContextMenu; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo)
{
    try
    {
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
        if (info != null)
        {
            fileListView.setSelection(info.position, 0);
        }
        menu.setHeaderTitle(R.string.fman_operation);
        AdapterIf ca = getListAdapter();
        ca.populateContextMenu(menu, info, fileListView.getSelected());
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:20,代码来源:Commander.java

示例5: onCreateContextMenu

import android.view.ContextMenu; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, view, menuInfo);

    // Show the name of the file in the header
    AdapterContextMenuInfo adapterMenuInfo = (AdapterContextMenuInfo)menuInfo;
    int position = adapterMenuInfo.position;
    mActivityFileCursor.moveToPosition(position);
    String path = mActivityFileCursor.getString(mDataIndex);
    MetaFile file = MetaFile.from(path);
    menu.setHeaderTitle(file.getName());

    // Add the context menu items
    menu.add(0, R.string.info, 0, R.string.info);

    // Save the path, we will need it when an entry of the menu is selected
    mContextMenuPath = path;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:19,代码来源:AutoScraperActivity.java

示例6: onCreateContextMenu

import android.view.ContextMenu; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    if (!canCreateContextMenu(menu, menuInfo)) {
        return;
    }
    menu.clear();
    ViewHolder holder = (ViewHolder) ((AdapterContextMenuInfo) menuInfo).targetView.getTag();
    menu.setHeaderTitle(holder.nameView.getText());
    if (holder.icon != null) {
        setHeaderIcon(menu, holder.icon);
    }
    menu.add(Menu.NONE, R.string.app_info, Menu.NONE, R.string.app_info);
    updatePreventMenu(menu, holder.packageName);
    if (getMainIntent(holder.packageName) != null) {
        menu.add(Menu.NONE, R.string.open, Menu.NONE, R.string.open);
    }
    if (holder.canUninstall) {
        menu.add(Menu.NONE, R.string.uninstall, Menu.NONE, R.string.uninstall);
    }
    if (appNotification) {
        menu.add(Menu.NONE, R.string.app_notifications, Menu.NONE, R.string.app_notifications);
    }
}
 
开发者ID:brevent,项目名称:prevent,代码行数:24,代码来源:PreventFragment.java

示例7: onCreateContextMenu

import android.view.ContextMenu; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {  
	super.onCreateContextMenu(menu, v, menuInfo);
	if (v.getTag() instanceof InputKeyReference)	{
		menu.setHeaderTitle(R.string.what_do_you_want);
		menu.add(0, KEY_CONTEXT_MENU_CUT, 0, R.string.cut_key);  
		menu.add(0, KEY_CONTEXT_MENU_COPY, 0, R.string.copy_key);  
		if (minputKeyRefClipboard.isEmpty() == false)	{
			menu.add(0, KEY_CONTEXT_MENU_PASTE_BEFORE, 0, R.string.paste_before_key);  
			menu.add(0, KEY_CONTEXT_MENU_PASTE_ON, 0, R.string.paste_on_key);
			menu.add(0, KEY_CONTEXT_MENU_PASTE_AFTER, 0, R.string.paste_after_key);
		}
		menu.add(0, KEY_CONTEXT_MENU_CREATE_BEFORE, 0, R.string.create_before_key);  
		menu.add(0, KEY_CONTEXT_MENU_CREATE_AFTER, 0, R.string.create_after_key);  
		menu.add(0, KEY_CONTEXT_MENU_DELETE, 0, R.string.delete_key);  
		menu.add(0, KEY_CONTEXT_MENU_EDIT, 0, R.string.edit_key); 
		// should not use assign, i.e. minputKeyRefUnderOpt = v.getTag()
		// cause minputKeyRefUnderOpt and tag may change in different scenarios
		minputKeyRefUnderOpt.copy((InputKeyReference) v.getTag());
	}
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:22,代码来源:ActivityCfgKeyPad.java

示例8: onCreateContextMenu

import android.view.ContextMenu; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    switch (v.getId()) {
        case R.id.listView:
            AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;

            NoteRef noteRef = mNoteRefList.get(info.position);
            boolean linked = noteRef.isLinked();
            menu.setHeaderTitle(noteRef.getTitle());

            String[] menuItems = getResources().getStringArray(R.array.notes_context_menu);
            for (int i = 0; i < menuItems.length; i++) {
                if (linked && (i == 0 || i == 3)) {
                    // share public link and delete
                    continue;
                }

                menu.add(Menu.NONE, i, i, menuItems[i]);
            }
            break;

        default:
            super.onCreateContextMenu(menu, v, menuInfo);
            break;
    }
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:27,代码来源:NoteListFragment.java

示例9: onCreateContextMenu

import android.view.ContextMenu; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    int id = v.getId();
    switch (id) {
        case R.id.avatar:
            getMenuInflater().inflate(R.menu.activity_detail_teacher_change_avatar_context_menu, menu);
            menu.setHeaderTitle(R.string.change_avatar);
            view_ShowMenu = img_avatar;
            break;

        case R.id.background:
            getMenuInflater().inflate(R.menu.activity_detail_teacher_change_background_context_menu, menu);
            menu.setHeaderTitle(R.string.change_background);
            view_ShowMenu = img_background;
            break;
    }
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:20,代码来源:DetailTeacherActivity.java

示例10: onCreateContextMenu

import android.view.ContextMenu; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    AdapterView.AdapterContextMenuInfo info;
    try {
         info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    } catch (ClassCastException e) {
        Log.e(THIS_FILE, "bad menuInfo", e);
        return;
    }

    HashMap<String, Object> codec = (HashMap<String, Object>) mAdapter.getItem(info.position);
    if (codec == null) {
        // If for some reason the requested item isn't available, do nothing
        return;
    }
    
    boolean isDisabled = ((Short)codec.get(CODEC_PRIORITY) == 0);
    menu.add(0, MENU_ITEM_ACTIVATE, 0, isDisabled ? R.string.activate : R.string.deactivate);
    
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:22,代码来源:CodecsFragment.java

示例11: onCreateContextMenu

import android.view.ContextMenu; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    final SipProfile account = profileFromContextMenuInfo(menuInfo);
    if(account == null) {
        return;
    }
    WizardInfo wizardInfos = WizardUtils.getWizardClass(account.wizard);

    // Setup the menu header
    menu.setHeaderTitle(account.display_name);
    if(wizardInfos != null) {
        menu.setHeaderIcon(wizardInfos.icon);
    }
    
    menu.add(0, MENU_ITEM_ACTIVATE, 0, account.active ? R.string.deactivate_account
            : R.string.activate_account);
    menu.add(0, MENU_ITEM_MODIFY, 0, R.string.modify_account);
    menu.add(0, MENU_ITEM_DELETE, 0, R.string.delete_account);
    menu.add(0, MENU_ITEM_WIZARD, 0, R.string.choose_wizard);

}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:23,代码来源:AccountsEditListFragment.java

示例12: onCreateContextMenu

import android.view.ContextMenu; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    mManager.getContextMenuManager().createContextMenu(
            menu, v, new ContextMenuManager.Delegate() {
                @Override
                public void openItem(int windowDisposition) {
                    mManager.openMostVisitedItem(windowDisposition, MostVisitedItem.this);
                }

                @Override
                public void removeItem() {
                    mManager.removeMostVisitedItem(MostVisitedItem.this);
                }

                @Override
                public String getUrl() {
                    return MostVisitedItem.this.getUrl();
                }

                @Override
                public boolean isItemSupported(@ContextMenuItemId int menuItemId) {
                    return true;
                }
            });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:26,代码来源:MostVisitedItem.java

示例13: initializeItems

import android.view.ContextMenu; //导入依赖的package包/类
public void initializeItems(ContextMenu menu) {
	TGContext context = findContext();
	TGCaret caret = TGSongViewController.getInstance(context).getCaret();
	TGTrack track = caret.getTrack();
	boolean running = TuxGuitar.getInstance(context).getPlayer().isRunning();
	
	this.initializeItem(menu, R.id.menu_track_add, this.createActionProcessor(TGAddNewTrackAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_track_remove, this.createActionProcessor(TGRemoveTrackAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_track_clone, this.createActionProcessor(TGCloneTrackAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_track_move_up, this.createActionProcessor(TGMoveTrackUpAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_track_move_down, this.createActionProcessor(TGMoveTrackDownAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_track_change_solo, this.createActionProcessor(TGChangeTrackSoloAction.NAME), !running, track.isSolo());
	this.initializeItem(menu, R.id.menu_track_change_mute, this.createActionProcessor(TGChangeTrackMuteAction.NAME), !running, track.isMute());
	this.initializeItem(menu, R.id.menu_track_set_name, new TGTrackNameDialogController(), !running);
	this.initializeItem(menu, R.id.menu_track_set_channel, new TGTrackChannelDialogController(), !running);
	this.initializeItem(menu, R.id.menu_track_change_tuning, new TGTrackTuningDialogController(), !running);
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:18,代码来源:TGTrackMenu.java

示例14: onCreateContextMenu

import android.view.ContextMenu; //导入依赖的package包/类
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    getMenuInflater().inflate(R.menu.folder_context, menu);

    FolderInfoHolder folder = (FolderInfoHolder) mAdapter.getItem(info.position);

    menu.setHeaderTitle(folder.displayName);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:10,代码来源:FolderList.java

示例15: onCreateContextMenu

import android.view.ContextMenu; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    getActivity().getMenuInflater().inflate(R.menu.context_history, menu);
    if (mLastSelectedQuery != null) {
        menu.setHeaderTitle(mLastSelectedQuery.getData().from.getLocalizedName() + " - " + mLastSelectedQuery.getData().to.getLocalizedName());
    }
}
 
开发者ID:hyperrail,项目名称:hyperrail-for-android,代码行数:9,代码来源:RouteSearchFragment.java


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