Java Code Examples for android.view.ContextMenu#setHeaderIcon()
The following examples show how to use
android.view.ContextMenu#setHeaderIcon() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AccountsEditListFragment.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
@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 2
Source File: AllTasksListFragment.java From ActivityLauncher with ISC License | 6 votes |
@Override public void onCreateContextMenu(@NonNull ContextMenu menu, @NonNull View v, ContextMenuInfo menuInfo) { menu.add(Menu.NONE, 0, Menu.NONE, R.string.context_action_shortcut); menu.add(Menu.NONE, 1, Menu.NONE, R.string.context_action_launch); ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo; ExpandableListView list = getView().findViewById(R.id.expandableListView1); switch (ExpandableListView.getPackedPositionType(info.packedPosition)) { case ExpandableListView.PACKED_POSITION_TYPE_CHILD: MyActivityInfo activity = (MyActivityInfo) list.getExpandableListAdapter().getChild(ExpandableListView.getPackedPositionGroup(info.packedPosition), ExpandableListView.getPackedPositionChild(info.packedPosition)); menu.setHeaderIcon(activity.icon); menu.setHeaderTitle(activity.name); menu.add(Menu.NONE, 2, Menu.NONE, R.string.context_action_edit); break; case ExpandableListView.PACKED_POSITION_TYPE_GROUP: MyPackageInfo pack = (MyPackageInfo) list.getExpandableListAdapter().getGroup(ExpandableListView.getPackedPositionGroup(info.packedPosition)); menu.setHeaderIcon(pack.icon); menu.setHeaderTitle(pack.name); break; } super.onCreateContextMenu(menu, v, menuInfo); }
Example 3
Source File: join.java From Favorite-Android-Client with Apache License 2.0 | 6 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { Log.i("ContextMenu", "Contextmenu"); if (v.getId() == R.id.profile_image) { menu.setHeaderIcon(android.R.drawable.btn_star); // menu.setHeaderTitle("공지사항"); menu.add(Menu.NONE, 1, Menu.NONE, getString(R.string.choose_picture)); menu.add(Menu.NONE, 2, Menu.NONE, getString(R.string.camera)); menu.add(Menu.NONE, 3, Menu.NONE, getString(R.string.delete)); } super.onCreateContextMenu(menu, v, menuInfo); }
Example 4
Source File: page_create.java From Favorite-Android-Client with Apache License 2.0 | 6 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { Log.i("ContextMenu", "Contextmenu"); if (v.getId() == R.id.profile_image) { menu.setHeaderIcon(android.R.drawable.btn_star); // menu.setHeaderTitle("공지사항"); menu.add(Menu.NONE, 1, Menu.NONE, getString(R.string.choose_picture)); menu.add(Menu.NONE, 2, Menu.NONE, getString(R.string.camera)); menu.add(Menu.NONE, 3, Menu.NONE, getString(R.string.delete)); } super.onCreateContextMenu(menu, v, menuInfo); }
Example 5
Source File: ProfileEdit.java From Favorite-Android-Client with Apache License 2.0 | 6 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { //Log.i("ContextMenu", "Contextmenu"); if (v.getId() == R.id.profile_image) { menu.setHeaderIcon(android.R.drawable.btn_star); // menu.setHeaderTitle("공지사항"); menu.add(Menu.NONE, 1, Menu.NONE, getString(R.string.choose_picture)); menu.add(Menu.NONE, 2, Menu.NONE, getString(R.string.camera)); menu.add(Menu.NONE, 3, Menu.NONE, getString(R.string.delete)); } super.onCreateContextMenu(menu, v, menuInfo); }
Example 6
Source File: document_read.java From Favorite-Android-Client with Apache License 2.0 | 6 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { menu.setHeaderIcon(android.R.drawable.btn_star); // menu.setHeaderTitle("공지사항"); if (contextmenu_number == 0) { menu.add(Menu.NONE, 1, Menu.NONE, getString(R.string.copy)); } if (contextmenu_number != 0) { menu.add(Menu.NONE, 1, Menu.NONE, getString(R.string.copy)); if (contextmenu_you_status == 4) { menu.add(Menu.NONE, 2, Menu.NONE, getString(R.string.delete)); menu.add(Menu.NONE, 3, Menu.NONE, getString(R.string.privacy_content)); } } super.onCreateContextMenu(menu, v, menuInfo); }
Example 7
Source File: MainMenu.java From MifareClassicTool with GNU General Public License v3.0 | 6 votes |
/** * Add the menu with the tools. * It will be shown if the user clicks on "Tools". */ @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getMenuInflater(); menu.setHeaderTitle(R.string.dialog_tools_menu_title); menu.setHeaderIcon(android.R.drawable.ic_menu_preferences); inflater.inflate(R.menu.tools, menu); // Enable/Disable tag info tool depending on NFC availability. menu.findItem(R.id.menuMainTagInfo).setEnabled( !Common.useAsEditorOnly()); // Enable/Disable UID clone info tool depending on NFC availability. menu.findItem(R.id.menuMainCloneUidTool).setEnabled( !Common.useAsEditorOnly()); // Enable/Disable diff tool depending on write permissions. menu.findItem(R.id.menuMainDiffTool).setEnabled( Common.hasWritePermissionToExternalStorage(this)); }
Example 8
Source File: PreventFragment.java From prevent with Do What The F*ck You Want To Public License | 5 votes |
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 9
Source File: ViewerActivity.java From document-viewer with GNU General Public License v3.0 | 5 votes |
/** * {@inheritDoc} * * @see android.app.Activity#onCreateContextMenu(android.view.ContextMenu, android.view.View, * android.view.ContextMenu.ContextMenuInfo) */ @Override public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) { menu.clear(); menu.setHeaderTitle(R.string.app_name); menu.setHeaderIcon(R.drawable.application_icon); final MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.mainmenu_context, menu); updateMenuItems(menu); }
Example 10
Source File: OOM.java From Kernel-Tuner with GNU General Public License v3.0 | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle(getResources().getString(R.string.oom_preset)); menu.setHeaderIcon(R.drawable.swap); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.oom_context_menu, menu); }