List of usage examples for android.view ContextMenu setHeaderTitle
public ContextMenu setHeaderTitle(CharSequence title);
From source file:com.beem.project.beem.ui.ContactListFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = hostActivity.getMenuInflater(); inflater.inflate(R.menu.contactlist_context, menu); AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; mSelectedContact = (Contact) getListAdapter().getItem(info.position); menu.setHeaderTitle(mSelectedContact.getJID()); }
From source file:com.darshancomputing.BatteryIndicatorPro.AlarmsFragment.java
private void bindView(View view) { final TextView summary_tv = (TextView) view.findViewById(R.id.alarm_summary); final View summary_box = view.findViewById(R.id.alarm_summary_box); final CompoundButton toggle = (CompoundButton) view.findViewById(R.id.toggle); final int id = mCursor.getInt(AlarmDatabase.INDEX_ID); String type = mCursor.getString(AlarmDatabase.INDEX_TYPE); String threshold = mCursor.getString(AlarmDatabase.INDEX_THRESHOLD); Boolean enabled = (mCursor.getInt(AlarmDatabase.INDEX_ENABLED) == 1); String s = pfrag.str.alarm_types_display[pfrag.str.indexOf(pfrag.str.alarm_type_values, type)]; if (type.equals("temp_rises")) { s += " " + pfrag.str.formatTemp(Integer.valueOf(threshold), convertF, false); } else if (type.equals("charge_drops") || type.equals("charge_rises")) { s += " " + threshold + "%"; }/*from w w w . ja va 2 s . co m*/ final String summary = s; summary_tv.setText(summary); toggle.setChecked(enabled); toggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { alarms.setEnabled(id, isChecked); } }); summary_box.setOnCreateContextMenuListener(new OnCreateContextMenuListener() { public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { curId = id; curIndex = mAlarmsList.indexOfChild((View) v.getParent().getParent()); getActivity().getMenuInflater().inflate(R.menu.alarm_item_context, menu); menu.setHeaderTitle(summary); } }); summary_box.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, android.view.KeyEvent event) { if (keyCode == event.KEYCODE_DPAD_CENTER && event.getAction() == event.ACTION_DOWN) v.setPressed(true); return false; } }); summary_box.setOnClickListener(new OnClickListener() { public void onClick(View v) { ComponentName comp = new ComponentName(getActivity().getPackageName(), AlarmEditActivity.class.getName()); startActivity(new Intent().setComponent(comp).putExtra(AlarmEditActivity.EXTRA_ALARM_ID, id)); } }); }
From source file:at.ac.uniklu.mobile.sportal.CourseListFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { int position = ((AdapterContextMenuInfo) menuInfo).position; getActivity().getMenuInflater().inflate(R.menu.course_context_menu, menu); Lehrveranstaltung course = mCourseModel.getCourse(position); menu.setHeaderTitle(course.getTyp() + " " + course.getName()); menu.getItem(1).setVisible(course.getWebsiteUrl() != null); menu.getItem(2).setVisible(course.getMoodleUrl() != null); menu.getItem(3).setVisible(course.getStatus().equals("aufgenommen")); menu.getItem(4).setVisible(course.isKreuzellisten()); if (mIndex > 0) { // hide the blacklist menu item for past semesters menu.getItem(5).setVisible(false); } else if (!mDB.courseBlacklist_isListed(course.getKey())) { menu.getItem(5).setChecked(true); }/*from w w w. j a v a 2s. c o m*/ //http://stackoverflow.com/questions/5440601/android-how-to-enable-disable-option-menu-item-on-button-click Analytics.onEvent(Analytics.EVENT_CONTEXTMENU_COURSE); }
From source file:de.androvdr.fragments.RecordingsFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo mi = (AdapterContextMenuInfo) menuInfo; if (!mController.isFolder(mi.position)) { MenuInflater inflater = mActivity.getMenuInflater(); inflater.inflate(R.menu.recordings_menu, menu); menu.setHeaderTitle(mController.getTitle(mi.position)); }/*w w w. j a va 2 s .co m*/ }
From source file:com.money.manager.ex.currency.recycler.CurrencyRecyclerListFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { RecyclerViewContextMenuInfo info = (RecyclerViewContextMenuInfo) menuInfo; Currency currency = getCurrencyAtPosition(info.position); menu.setHeaderTitle(currency.getName()); // compose context menu String[] menuItems = getResources().getStringArray(R.array.context_menu_currencies); for (int i = 0; i < menuItems.length; i++) { menu.add(Menu.NONE, i, i, menuItems[i]); }//from w ww .jav a 2s .c o m }
From source file:org.adaway.ui.TcpdumpLogFragment.java
/** * Context Menu on Long Click/*from w w w .j a va2 s . co m*/ */ @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); // Get the info on which item was selected AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; // Retrieve the item that was clicked on String hostname = mAdapter.getItem(info.position); android.view.MenuInflater inflater = (android.view.MenuInflater) mActivity.getMenuInflater(); menu.setHeaderTitle(hostname); inflater.inflate(R.menu.tcpdump_log_context, menu); }
From source file:nz.co.wholemeal.christchurchmetro.PlatformActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle(R.string.options); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.arrival_context_menu, menu); }
From source file:com.dhara.googlecalendartrial.MainActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; String title = mEventList.get(info.position).getDescription(); menu.setHeaderTitle(title); menu.add(Menu.NONE, 1, Menu.NONE, getString(R.string.delete_event)); }
From source file:com.github.nutomic.pegasus.activities.ProfileList.java
/** * Create context menu for ListView items. *//*from w w w .j a va 2 s . c om*/ public void onCreateContextMenu(android.view.ContextMenu menu, View v, android.view.ContextMenu.ContextMenuInfo menuInfo) { getMenuInflater().inflate(R.menu.profile_list_context, menu); final AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; // Set profile name as menu title. Cursor c = (Cursor) getListAdapter().getItem(info.position); menu.setHeaderTitle(c.getString(c.getColumnIndex(ProfileColumns.NAME))); }
From source file:org.yaoha.YaohaActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle("Action"); menu.add(0, v.getId(), 0, EDIT_FAV_STRING); menu.add(0, v.getId(), 0, EDIT_FAV_PIC); menu.add(0, v.getId(), 0, REMOVE_FAV); }