Java Code Examples for android.view.ContextMenu

The following are top voted examples for showing how to use android.view.ContextMenu. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: fuckView   File: MainFragment.java   Source Code and License 6 votes vote down vote up
@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);
    }
 
Example 2
Project: tuxguitar   File: TGBeatMenu.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 3
Project: yaacc-code   File: ContentListActivity.java   Source Code and License 6 votes vote down vote up
/**
 * 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));
    }
}
 
Example 4
Project: microMathematics   File: Commander.java   Source Code and License 6 votes vote down vote up
@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();
    }
}
 
Example 5
Project: aos-Video   File: AutoScraperActivity.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 6
Project: prevent   File: PreventFragment.java   Source Code and License 6 votes vote down vote up
@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);
    }
}
 
Example 7
Project: SmartMath   File: ActivityCfgKeyPad.java   Source Code and License 6 votes vote down vote up
@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());
	}
}
 
Example 8
Project: add_to_evernote_note   File: NoteListFragment.java   Source Code and License 6 votes vote down vote up
@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;
    }
}
 
Example 9
Project: MyCalendar   File: DetailTeacherActivity.java   Source Code and License 6 votes vote down vote up
@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;
    }
}
 
Example 10
Project: CSipSimple   File: CodecsFragment.java   Source Code and License 6 votes vote down vote up
@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);
    
}
 
Example 11
Project: CSipSimple   File: AccountsEditListFragment.java   Source Code and License 6 votes vote down vote up
@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);

}
 
Example 12
Project: chromium-for-android-56-debug-video   File: MostVisitedItem.java   Source Code and License 6 votes vote down vote up
@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;
                }
            });
}
 
Example 13
Project: tuxguitar   File: TGTrackMenu.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 14
Project: q-mail   File: FolderList.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 15
Project: hyperrail-for-android   File: RouteSearchFragment.java   Source Code and License 5 votes vote down vote up
@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());
    }
}
 
Example 16
Project: MakiLite   File: TwitterActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
    WebView.HitTestResult result = webView.getHitTestResult();
    if (result != null) {
        int type = result.getType();

        if (type == WebView.HitTestResult.IMAGE_TYPE || type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
            showLongPressedImageMenu(menu, result.getExtra());
        }
    }
}
 
Example 17
Project: XPrivacy   File: ActivityApp.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
	super.onCreateContextMenu(menu, v, menuInfo);

	// Check if running
	boolean running = false;
	ActivityManager activityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
	for (RunningAppProcessInfo info : activityManager.getRunningAppProcesses())
		if (info.uid == mAppInfo.getUid())
			running = true;

	PackageManager pm = getPackageManager();
	List<String> listPackageNames = mAppInfo.getPackageName();
	List<String> listApplicationName = mAppInfo.getApplicationName();
	for (int i = 0; i < listPackageNames.size(); i++) {
		Menu appMenu = (listPackageNames.size() == 1) ? menu : menu.addSubMenu(i, Menu.NONE, Menu.NONE,
				listApplicationName.get(i));

		// Launch
		MenuItem launch = appMenu.add(i, MENU_LAUNCH, Menu.NONE, getString(R.string.menu_app_launch));
		if (pm.getLaunchIntentForPackage(listPackageNames.get(i)) == null)
			launch.setEnabled(false);

		// Settings
		appMenu.add(i, MENU_SETTINGS, Menu.NONE, getString(R.string.menu_app_settings));

		// Kill
		MenuItem kill = appMenu.add(i, MENU_KILL, Menu.NONE, getString(R.string.menu_app_kill));
		kill.setEnabled(running && PrivacyManager.isApplication(mAppInfo.getUid()));

		// Play store
		MenuItem store = appMenu.add(i, MENU_STORE, Menu.NONE, getString(R.string.menu_app_store));
		if (!Util.hasMarketLink(this, listPackageNames.get(i)))
			store.setEnabled(false);
	}
}
 
Example 18
Project: MakiLite   File: MessagesActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
	WebView.HitTestResult result = webView.getHitTestResult();
	if (result != null) {
		int type = result.getType();

		if (type == WebView.HitTestResult.IMAGE_TYPE || type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) {
			showLongPressedImageMenu(menu, result.getExtra());
		}
	}
}
 
Example 19
Project: tuxguitar   File: TGCompositionMenu.java   Source Code and License 5 votes vote down vote up
public void initializeItems(ContextMenu menu) {
	boolean running = TuxGuitar.getInstance(this.findContext()).getPlayer().isRunning();
	
	this.initializeItem(menu, R.id.menu_composition_change_tempo, new TGTempoDialogController(), !running);
	this.initializeItem(menu, R.id.menu_composition_change_clef, new TGClefDialogController(), !running);
	this.initializeItem(menu, R.id.menu_composition_change_key_signature, new TGKeySignatureDialogController(), !running);
	this.initializeItem(menu, R.id.menu_composition_change_time_signature, new TGTimeSignatureDialogController(), !running);
	this.initializeItem(menu, R.id.menu_composition_change_triplet_feel, new TGTripletFeelDialogController(), !running);
	this.initializeItem(menu, R.id.menu_composition_change_info, new TGSongInfoDialogController(), !running);
	this.initializeItem(menu, R.id.menu_composition_repeat_alternative, new TGRepeatAlternativeDialogController(), !running);
	this.initializeItem(menu, R.id.menu_composition_repeat_close, new TGRepeatCloseDialogController(), !running);
	this.initializeItem(menu, R.id.menu_composition_repeat_open, this.createActionProcessor(TGRepeatOpenAction.NAME), !running);
}
 
Example 20
Project: OpenHub   File: ActivityFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.setHeaderTitle(R.string.go_to);
    ContextMenuRecyclerView.RecyclerViewContextMenuInfo info =
            (ContextMenuRecyclerView.RecyclerViewContextMenuInfo) menuInfo;
    Event event = adapter.getData().get(info.getPosition());
    ArrayList<ActivityRedirectionModel> redirectionModels = mPresenter.getRedirectionList(event);
    for (ActivityRedirectionModel model : redirectionModels) {
        addRedirectionMenuItem(menu, model);
    }
}
 
Example 21
Project: tuxguitar   File: TGCaretMenu.java   Source Code and License 5 votes vote down vote up
public void initializeItems(ContextMenu menu) {
	boolean running = TuxGuitar.getInstance(this.findContext()).getPlayer().isRunning();
	
	this.initializeItem(menu, R.id.menu_caret_go_left, this.createActionProcessor(TGGoLeftAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_caret_go_right, this.createActionProcessor(TGGoRightAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_caret_go_up, this.createActionProcessor(TGGoUpAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_caret_go_down, this.createActionProcessor(TGGoDownAction.NAME), !running);
}
 
Example 22
Project: GCSApp   File: ContactListFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    toBeProcessUser = (EaseUser) listView.getItemAtPosition(((AdapterContextMenuInfo) menuInfo).position);
    toBeProcessUsername = toBeProcessUser.getUsername();
    getActivity().getMenuInflater().inflate(R.menu.em_context_contact_list, menu);
}
 
Example 23
Project: ultrasonic   File: SelectAlbumActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo)
{
	super.onCreateContextMenu(menu, view, menuInfo);
	AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;

	MusicDirectory.Entry entry = (MusicDirectory.Entry) albumListView.getItemAtPosition(info.position);

	if (entry != null && entry.isDirectory())
	{
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.select_album_context, menu);
	}

	shareButton = menu.findItem(R.id.menu_item_share);

	if (shareButton != null)
	{
		shareButton.setVisible(!Util.isOffline(this));
	}

	MenuItem downloadMenuItem = menu.findItem(R.id.album_menu_download);

	if (downloadMenuItem != null)
	{
		downloadMenuItem.setVisible(!Util.isOffline(this));
	}
}
 
Example 24
Project: KTalk   File: ContactListFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    // 获取环信id
    int position = ((AdapterView.AdapterContextMenuInfo) menuInfo).position;

    EaseUser easeUser = (EaseUser) listView.getItemAtPosition(position);

    mHxid = easeUser.getUsername();

    // 添加布局
    getActivity().getMenuInflater().inflate(R.menu.delete, menu);
}
 
Example 25
Project: mobile-grammar   File: UserGroupLessonsActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
                                ContextMenu.ContextMenuInfo menuInfo) {

    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.context_menu_lisview_groups_operation, menu);

}
 
Example 26
Project: mobile-grammar   File: IrregularVerbsActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
                                ContextMenu.ContextMenuInfo menuInfo) {

    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.context_menu_lisview_groups_operation, menu);

}
 
Example 27
Project: tuxguitar   File: TGEditMenu.java   Source Code and License 5 votes vote down vote up
public void initializeItems(ContextMenu menu) {
	boolean running = TuxGuitar.getInstance(this.findContext()).getPlayer().isRunning();
	
	this.initializeItem(menu, R.id.menu_edit_undo, this.createActionProcessor(TGUndoAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_edit_redo, this.createActionProcessor(TGRedoAction.NAME), !running);
	this.initializeItem(menu, R.id.menu_edit_set_voice_1, this.createActionProcessor(TGSetVoice1Action.NAME), true);
	this.initializeItem(menu, R.id.menu_edit_set_voice_2, this.createActionProcessor(TGSetVoice2Action.NAME), true);
}
 
Example 28
Project: Lunary-Ethereum-Wallet   File: FragmentWalletsAbstract.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    menu.setHeaderTitle(R.string.wallet_menu_title);
    menu.add(0, 200, 0, R.string.wallet_menu_changename);
    menu.add(0, 201, 0, R.string.wallet_menu_copyadd);
    menu.add(0, 202, 0, R.string.wallet_menu_share);
    menu.add(0, 203, 0, R.string.wallet_menu_export);
    menu.add(0, 204, 0, R.string.wallet_menu_private_key);
    menu.add(0, 205, 0, R.string.wallet_menu_delete);
}
 
Example 29
Project: Phoenix-for-VK   File: CommentsAdapter.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    if(isNull(recyclerView)) return;

    int position = recyclerView.getChildAdapterPosition(v) - getHeadersCount();
    if(listener != null){
        listener.populateCommentContextMenu(menu, getItem(position));
    }
}
 
Example 30
Project: aos-MediaLib   File: CoverGLSurfaceView.java   Source Code and License 5 votes vote down vote up
public void createContextMenu(Activity activity, ContextMenu menu) {
	if(DBG) Log.d(TAG,"createContextMenu");

	final Cover cover = mLayout.getFrontCover();
	if (cover==null) {
		return;
	}

	menu.setHeaderTitle(cover.getDescriptionName());

	// Animate the front cover to help understand it is the one the menu is referring to
	// The 200ms delay help to have a not-too-jerky animation despite GL animation and ContextMenu animation at the same time
	mAnimHandler.startItemClickAnimation(mLayout.getFrontCoverIndex(), null, 200);
}
 
Example 31
Project: AppRTC-Android   File: ConnectActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
  if (v.getId() == R.id.room_listview) {
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    menu.setHeaderTitle(roomList.get(info.position));
    String[] menuItems = getResources().getStringArray(R.array.roomListContextMenu);
    for (int i = 0; i < menuItems.length; i++) {
      menu.add(Menu.NONE, i, i, menuItems[i]);
    }
  } else {
    super.onCreateContextMenu(menu, v, menuInfo);
  }
}
 
Example 32
Project: PeSanKita-android   File: VerifyIdentityActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View view,
                                ContextMenuInfo menuInfo)
{
  super.onCreateContextMenu(menu, view, menuInfo);

  MenuInflater inflater = getActivity().getMenuInflater();
  inflater.inflate(R.menu.verify_display_fragment_context_menu, menu);

}
 
Example 33
Project: metacom-android   File: FilesFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo
        menuInfo) {
    if (v.getId() == mUploadFile.getId()) {
        menu.add(0, TAKE_PHOTO, 0, R.string.take_photo);
        menu.add(0, FILE_EXPLORER, 0, R.string.file_explorer);
    }
}
 
Example 34
Project: Android-Gank-Share   File: GankBaseFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    MenuInflater inflater = mActivity.getMenuInflater();
    if(mData.get(itemNow).type.equals("福利"))
        inflater.inflate(R.menu.menu_girl, menu);
    else
        inflater.inflate(R.menu.menu_item, menu);
}
 
Example 35
Project: zabbkit-android   File: MainHostsFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    if (v.getId() == R.id.hosts_listview) {
        String[] menuItems = getResources().getStringArray(R.array.list_hosts_actions);
        for (int i = 0; i < menuItems.length; i++) {
            menu.add(Menu.NONE, i, i, menuItems[i]);
        }
    }
}
 
Example 36
Project: Huochexing12306   File: MonitorMangAty.java   Source Code and License 5 votes vote down vote up
private void setListViewContextMenuWithDel() {
	lvMang.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
		
		@Override
		public void onCreateContextMenu(ContextMenu menu, View v,
				ContextMenuInfo menuInfo) {
			intCurrDataPos = ((AdapterContextMenuInfo) menuInfo).position;
			menu.add(0, 0, 0, "删除");
		}
	});
}
 
Example 37
Project: RestClient   File: RestTestAdapter.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    menu.add(0, R.id.rest_copy_request, 0, "Copy");
    menu.add(0, R.id.rest_delete, 0, "Remove");//groupId, itemId, order, title
    menu.add(0, R.id.rest_sort_up, 0, "Move Up");
    menu.add(0, R.id.rest_sort_down, 0, "Move Down");
}
 
Example 38
Project: HabitUp   File: ViewHabitActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.setHeaderTitle("Select action");
    menu.add(0, 1, 1, "Edit");
    menu.add(0, 2, 2, "Delete");
}
 
Example 39
Project: floating_calc   File: HistoryLine.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu) {
    MenuHandler handler = new MenuHandler();
    if (mMenuItemsStrings == null) {
        Resources resources = getResources();
        mMenuItemsStrings = new String[4];
        mMenuItemsStrings[COPY] = String.format(resources.getString(R.string.copy), mHistoryEntry.getFormula() + "=" + mHistoryEntry.getResult());
        mMenuItemsStrings[COPY_BASE] = String.format(resources.getString(R.string.copy), mHistoryEntry.getFormula());
        mMenuItemsStrings[COPY_EDITED] = String.format(resources.getString(R.string.copy), mHistoryEntry.getResult());
        mMenuItemsStrings[REMOVE] = resources.getString(R.string.remove_from_history);
    }
    for (int i = 0; i < mMenuItemsStrings.length; i++) {
        menu.add(Menu.NONE, i, i, mMenuItemsStrings[i]).setOnMenuItemClickListener(handler);
    }
}
 
Example 40
Project: weex-3d-map   File: HistoryActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu,
                                View v,
                                ContextMenu.ContextMenuInfo menuInfo) {
  int position = ((AdapterView.AdapterContextMenuInfo) menuInfo).position;
  if (position >= adapter.getCount() || adapter.getItem(position).getResult() != null) {
    menu.add(Menu.NONE, position, position, R.string.history_clear_one_history_text);
  } // else it's just that dummy "Empty" message
}
 
Example 41
Project: Show_Chat   File: GroupFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) {
    menu.setHeaderTitle((String) ((Object[])btnMore.getTag())[0]);
    Intent data = new Intent();
    data.putExtra(GroupFragment.CONTEXT_MENU_KEY_INTENT_DATA_POS, (Integer) ((Object[])btnMore.getTag())[1]);
    menu.add(Menu.NONE, GroupFragment.CONTEXT_MENU_EDIT, Menu.NONE, "Edit group").setIntent(data);
    menu.add(Menu.NONE, GroupFragment.CONTEXT_MENU_DELETE, Menu.NONE, "Delete group").setIntent(data);
    menu.add(Menu.NONE, GroupFragment.CONTEXT_MENU_LEAVE, Menu.NONE, "Leave group").setIntent(data);
}
 
Example 42
Project: tuxguitar   File: TGMeasureMenu.java   Source Code and License 5 votes vote down vote up
public void initializeItems(ContextMenu menu) {
	boolean running = TuxGuitar.getInstance(this.findContext()).getPlayer().isRunning();
	
	this.initializeItem(menu, R.id.menu_measure_add, new TGMeasureAddDialogController(), !running);
	this.initializeItem(menu, R.id.menu_measure_clean, new TGMeasureCleanDialogController(), !running);
	this.initializeItem(menu, R.id.menu_measure_remove, new TGMeasureRemoveDialogController(), !running);
}
 
Example 43
Project: prevent   File: PreventFragment.java   Source Code and License 5 votes vote down vote up
private void setHeaderIcon(ContextMenu menu, Drawable icon) {
    int width = getHeaderIconWidth();
    if (icon.getMinimumWidth() <= width) {
        menu.setHeaderIcon(icon);
    } else if (icon instanceof BitmapDrawable) {
        Bitmap bitmap = Bitmap.createScaledBitmap(((BitmapDrawable) icon).getBitmap(), width, width, false);
        menu.setHeaderIcon(new BitmapDrawable(getResources(), bitmap));
    }
}
 
Example 44
Project: buildAPKsSamples   File: Notepadv2.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
		ContextMenuInfo menuInfo) {
	super.onCreateContextMenu(menu, v, menuInfo);
	
       // TODO: fill in rest of method
}
 
Example 45
Project: chromium-for-android-56-debug-video   File: ChromeContextMenuPopulator.java   Source Code and License 5 votes vote down vote up
private void removeUnsupportedItems(ContextMenu menu, int[] whitelist) {
    Arrays.sort(BASE_WHITELIST);
    Arrays.sort(whitelist);
    for (int i = 0; i < menu.size(); i++) {
        MenuItem item = menu.getItem(i);
        if (Arrays.binarySearch(whitelist, item.getItemId()) < 0
                && Arrays.binarySearch(BASE_WHITELIST, item.getItemId()) < 0) {
            menu.removeItem(item.getItemId());
            i--;
        }
    }
}
 
Example 46
Project: chromium-for-android-56-debug-video   File: ContextMenuHelper.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    assert mPopulator != null;
    mPopulator.buildContextMenu(menu, v.getContext(), mCurrentContextMenuParams);

    for (int i = 0; i < menu.size(); i++) {
        menu.getItem(i).setOnMenuItemClickListener(this);
    }
}
 
Example 47
Project: buildAPKsApps   File: SimplyDoActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
        ContextMenuInfo menuInfo)
{
    Log.v(L.TAG, "ListsListReactor.onCreateContextMenu()");
    
    AdapterContextMenuInfo ctxMenuInfo = (AdapterContextMenuInfo)menuInfo;
    ListView listView = (ListView)findViewById(R.id.ListsListView);
    ctxList = (ListDesc)listView.getItemAtPosition(ctxMenuInfo.position);

    menu.setHeaderTitle("List Options");
    menu.add(Menu.NONE, EDIT_LIST, Menu.NONE, "Edit");
    menu.add(Menu.NONE, DELETE_LIST, Menu.NONE, "Delete");
}
 
Example 48
Project: DoorAccess   File: LocationFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {

    menu.add(Menu.NONE, LOC_CONTEXT_MENU_MODIFY, Menu.NONE, "Modify");
    menu.add(Menu.NONE, LOC_CONTEXT_MENU_TAG, Menu.NONE, "Tag");
    menu.add(Menu.NONE, LOC_CONTEXT_MENU_DELETE, Menu.NONE, "Delete");
}
 
Example 49
Project: tuxguitar   File: TGSettingMenu.java   Source Code and License 5 votes vote down vote up
public void initializeItems(ContextMenu menu) {
	TGContext context = findContext();
	TGLayout layout = TGSongViewController.getInstance(context).getLayout();
	int style = layout.getStyle();
	
	this.initializeItem(menu, R.id.menu_view_layout_show_score, this.createActionProcessor(TGSetScoreEnabledAction.NAME), true, (style & TGLayout.DISPLAY_SCORE) != 0);
	this.initializeItem(menu, R.id.menu_view_layout_show_chord_name, this.createActionProcessor(TGSetChordNameEnabledAction.NAME), true, (style & TGLayout.DISPLAY_CHORD_NAME) != 0);
	this.initializeItem(menu, R.id.menu_view_layout_show_chord_diagram, this.createActionProcessor(TGSetChordDiagramEnabledAction.NAME), true, (style & TGLayout.DISPLAY_CHORD_DIAGRAM) != 0);
	final boolean enable = TGPreferencesManager.getInstance(context).isCountDownEnable(this.getActivity());
	this.initializeItem(menu, R.id.menu_countdown_enable, this.createActionProcessor(!enable), true, enable);
}
 
Example 50
Project: prevent   File: PreventFragment.java   Source Code and License 4 votes vote down vote up
private boolean canCreateContextMenu(ContextMenu menu, ContextMenuInfo menuInfo) {
    return mActivity != null && menu != null && menuInfo != null;
}
 
Example 51
Project: q-mail   File: ManageIdentities.java   Source Code and License 4 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.setHeaderTitle(R.string.manage_identities_context_menu_title);
    getMenuInflater().inflate(R.menu.manage_identities_context, menu);
}
 
Example 52
Project: Goalie_Android   File: FriendsListRecycler.java   Source Code and License 4 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    menu.setHeaderTitle(mFriendName.getText());
    menu.add(0, R.string.refresh, getAdapterPosition(), mContext.getString(R.string.refresh));
    menu.add(0, R.string.delete, getAdapterPosition(), mContext.getString(R.string.delete));
}
 
Example 53
Project: GitHub   File: TestFragment.java   Source Code and License 4 votes vote down vote up
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v,
        final ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    Log.v(TAG, "onCreateContextMenu");
}
 
Example 54
Project: buildAPKsApps   File: Export.java   Source Code and License 4 votes vote down vote up
public void onCreateContextMenu(ContextMenu menu, View view,
                                ContextMenu.ContextMenuInfo menu_info) {
  menu.setHeaderTitle("Options");
  menu.add(0, 0, 0, "Delete");
}
 
Example 55
Project: CCDownload   File: DownloadingFragment.java   Source Code and License 4 votes vote down vote up
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
	contextMenu = menu;
	menu.setHeaderTitle("操作");
	menu.add(ConfigUtil.DOWNLOADING_MENU_GROUP_ID, 0, 0, "删除");
}
 
Example 56
Project: Linphone4Android   File: ChatListFragment.java   Source Code and License 4 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
	super.onCreateContextMenu(menu, v, menuInfo);
	menu.add(0, v.getId(), 0, getString(R.string.delete));
}
 
Example 57
Project: MakiLite   File: TwitterActivity.java   Source Code and License 4 votes vote down vote up
private void showLongPressedImageMenu(ContextMenu menu, String imageUrl) {
    mPendingImageUrlToSave = imageUrl;
    menu.add(0, ID_CONTEXT_MENU_SAVE_IMAGE, 0, getString(R.string.save_img));
    menu.add(0, ID_CONTEXT_MENU_SHARE_IMAGE, 1, getString(R.string.share_link));
}
 
Example 58
Project: MakiLite   File: MessagesDesktopActivity.java   Source Code and License 4 votes vote down vote up
private void showLongPressedImageMenu(ContextMenu menu, String imageUrl) {
    mPendingImageUrlToSave = imageUrl;
    menu.add(0, ID_CONTEXT_MENU_SAVE_IMAGE, 0, getString(R.string.save_img));
    menu.add(0, ID_CONTEXT_MENU_SHARE_IMAGE, 1, getString(R.string.share_link));
}
 
Example 59
Project: microMathematics   File: AdapterBaseImpl.java   Source Code and License 4 votes vote down vote up
@Override
public void populateContextMenu(ContextMenu menu, AdapterView.AdapterContextMenuInfo acmi, int num)
{
    try
    {
        if (readWriteAdapter)
        {
            menu.add(0, R.id.fman_action_refresh, 0, R.string.fman_refresh_title);
            menu.add(0, R.id.fman_action_create_folder, 0, R.string.fman_create_folder_title);
            if (num > 0)
            {
                menu.add(0, R.id.fman_action_rename, 0, R.string.fman_rename_title);
                menu.add(0, R.id.fman_action_delete, 0, R.string.fman_delete_title);
            }
        }
        MenuItem activeSort = null;
        menu.add(0, R.id.fman_action_sort_by_name, 0, R.string.fman_sort_by_name);
        if ((mode & MODE_SORTING) == SORT_NAME)
        {
            activeSort = menu.findItem(R.id.fman_action_sort_by_name);
        }
        menu.add(0, R.id.fman_action_sort_by_ext, 0, R.string.fman_sort_by_ext);
        if ((mode & MODE_SORTING) == SORT_EXT)
        {
            activeSort = menu.findItem(R.id.fman_action_sort_by_ext);
        }
        menu.add(0, R.id.fman_action_sort_by_size, 0, R.string.fman_sort_by_size);
        if ((mode & MODE_SORTING) == SORT_SIZE)
        {
            activeSort = menu.findItem(R.id.fman_action_sort_by_size);
        }
        menu.add(0, R.id.fman_action_sort_by_date, 0, R.string.fman_sort_by_date);
        if ((mode & MODE_SORTING) == SORT_DATE)
        {
            activeSort = menu.findItem(R.id.fman_action_sort_by_date);
        }
        if (activeSort != null)
        {
            activeSort.setCheckable(true);
            activeSort.setChecked(true);
        }
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
Example 60
Project: Huochexing12306   File: A6OrderExpandableAdapter.java   Source Code and License 4 votes vote down vote up
@Override
	public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,
			ViewGroup parent) {
		if (mLstDatas == null || mLstDatas.size() == 0){
			return null;
		}
		final int groupPos = groupPosition;
		ChildViewHolder holder;
		if (convertView != null){
			holder = (ChildViewHolder) convertView.getTag();
		}else{
			convertView = mInflater.inflate(R.layout.item_a6_order, null);
			holder = new ChildViewHolder();
			holder.slv1 = (SubListView)convertView.findViewById(R.id.item_a6_order_slv1);
			convertView.setTag(holder);
		}
		holder.slv1.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
			
			@Override
			public void onCreateContextMenu(ContextMenu menu, View v,
					ContextMenuInfo menuInfo) {
				mCurrGroupPos = groupPos;
				mCurrChildItemPos = ((AdapterContextMenuInfo) menuInfo).position;
				menu.clear();
				menu.add(A6OrderAty.CONTEXT_GROUP_0, A6OrderAty.CONTEXT_ITEM_ADD_TRAIN_INFO, 0, "添加车次");
				TicketInfo tInfo = mLstDatas.get(groupPos).getTickets().get(mCurrChildItemPos);
				try {
					Date trainDate = TimeUtil.getDTFormat().parse(tInfo.getStart_train_date_page());
					if (trainDate.getTime() >= (new Date()).getTime()){
						if (tInfo.getReturn_flag().equals("Y")){
							//退票
							menu.add(A6OrderAty.CONTEXT_GROUP_0, A6OrderAty.CONTEXT_ITEM_REFUND_TICKET, 1, "退票");
						}
//						if (tInfo.getResign_flag().equals("Y")){
//							//改签
//							menu.add(A6OrderAty.CONTEXT_GROUP_0, A6OrderAty.CONTEXT_ITEM_RESIGN, 2, "改签");
//						}
					}
				} catch (ParseException e) {
					e.printStackTrace();
				}
			}
		});
		A6OrderItemAdapter adapter = new A6OrderItemAdapter(mContext, mLstDatas.get(groupPosition).getTickets());
		holder.slv1.setAdapter(adapter);
		return convertView;
	}