Java Code Examples for android.view.ContextMenu.ContextMenuInfo

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project platform_packages_apps_browser, under directory /src/com/android/browser/view/.

Source file: BookmarkExpandableView.java

  18 
vote

@Override public void createContextMenu(ContextMenu menu){
  ContextMenuInfo menuInfo=getContextMenuInfo();
  ((MenuBuilder)menu).setCurrentMenuInfo(menuInfo);
  onCreateContextMenu(menu);
  if (mOnCreateContextMenuListener != null) {
    mOnCreateContextMenuListener.onCreateContextMenu(menu,this,menuInfo);
  }
  ((MenuBuilder)menu).setCurrentMenuInfo(null);
  if (mParent != null) {
    mParent.createContextMenu(menu);
  }
}
 

Example 2

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/.

Source file: UserDictionarySettings.java

  17 
vote

@Override public boolean onContextItemSelected(MenuItem item){
  ContextMenuInfo menuInfo=item.getMenuInfo();
  if (!(menuInfo instanceof AdapterContextMenuInfo))   return false;
  AdapterContextMenuInfo adapterMenuInfo=(AdapterContextMenuInfo)menuInfo;
  String word=getWord(adapterMenuInfo.position);
  if (word == null)   return true;
switch (item.getItemId()) {
case CONTEXT_MENU_DELETE:
    deleteWord(word);
  return true;
case CONTEXT_MENU_EDIT:
showAddOrEditDialog(word);
return true;
}
return false;
}
 

Example 3

From project Absolute-Android-RSS, under directory /src/com/AA/Activities/.

Source file: AAMain.java

  15 
vote

/** 
 * Creates a list of options when long pressing an item that has been registered for a context menu
 */
@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  selectedView=v;
  Article article=(Article)v.getTag();
  menu.add(ContextMenu.NONE,OPEN,0,"Open");
  menu.add(ContextMenu.NONE,SHARE,1,"Share");
  if (article.isRead())   menu.add(ContextMenu.NONE,MARK,1,"Mark as unread");
 else   menu.add(ContextMenu.NONE,MARK,1,"Mark as read");
}
 

Example 4

From project aksunai, under directory /src/org/androidnerds/app/aksunai/.

Source file: Aksunai.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo i){
  AdapterContextMenuInfo info=(AdapterContextMenuInfo)i;
  if (info.position == 0) {
    return;
  }
  menu.setHeaderTitle(R.string.menu_server_options);
  menu.add(R.string.connect);
  menu.add(R.string.edit);
  menu.add(R.string.remove);
}
 

Example 5

From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/base/.

Source file: DocumentSelectionBase.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.document_context_menu,menu);
  Book document=getDisplayedDocuments().get(((AdapterContextMenuInfo)menuInfo).position);
  Log.d(TAG,"Context selected " + document.getInitials());
  MenuItem deleteItem=menu.findItem(R.id.delete);
  deleteItem.setVisible(isDeletePossible);
  if (isDeletePossible) {
    boolean canDeleteCurrentDocument=documentControl.canDelete(document);
    deleteItem.setEnabled(canDeleteCurrentDocument);
  }
  MenuItem deleteIndexItem=menu.findItem(R.id.delete_index);
  deleteIndexItem.setVisible(isDeletePossible && document.getIndexStatus().equals(IndexStatus.DONE));
}
 

Example 6

From project android-api-demos, under directory /src/com/mobeelizer/demos/activities/.

Source file: RelationsActivity.java

  15 
vote

/** 
 * {@inheritDoc}
 */
@Override public void onCreateContextMenu(final ContextMenu menu,final View v,final ContextMenuInfo menuInfo){
  ExpandableListContextMenuInfo info=(ExpandableListContextMenuInfo)menuInfo;
  if (ExpandableListView.getPackedPositionType(info.packedPosition) == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
    boolean isFooterView=true;
    try {
      isFooterView=(Boolean)info.targetView.getTag(R.attr.IsFooterView);
    }
 catch (    NullPointerException e) {
      e.printStackTrace();
    }
    if (!isFooterView) {
      getMenuInflater().inflate(R.menu.list_context_menu,menu);
    }
  }
}
 

Example 7

From project Android-automation, under directory /TmtsApp/src/com/taobao/tmts/framework/app/.

Source file: ListViewActivity.java

  15 
vote

public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.listview_layout);
  ListView listview=(ListView)findViewById(R.id.my_listview);
  ArrayList<HashMap<String,Object>> listitem=new ArrayList<HashMap<String,Object>>();
  for (int i=0; i < 100; i++) {
    HashMap<String,Object> map=new HashMap<String,Object>();
    map.put("itemimage",R.drawable.icon);
    map.put("itemTitle","Item" + i);
    map.put("itemText","Thank you!");
    listitem.add(map);
  }
  SimpleAdapter listitemAdapter=new SimpleAdapter(this,listitem,R.layout.listview_item_layout,new String[]{"itemimage","itemTitle","itemText"},new int[]{R.id.ItemImage,R.id.ItemTitle,R.id.ItemText});
  listview.setAdapter(listitemAdapter);
  listview.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
    }
  }
);
  listview.setOnCreateContextMenuListener(new OnCreateContextMenuListener(){
    @Override public void onCreateContextMenu(    ContextMenu menu,    View v,    ContextMenuInfo menuInfo){
      menu.setHeaderTitle("Hello");
      menu.add(0,0,0,"Item One");
      menu.add(0,1,0,"Item Two");
    }
  }
);
}
 

Example 8

From project android-client_1, under directory /src/com/buddycloud/view/.

Source file: RosterActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  getMenuInflater().inflate(R.menu.roster_context,menu);
  Intent openChannel=new Intent();
  openChannel.setClassName("com.buddycloud.android.buddydroid",ChannelMessageActivity.class.getCanonicalName());
  Cursor buddy=(Cursor)listAdapter.getItem(((AdapterContextMenuInfo)menuInfo).position);
  String jid=buddy.getString(buddy.getColumnIndex(Roster.JID));
  openChannel.setData(Uri.parse("channel:" + jid));
  menu.findItem(R.id.open_channel).setIntent(openChannel);
  super.onCreateContextMenu(menu,v,menuInfo);
}
 

Example 9

From project Android-FFXIEQ, under directory /ffxieq/src/com/github/kanata3249/ffxieq/android/.

Source file: AugmentSelectorActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.augmentselector_context,menu);
  MenuItem item=menu.findItem(R.id.DeleteAugment);
  if (item != null) {
    item.setEnabled(mLongClickingItemId != mAugID);
  }
}
 

Example 10

From project Android-File-Manager, under directory /src/com/nexes/manager/.

Source file: Main.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo info){
  super.onCreateContextMenu(menu,v,info);
  boolean multi_data=mHandler.hasMultiSelectData();
  AdapterContextMenuInfo _info=(AdapterContextMenuInfo)info;
  mSelectedListItem=mHandler.getData(_info.position);
  if (mFileMag.isDirectory(mSelectedListItem) && !mHandler.isMultiSelected()) {
    menu.setHeaderTitle("Folder operations");
    menu.add(0,D_MENU_DELETE,0,"Delete Folder");
    menu.add(0,D_MENU_RENAME,0,"Rename Folder");
    menu.add(0,D_MENU_COPY,0,"Copy Folder");
    menu.add(0,D_MENU_MOVE,0,"Move(Cut) Folder");
    menu.add(0,D_MENU_ZIP,0,"Zip Folder");
    menu.add(0,D_MENU_PASTE,0,"Paste into folder").setEnabled(mHoldingFile || multi_data);
    menu.add(0,D_MENU_UNZIP,0,"Extract here").setEnabled(mHoldingZip);
  }
 else   if (!mFileMag.isDirectory(mSelectedListItem) && !mHandler.isMultiSelected()) {
    menu.setHeaderTitle("File Operations");
    menu.add(0,F_MENU_DELETE,0,"Delete File");
    menu.add(0,F_MENU_RENAME,0,"Rename File");
    menu.add(0,F_MENU_COPY,0,"Copy File");
    menu.add(0,F_MENU_MOVE,0,"Move(Cut) File");
    menu.add(0,F_MENU_ATTACH,0,"Email File");
  }
}
 

Example 11

From project android-ocr, under directory /android/src/edu/sfsu/cs/orange/ocr/.

Source file: CaptureActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  if (v.equals(ocrResultView)) {
    menu.add(Menu.NONE,OPTIONS_COPY_RECOGNIZED_TEXT_ID,Menu.NONE,"Copy recognized text");
    menu.add(Menu.NONE,OPTIONS_SHARE_RECOGNIZED_TEXT_ID,Menu.NONE,"Share recognized text");
  }
 else   if (v.equals(translationView)) {
    menu.add(Menu.NONE,OPTIONS_COPY_TRANSLATED_TEXT_ID,Menu.NONE,"Copy translated text");
    menu.add(Menu.NONE,OPTIONS_SHARE_TRANSLATED_TEXT_ID,Menu.NONE,"Share translated text");
  }
}
 

Example 12

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/list/activity/.

Source file: AbstractListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(cTag,"bad menuInfo",e);
    return;
  }
  Cursor cursor=(Cursor)getListAdapter().getItem(info.position);
  if (cursor == null) {
    return;
  }
  menu.setHeaderTitle(cursor.getString(1));
  Uri selectedUri=ContentUris.withAppendedId(getListConfig().getPersister().getContentUri(),info.id);
  MenuUtils.addSelectedAlternativeMenuItems(menu,selectedUri,false);
  MenuUtils.addDeleteMenuItem(menu);
}
 

Example 13

From project Android-Terminal-Emulator, under directory /src/jackpal/androidterm/.

Source file: Term.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  menu.setHeaderTitle(R.string.edit_text);
  menu.add(0,SELECT_TEXT_ID,0,R.string.select_text);
  menu.add(0,COPY_ALL_ID,0,R.string.copy_all);
  menu.add(0,PASTE_ID,0,R.string.paste);
  menu.add(0,SEND_CONTROL_KEY_ID,0,R.string.send_control_key);
  menu.add(0,SEND_FN_KEY_ID,0,R.string.send_fn_key);
  if (!canPaste()) {
    menu.getItem(PASTE_ID).setEnabled(false);
  }
}
 

Example 14

From project android-vpn-settings, under directory /src/com/android/settings/vpn/.

Source file: VpnSettings.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  VpnProfile p=getProfile(getProfilePositionFrom((AdapterContextMenuInfo)menuInfo));
  if (p != null) {
    VpnState state=p.getState();
    menu.setHeaderTitle(p.getName());
    boolean isIdle=(state == VpnState.IDLE);
    boolean isNotConnect=(isIdle || (state == VpnState.DISCONNECTING) || (state == VpnState.CANCELLED));
    menu.add(0,CONTEXT_MENU_CONNECT_ID,0,R.string.vpn_menu_connect).setEnabled(isIdle && (mActiveProfile == null));
    menu.add(0,CONTEXT_MENU_DISCONNECT_ID,0,R.string.vpn_menu_disconnect).setEnabled(state == VpnState.CONNECTED);
    menu.add(0,CONTEXT_MENU_EDIT_ID,0,R.string.vpn_menu_edit).setEnabled(isNotConnect);
    menu.add(0,CONTEXT_MENU_DELETE_ID,0,R.string.vpn_menu_delete).setEnabled(isNotConnect);
  }
}
 

Example 15

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/activity/.

Source file: MovieLibraryActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
switch (mTabHost.getCurrentTab()) {
case 0:
    mMovieController.onCreateContextMenu(menu,v,menuInfo);
  break;
case 1:
mActorController.onCreateContextMenu(menu,v,menuInfo);
break;
case 2:
mGenresController.onCreateContextMenu(menu,v,menuInfo);
break;
case 3:
mFileController.onCreateContextMenu(menu,v,menuInfo);
break;
}
}
 

Example 16

From project Android_1, under directory /PropagatedIntents/src/com/example/android/notepad/.

Source file: NotesList.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"bad menuInfo",e);
    return;
  }
  Cursor cursor=(Cursor)getListAdapter().getItem(info.position);
  if (cursor == null) {
    return;
  }
  menu.setHeaderTitle(cursor.getString(COLUMN_INDEX_TITLE));
  menu.add(0,MENU_ITEM_DELETE,0,R.string.menu_delete);
}
 

Example 17

From project android_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: GalleryPicker.java

  15 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.gallerypicker);
  mGridView=(GridView)findViewById(R.id.albums);
  mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      launchFolderGallery(position);
    }
  }
);
  mGridView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener(){
    public void onCreateContextMenu(    ContextMenu menu,    View v,    final ContextMenuInfo menuInfo){
      onCreateGalleryPickerContextMenu(menu,menuInfo);
    }
  }
);
  mReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      onReceiveMediaBroadcast(intent);
    }
  }
;
  mDbObserver=new ContentObserver(mHandler){
    @Override public void onChange(    boolean selfChange){
      rebake(false,ImageManager.isMediaScannerScanning(getContentResolver()));
    }
  }
;
  ImageManager.ensureOSXCompatibleFolder();
}
 

Example 18

From project android_packages_apps_Tag, under directory /src/com/android/apps/tag/.

Source file: MyTagList.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo info){
  Cursor cursor=mAdapter.getCursor();
  if (cursor == null || cursor.isClosed() || !cursor.moveToPosition(((AdapterContextMenuInfo)info).position)) {
    return;
  }
  menu.setHeaderTitle(cursor.getString(TagQuery.COLUMN_TITLE));
  long id=cursor.getLong(TagQuery.COLUMN_ID);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.my_tag_list_context_menu,menu);
  menu.findItem(R.id.set_as_active).setVisible(id != mActiveTagId);
  mTagIdLongPressed=id;
  if (mWriteSupport) {
    menu.add(0,1,0,"Write to tag");
  }
}
 

Example 19

From project andtweet, under directory /src/com/xorcode/andtweet/.

Source file: TweetListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,view,menuInfo);
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"bad menuInfo",e);
    return;
  }
  int m=0;
  menu.add(0,CONTEXT_MENU_ITEM_REPLY,m++,R.string.menu_item_reply);
  menu.add(0,CONTEXT_MENU_ITEM_RETWEET,m++,R.string.menu_item_retweet);
  Uri uri=ContentUris.withAppendedId(Tweets.CONTENT_URI,info.id);
  Cursor c=getContentResolver().query(uri,new String[]{Tweets._ID,Tweets.MESSAGE,Tweets.AUTHOR_ID,Tweets.FAVORITED},null,null,null);
  try {
    c.moveToFirst();
    menu.setHeaderTitle(c.getString(c.getColumnIndex(Tweets.MESSAGE)));
    if (c.getInt(c.getColumnIndex(Tweets.FAVORITED)) == 1) {
      menu.add(0,CONTEXT_MENU_ITEM_DESTROY_FAVORITE,m++,R.string.menu_item_destroy_favorite);
    }
 else {
      menu.add(0,CONTEXT_MENU_ITEM_FAVORITE,m++,R.string.menu_item_favorite);
    }
    if (AndTweetPreferences.getDefaultSharedPreferences().getString(PreferencesActivity.KEY_TWITTER_USERNAME,null).equals(c.getString(c.getColumnIndex(Tweets.AUTHOR_ID)))) {
      menu.add(0,CONTEXT_MENU_ITEM_DESTROY_STATUS,m++,R.string.menu_item_destroy_status);
    }
  }
 catch (  Exception e) {
    Log.e(TAG,"onCreateContextMenu: " + e.toString());
  }
 finally {
    if (c != null && !c.isClosed())     c.close();
  }
}
 

Example 20

From project Anki-Android, under directory /src/com/ichi2/anki/.

Source file: SharedDeckPicker.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  Resources res=getResources();
  int position=((AdapterContextMenuInfo)menuInfo).position;
  Object obj=mAllSharedDecks.get(position);
  if (obj instanceof Download) {
    Download download=(Download)obj;
    menu.add(Menu.NONE,MENU_CANCEL,Menu.NONE,res.getString(R.string.cancel_download));
    if (download.getStatus() == SharedDeckDownload.STATUS_PAUSED) {
      menu.add(Menu.NONE,MENU_RESUME,Menu.NONE,res.getString(R.string.resume_download));
    }
 else     if (download.getStatus() == SharedDeckDownload.STATUS_UPDATING) {
      menu.add(Menu.NONE,MENU_PAUSE,Menu.NONE,res.getString(R.string.pause_download));
    }
  }
}
 

Example 21

From project apg, under directory /src/org/thialfihar/android/apg/.

Source file: MainActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  TextView nameTextView=(TextView)v.findViewById(R.id.accountName);
  if (nameTextView != null) {
    menu.setHeaderTitle(nameTextView.getText());
    menu.add(0,Id.menu.delete,0,R.string.menu_deleteAccount);
  }
}
 

Example 22

From project BF3-Battlelog, under directory /src/com/ninetwozero/battlelog/activity/.

Source file: DashboardActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  if (mSlidingDrawer.isOpened()) {
switch (mViewPagerCom.getCurrentItem()) {
case 0:
      mFragmentComFriends.createContextMenu(menu,view,menuInfo);
    break;
default :
  break;
}
}
 else {
switch (mViewPager.getCurrentItem()) {
case VIEWPAGER_POSITION_FEED:
mFragmentFeed.createContextMenu(menu,view,menuInfo);
break;
default :
break;
}
}
}
 

Example 23

From project Birthday-widget, under directory /Birthday/src/main/java/cz/krtinec/birthday/.

Source file: Birthday.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  menu.setHeaderTitle(R.string.context_menu_header);
  Event item=listOfContacts.get(((AdapterContextMenuInfo)menuInfo).position);
  MenuItem callItem=menu.add(R.string.context_menu_call).setEnabled(false);
  MenuItem smstItem=menu.add(R.string.context_menu_text).setEnabled(false);
  MenuItem emailItem=menu.add(R.string.context_menu_email).setEnabled(false);
  String phone=BirthdayProvider.getPhoneNumber(this,item.getContactId());
  if (phone != null) {
    smstItem.setEnabled(true);
    Intent smsIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("sms:" + phone));
    smsIntent.putExtra("sms_body",Utils.getCongrats(this,item));
    smstItem.setIntent(smsIntent);
    callItem.setEnabled(true);
    Intent callIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("tel:" + phone));
    callItem.setIntent(callIntent);
  }
  String email=BirthdayProvider.getEmail(this,item.getContactId());
  if (email != null) {
    emailItem.setEnabled(true);
    String subject=getString(R.string.congrats_subject);
    String body=Utils.getCongrats(this,item);
    Intent mailer=new Intent(Intent.ACTION_SEND);
    mailer.setType("text/plain");
    mailer.putExtra(Intent.EXTRA_EMAIL,new String[]{email});
    mailer.putExtra(Intent.EXTRA_SUBJECT,subject);
    mailer.putExtra(Intent.EXTRA_TEXT,body);
    emailItem.setIntent(mailer);
  }
}
 

Example 24

From project BombusLime, under directory /src/org/bombusim/lime/fragments/.

Source file: ChatFragment.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  menu.setHeaderTitle(R.string.messageMenuTitle);
  MenuInflater inflater=getActivity().getMenuInflater();
  inflater.inflate(R.menu.message_menu,menu);
}
 

Example 25

From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/.

Source file: BookCatalogueClassic.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  ExpandableListView.ExpandableListContextMenuInfo info=(ExpandableListView.ExpandableListContextMenuInfo)menuInfo;
  try {
    if (ExpandableListView.getPackedPositionType(info.packedPosition) == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
      MenuItem delete=menu.add(0,DELETE_ID,0,R.string.menu_delete);
      delete.setIcon(android.R.drawable.ic_menu_delete);
      MenuItem edit_book=menu.add(0,EDIT_BOOK,0,R.string.edit_book);
      edit_book.setIcon(android.R.drawable.ic_menu_edit);
      MenuItem edit_book_notes=menu.add(0,EDIT_BOOK_NOTES,0,R.string.edit_book_notes);
      edit_book_notes.setIcon(R.drawable.ic_menu_compose);
      MenuItem edit_book_friends=menu.add(0,EDIT_BOOK_FRIENDS,0,R.string.edit_book_friends);
      edit_book_friends.setIcon(R.drawable.ic_menu_cc);
      MenuItem edit_book_send_to_gr=menu.add(0,EDIT_BOOK_SEND_TO_GR,0,R.string.edit_book_send_to_gr);
      edit_book_send_to_gr.setIcon(R.drawable.ic_menu_cc);
    }
 else     if (ExpandableListView.getPackedPositionType(info.packedPosition) == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
switch (sort) {
case SORT_AUTHOR:
case SORT_AUTHOR_GIVEN:
{
          MenuItem edit_book=menu.add(0,EDIT_AUTHOR_ID,0,R.string.menu_edit_author);
          edit_book.setIcon(android.R.drawable.ic_menu_edit);
          break;
        }
case SORT_SERIES:
{
        MenuItem delete=menu.add(0,DELETE_SERIES_ID,0,R.string.menu_delete_series);
        delete.setIcon(android.R.drawable.ic_menu_delete);
        MenuItem edit_book=menu.add(0,EDIT_SERIES_ID,0,R.string.menu_edit_series);
        edit_book.setIcon(android.R.drawable.ic_menu_edit);
        break;
      }
  }
}
}
 catch (NullPointerException e) {
Logger.logError(e);
}
}
 

Example 26

From project Catroid-maven-playground, under directory /src/main/java/at/tugraz/ist/catroid/ui/.

Source file: ScriptActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  if (view.getId() == R.id.brick_list_view) {
    menu.setHeaderTitle(R.string.script_context_menu_title);
    if (adapter.getItem(listView.getTouchedListPosition()) instanceof Script) {
      scriptToEdit=(Script)adapter.getItem(listView.getTouchedListPosition());
      MenuInflater inflater=getMenuInflater();
      inflater.inflate(R.menu.script_menu,menu);
    }
  }
}
 

Example 27

From project cmsandroid, under directory /src/com/zia/freshdocs/activity/.

Source file: HostsActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  HostAdapter adapter=(HostAdapter)getListAdapter();
  CMISHost host=adapter.getItem(((AdapterContextMenuInfo)menuInfo).position);
  if (!host.getId().equals(Constants.NEW_HOST_ID)) {
    MenuInflater inflater=getMenuInflater();
    inflater.inflate(R.menu.host_context_menu,menu);
  }
}
 

Example 28

From project creamed_glacier_app_settings, under directory /src/com/android/settings/vpn2/.

Source file: VpnSettings.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo info){
  if (mDialog != null) {
    Log.v(TAG,"onCreateContextMenu() is called when mDialog != null");
    return;
  }
  if (info instanceof AdapterContextMenuInfo) {
    Preference preference=(Preference)getListView().getItemAtPosition(((AdapterContextMenuInfo)info).position);
    if (preference instanceof VpnPreference) {
      VpnProfile profile=((VpnPreference)preference).getProfile();
      mSelectedKey=profile.key;
      menu.setHeaderTitle(profile.name);
      menu.add(Menu.NONE,R.string.vpn_menu_edit,0,R.string.vpn_menu_edit);
      menu.add(Menu.NONE,R.string.vpn_menu_delete,0,R.string.vpn_menu_delete);
    }
  }
}
 

Example 29

From project daily-money, under directory /dailymoney/src/com/bottleworks/dailymoney/ui/.

Source file: AccountDetailListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  if (v.getId() == R.id.accdetlist_list) {
    getMenuInflater().inflate(R.menu.accdetlist_ctxmenu,menu);
  }
}
 

Example 30

From project Diktofon, under directory /app/src/kaljurand_at_gmail_dot_com/diktofon/activity/.

Source file: RecordingListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.cm_notes,menu);
  final AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  final Recording note=(Recording)mListView.getItemAtPosition(info.position);
  if (!note.needsTrans()) {
    MenuItem menuItem=menu.findItem(R.id.cm_notes_transcribe);
    menuItem.setEnabled(false);
  }
}
 

Example 31

From project DroidExpenses, under directory /de.simtem.android.expenses/src/de/simtem/android/expenses/.

Source file: Accounts.java

  15 
vote

/** 
 * @see Activity#onCreateContextMenu(ContextMenu,View,ContextMenuInfo)
 */
@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  int position=((AdapterContextMenuInfo)menuInfo).position;
  Account account=accounts.getItem(position);
  if (account != null) {
    getMenuInflater().inflate(R.menu.account_context,menu);
    menu.setHeaderTitle(account.getName());
  }
}
 

Example 32

From project dungbeetle, under directory /src/edu/stanford/mobisocial/dungbeetle/.

Source file: GroupsActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  Cursor cursor=(Cursor)mGroups.getItem(info.position);
  final Group g=new Group(cursor);
  menu.setHeaderTitle(g.name);
  String[] menuItems=new String[]{"Delete"};
  for (int i=0; i < menuItems.length; i++) {
    menu.add(Menu.NONE,i,i,menuItems[i]);
  }
}
 

Example 33

From project ElectricSleep, under directory /src/com/androsz/electricsleepbeta/alarmclock/.

Source file: AlarmClock.java

  15 
vote

@Override public void onCreateContextMenu(final ContextMenu menu,final View view,final ContextMenuInfo menuInfo){
  menu.add(android.view.Menu.NONE,R.id.enable_alarm,android.view.Menu.NONE,R.string.enable_alarm);
  menu.add(android.view.Menu.NONE,R.id.edit_alarm,android.view.Menu.NONE,R.string.menu_edit_alarm);
  menu.add(android.view.Menu.NONE,R.id.delete_alarm,android.view.Menu.NONE,R.string.delete_alarm);
  final AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  final Cursor c=(Cursor)mAlarmsList.getAdapter().getItem(info.position);
  final Alarm alarm=new Alarm(c);
  final Calendar cal=Calendar.getInstance();
  cal.set(Calendar.HOUR_OF_DAY,alarm.hour);
  cal.set(Calendar.MINUTE,alarm.minutes);
  final String time=Alarms.formatTime(this,cal);
  final View v=mFactory.inflate(R.layout.context_menu_header,null);
  TextView textView=(TextView)v.findViewById(R.id.header_time);
  textView.setText(time);
  textView=(TextView)v.findViewById(R.id.header_label);
  textView.setText(alarm.label);
  menu.setHeaderView(v);
  if (alarm.enabled) {
    menu.findItem(R.id.enable_alarm).setTitle(R.string.disable_alarm);
  }
}
 

Example 34

From project fanfoudroid, under directory /src/com/ch_linghu/fanfoudroid/.

Source file: FollowingActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  if (getUserId() == myself) {
    AdapterView.AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
    User user=getContextItemUser(info.position);
    menu.add(0,CONTENT_DEL_FRIEND,0,getResources().getString(R.string.cmenu_user_addfriend_prefix) + user.screenName + getResources().getString(R.string.cmenu_user_friend_suffix));
  }
}
 

Example 35

From project filemanager, under directory /FileManager/src/org/openintents/filemanager/lists/.

Source file: SimpleFileListFragment.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  MenuInflater inflater=new MenuInflater(getActivity());
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    e.printStackTrace();
    return;
  }
  MenuUtils.fillContextMenu((FileHolder)mAdapter.getItem(info.position),menu,inflater,getActivity());
}
 

Example 36

From project gh4a, under directory /src/com/gh4a/.

Source file: SearchActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  menu.clear();
  if (v.getId() == R.id.list_search) {
    AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)menuInfo;
    menu.setHeaderTitle("Go to");
    if (mSearchByUser) {
      User user=(User)userAdapter.getItem(info.position);
      menu.add("User " + user.getLogin() + (!StringUtils.isBlank(user.getName()) ? " - " + user.getName() : ""));
    }
 else {
      SearchRepository repository=(SearchRepository)repositoryAdapter.getItem(info.position);
      menu.add("User " + repository.getOwner());
      menu.add("Repo " + repository.getName());
    }
  }
  super.onCreateContextMenu(menu,v,menuInfo);
}
 

Example 37

From project Gibberbot, under directory /src/info/guardianproject/otr/app/im/app/.

Source file: LandingPage.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"bad menuInfo",e);
    return;
  }
  Cursor providerCursor=(Cursor)getListAdapter().getItem(info.position);
  menu.setHeaderTitle(providerCursor.getString(PROVIDER_FULLNAME_COLUMN));
  if (providerCursor.isNull(ACTIVE_ACCOUNT_ID_COLUMN)) {
    menu.add(0,ID_ADD_ACCOUNT,0,R.string.menu_edit_account);
    menu.add(0,ID_REMOVE_ACCOUNT,0,R.string.menu_remove_account).setIcon(android.R.drawable.ic_menu_delete);
    return;
  }
  long providerId=providerCursor.getLong(PROVIDER_ID_COLUMN);
  boolean isLoggingIn=isSigningIn(providerCursor);
  boolean isLoggedIn=isSignedIn(providerCursor);
  BrandingResources brandingRes=mApp.getBrandingResource(providerId);
  menu.add(0,ID_VIEW_CONTACT_LIST,0,brandingRes.getString(BrandingResourceIDs.STRING_MENU_CONTACT_LIST));
  if (isLoggedIn) {
    menu.add(0,ID_SIGN_OUT,0,R.string.menu_sign_out).setIcon(android.R.drawable.ic_menu_close_clear_cancel);
  }
 else   if (isLoggingIn) {
    menu.add(0,ID_SIGN_OUT,0,R.string.menu_cancel_signin).setIcon(android.R.drawable.ic_menu_close_clear_cancel);
  }
 else {
    menu.add(0,ID_SIGN_IN,0,R.string.sign_in);
  }
  boolean isAccountEditable=providerCursor.getInt(ACTIVE_ACCOUNT_LOCKED) == 0;
  if (isAccountEditable && !isLoggingIn && !isLoggedIn) {
    menu.add(0,ID_EDIT_ACCOUNT,0,R.string.menu_edit_account).setIcon(android.R.drawable.ic_menu_edit);
    menu.add(0,ID_REMOVE_ACCOUNT,0,R.string.menu_remove_account).setIcon(android.R.drawable.ic_menu_delete);
  }
}
 

Example 38

From project hsDroid, under directory /src/de/nware/app/hsDroid/ui/.

Source file: Certifications.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  checkSession();
  setContentView(R.layout.certifications);
  customTitle(getString(R.string.title_Certifications));
  defaultDLPath=Environment.getExternalStorageDirectory() + "/" + Environment.DIRECTORY_DOWNLOADS;
  mPreferences=PreferenceManager.getDefaultSharedPreferences(this);
  listView=(ListView)findViewById(R.id.cert_listView);
  final ContentResolver resolver=getContentResolver();
  Cursor cursor=resolver.query(CertificationsCol.CONTENT_URI,null,null,null,null);
  startManagingCursor(cursor);
  final String[] from=new String[]{CertificationsCol.TITLE};
  final int[] to=new int[]{R.id.cert_textView};
  listView.setAdapter(new SimpleCursorAdapter(getApplicationContext(),R.layout.certifications_row_item,cursor,from,to));
  findViewById(R.id.certificationsProgress).setVisibility(View.GONE);
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (isSdCardAvailable()) {
        view.showContextMenu();
      }
    }
  }
);
  listView.setOnCreateContextMenuListener(new OnCreateContextMenuListener(){
    @Override public void onCreateContextMenu(    ContextMenu menu,    View view,    ContextMenuInfo menuInfo){
      menu.setHeaderTitle(R.string.title_certContextMenu_selectAction);
      getMenuInflater().inflate(R.menu.cert_menu,menu);
    }
  }
);
}
 

Example 39

From project jamendo-android, under directory /src/com/teleca/jamendo/activity/.

Source file: DownloadActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  if (v.getId() == R.id.DownloadListView) {
    MenuInflater inflater=getMenuInflater();
    inflater.inflate(R.menu.download_context,menu);
  }
}
 

Example 40

From project k-9, under directory /src/com/fsck/k9/activity/.

Source file: Accounts.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  menu.setHeaderTitle(R.string.accounts_context_menu_title);
  AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  BaseAccount account=mAdapter.getItem(info.position);
  if ((account instanceof Account) && !((Account)account).isEnabled()) {
    getMenuInflater().inflate(R.menu.disabled_accounts_context,menu);
  }
 else {
    getMenuInflater().inflate(R.menu.accounts_context,menu);
  }
  if (account instanceof SearchAccount) {
    for (int i=0; i < menu.size(); i++) {
      android.view.MenuItem item=menu.getItem(i);
      item.setVisible(false);
    }
  }
 else {
    EnumSet<ACCOUNT_LOCATION> accountLocation=accountLocation(account);
    if (accountLocation.contains(ACCOUNT_LOCATION.TOP)) {
      menu.findItem(R.id.move_up).setEnabled(false);
    }
 else {
      menu.findItem(R.id.move_up).setEnabled(true);
    }
    if (accountLocation.contains(ACCOUNT_LOCATION.BOTTOM)) {
      menu.findItem(R.id.move_down).setEnabled(false);
    }
 else {
      menu.findItem(R.id.move_down).setEnabled(true);
    }
  }
}
 

Example 41

From project K6nele, under directory /app/src/ee/ioc/phon/android/speak/.

Source file: AppListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.cm_app,menu);
  final AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  Cursor c=(Cursor)getListView().getItemAtPosition(info.position);
  long grammarId=c.getLong(c.getColumnIndex(App.Columns.GRAMMAR));
  long serverId=c.getLong(c.getColumnIndex(App.Columns.SERVER));
  if (grammarId == 0) {
    menu.findItem(R.id.cmAppRemoveGrammar).setEnabled(false);
  }
  if (serverId == 0) {
    menu.findItem(R.id.cmAppRemoveServer).setEnabled(false);
  }
}
 

Example 42

From project kumvandroid, under directory /src/com/ijuru/kumva/activity/.

Source file: DictionariesActivity.java

  15 
vote

/** 
 * @see android.app.Activity#onCreateContextMenu(ContextMenu,View,ContextMenuInfo)
 */
@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  this.editDictionary=adapter.getItem(info.position);
  menu.setHeaderTitle(editDictionary.getName());
  menu.add(Menu.NONE,MENU_UPDATE,0,R.string.str_update);
  menu.add(Menu.NONE,MENU_REMOVE,1,R.string.str_remove);
}
 

Example 43

From project liquidroid, under directory /src/liqui/droid/activity/.

Source file: Search.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  menu.clear();
  if (v.getId() == R.id.list_search) {
    AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)menuInfo;
    menu.setHeaderTitle("Go to");
    if (mSearchByUser) {
      Member user=(Member)mMemberAdapter.getItem(info.position);
      menu.add("User " + user.name + (!StringUtils.isBlank(user.name) ? " - " + user.name : ""));
    }
  }
  super.onCreateContextMenu(menu,v,menuInfo);
}
 

Example 44

From project Locast-Android, under directory /src/edu/mit/mobile/android/locast/casts/.

Source file: CastListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  final ClassCastException e) {
    Log.e(TAG,"bad menuInfo",e);
    return;
  }
  final Cursor c=(Cursor)getListAdapter().getItem(info.position);
  if (c == null) {
    return;
  }
  final MenuInflater menuInflater=getMenuInflater();
  menuInflater.inflate(R.menu.cast_context,menu);
  menuInflater.inflate(R.menu.cast_options,menu);
  menu.setHeaderTitle(c.getString(c.getColumnIndex(Cast._TITLE)));
  final boolean canEdit=Cast.canEdit(this,c);
  menu.findItem(R.id.cast_edit).setVisible(canEdit);
  menu.findItem(R.id.cast_delete).setVisible(canEdit);
}
 

Example 45

From project Memo, under directory /src/com/ngarside/memo/.

Source file: ListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  menu.setHeaderTitle(getString(R.string.image));
  menu.add(0,v.getId(),0,getString(R.string.edit));
  menu.add(0,v.getId(),0,getString(R.string.delete));
  menu.add(0,v.getId(),0,getString(R.string.share));
  if (folders.getFolders().length > 0) {
    menu.add(0,v.getId(),0,getString(R.string.move));
  }
}
 

Example 46

From project MicDroid, under directory /src/com/intervigil/micdroid/.

Source file: RecordingLibrary.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  menu.setHeaderTitle(R.string.recording_options_title);
  menu.add(Menu.NONE,R.string.recording_options_play,Menu.NONE,R.string.recording_options_play);
  menu.add(Menu.NONE,R.string.recording_options_delete,Menu.NONE,R.string.recording_options_delete);
  menu.add(Menu.NONE,R.string.recording_options_rename,Menu.NONE,R.string.recording_options_rename);
  menu.add(Menu.NONE,R.string.recording_options_set_ringtone,Menu.NONE,R.string.recording_options_set_ringtone);
  menu.add(Menu.NONE,R.string.recording_options_set_notification,Menu.NONE,R.string.recording_options_set_notification);
  menu.add(Menu.NONE,R.string.recording_options_share,Menu.NONE,R.string.recording_options_share);
}
 

Example 47

From project mobilis, under directory /MobilisXHunt/MobilisXHunt_Android/src/de/tudresden/inf/rn/mobilis/android/xhunt/activity/.

Source file: LobbyActivity.java

  15 
vote

public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  XHuntPlayer player=mGame.getPlayerByJID(mMxaProxy.getXmppJid());
  Log.v(TAG,"serviceVersion: " + mMxaProxy.getIQProxy().getServiceVersion());
  MenuInflater inflater;
  if (player != null && player.isModerator()) {
    inflater=getMenuInflater();
    if (mMxaProxy.getIQProxy().getServiceVersion() > 2) {
      inflater.inflate(R.menu.context_lobby_ttmrx,menu);
    }
 else {
      inflater.inflate(R.menu.context_lobby,menu);
    }
    selectedPlayerJid=v.getTag().toString();
  }
 else   if (mMxaProxy.getIQProxy().getServiceVersion() > 2) {
    inflater=getMenuInflater();
    inflater.inflate(R.menu.context_lobby_ttagent,menu);
  }
}
 

Example 48

From project motelib, under directory /src/com/cafbit/motelib/settings/.

Source file: DevicesActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  if ((v.equals(getListView())) && (menuInfo instanceof AdapterContextMenuInfo)) {
    AdapterContextMenuInfo acmu=(AdapterContextMenuInfo)menuInfo;
    if (acmu.id != -1) {
      onDeviceCreateContextMenu((Device)adapter.getItem((int)acmu.id),menu);
    }
  }
}
 

Example 49

From project mp3tunes-android, under directory /src/com/mp3tunes/android/activity/.

Source file: AlbumBrowser.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfoIn){
  menu.add(0,QUEUE,0,R.string.menu_play_selection);
  menu.add(0,PLAY_SELECTION,0,R.string.menu_play_selection);
  menu.add(0,SEARCH,0,R.string.search);
  AdapterContextMenuInfo mi=(AdapterContextMenuInfo)menuInfoIn;
  mAlbumCursor.moveToPosition(mi.position);
  mCurrentAlbumId=mAlbumCursor.getString(mAlbumCursor.getColumnIndexOrThrow(MediaStore.Audio.Albums._ID));
  mCurrentAlbumName=mAlbumCursor.getString(mAlbumCursor.getColumnIndexOrThrow(MediaStore.Audio.Albums.ALBUM));
  menu.setHeaderTitle(mCurrentAlbumName);
}
 

Example 50

From project multi-translator, under directory /src/com/robtheis/translator/.

Source file: MultiTranslatorActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  if (v.equals(translation1)) {
    menu.add(Menu.NONE,OPTIONS_COPY_TRANSLATION1,Menu.NONE,"Copy translated text");
  }
 else   if (v.equals(translation2)) {
    menu.add(Menu.NONE,OPTIONS_COPY_TRANSLATION2,Menu.NONE,"Copy translated text");
  }
 else   if (v.equals(translation3)) {
    menu.add(Menu.NONE,OPTIONS_COPY_TRANSLATION3,Menu.NONE,"Copy translated text");
  }
 else   if (v.equals(translation4)) {
    menu.add(Menu.NONE,OPTIONS_COPY_TRANSLATION4,Menu.NONE,"Copy translated text");
  }
}
 

Example 51

From project MyExpenses, under directory /src/org/totschnig/myexpenses/.

Source file: MyExpenses.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  menu.add(0,R.id.DELETE_COMMAND,0,R.string.menu_delete);
  menu.add(0,R.id.SHOW_DETAIL_COMMAND,0,R.string.menu_show_detail);
  if (mDbHelper.getAccountCount(null) > 1) {
    menu.add(0,R.id.MOVE_TRANSACTION_COMMAND,0,R.string.menu_move_transaction);
  }
}
 

Example 52

From project NotePad, under directory /NotePad/src/org/openintents/notepad/noteslist/.

Source file: NotesList.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"bad menuInfo",e);
    return;
  }
  Cursor cursor=(Cursor)getListAdapter().getItem(info.position);
  if (cursor == null) {
    return;
  }
  Uri noteUri=ContentUris.withAppendedId(getIntent().getData(),info.id);
  long encrypted=cursor.getLong(NotesListCursor.COLUMN_INDEX_ENCRYPTED);
  menu.setHeaderTitle(cursor.getString(NotesListCursor.COLUMN_INDEX_TITLE));
  menu.add(0,MENU_ITEM_EDIT_TAGS,0,R.string.menu_edit_tags);
  if (encrypted == 0) {
    menu.add(0,MENU_ITEM_SHARE,0,R.string.menu_share);
    menu.add(0,MENU_ITEM_ENCRYPT,0,R.string.menu_encrypt);
  }
 else {
    menu.add(0,MENU_ITEM_UNENCRYPT,0,R.string.menu_undo_encryption);
  }
  menu.add(0,MENU_ITEM_DELETE,0,R.string.menu_delete);
  if (encrypted == 0) {
    Intent intent=new Intent(null,noteUri);
    intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
    menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE,0,0,new ComponentName(this,NotesList.class),null,intent,0,null);
  }
}
 

Example 53

From project nuxeo-android, under directory /nuxeo-android-connector/src/main/java/org/nuxeo/android/activities/.

Source file: BaseDocumentsListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  if (v.getId() == listView.getId()) {
    AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)menuInfo;
    Document doc=documentsList.getDocument(info.position);
    menu.setHeaderTitle(doc.getTitle());
    populateContextMenu(doc,menu);
  }
  super.onCreateContextMenu(menu,v,menuInfo);
}
 

Example 54

From project ohmagePhone, under directory /src/org/ohmage/activity/.

Source file: QueryTestActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  if (v instanceof TextView) {
    menu.add(0,CONTEXT_COPY,0,"Copy");
    TextView txView=(TextView)v;
    myTargetTextView=txView;
    txView.setBackgroundColor(Color.YELLOW);
  }
}
 

Example 55

From project Ohmage_Phone, under directory /src/org/ohmage/feedback/.

Source file: FBTestActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  if (v instanceof TextView) {
    menu.add(0,CONTEXT_COPY,0,"Copy");
    TextView txView=(TextView)v;
    myTargetTextView=txView;
    txView.setBackgroundColor(Color.YELLOW);
  }
}
 

Example 56

From project onebusaway-android, under directory /src/com/joulespersecond/seattlebusbot/.

Source file: MyRouteListFragmentBase.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  final TextView text=(TextView)info.targetView.findViewById(R.id.short_name);
  menu.setHeaderTitle(getString(R.string.route_name,text.getText()));
  if (isShortcutMode()) {
    menu.add(0,CONTEXT_MENU_DEFAULT,0,R.string.my_context_create_shortcut);
  }
 else {
    menu.add(0,CONTEXT_MENU_DEFAULT,0,R.string.my_context_get_route_info);
  }
  menu.add(0,CONTEXT_MENU_SHOW_ON_MAP,0,R.string.my_context_showonmap);
  final String url=QueryUtils.RouteList.getUrl(getListView(),info.position);
  if (!TextUtils.isEmpty(url)) {
    menu.add(0,CONTEXT_MENU_SHOW_URL,0,R.string.my_context_show_schedule);
  }
}
 

Example 57

From project OneMoreDream, under directory /src/com/dixheure/.

Source file: AlarmClock.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  getMenuInflater().inflate(R.menu.context_menu,menu);
  final AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  final Cursor c=(Cursor)mAlarmsList.getAdapter().getItem((int)info.position);
  final Alarm alarm=new Alarm(c);
  final Calendar cal=Calendar.getInstance();
  cal.set(Calendar.HOUR_OF_DAY,alarm.hour);
  cal.set(Calendar.MINUTE,alarm.minutes);
  final String time=Alarms.formatTime(this,cal);
  final View v=mFactory.inflate(R.layout.context_menu_header,null);
  TextView textView=(TextView)v.findViewById(R.id.header_time);
  textView.setText(time);
  textView=(TextView)v.findViewById(R.id.header_label);
  textView.setText(alarm.label);
  menu.setHeaderView(v);
  if (alarm.enabled) {
    menu.findItem(R.id.enable_alarm).setTitle(R.string.disable_alarm);
  }
}
 

Example 58

From project OpenBike, under directory /src/fr/openbike/android/ui/.

Source file: OpenBikeListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,view,menuInfo);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.list_context_menu,menu);
  ViewHolder holder=((ViewHolder)((AdapterContextMenuInfo)menuInfo).targetView.getTag());
  menu.removeItem(holder.favorite.isChecked() ? R.id.add_favorite : R.id.remove_favorite);
  if (!Utils.isIntentAvailable(new Intent(Intent.ACTION_VIEW,Uri.parse("geo:0,0?q=bibi")),this)) {
    menu.removeItem(R.id.show_on_google_maps);
  }
  if (!Utils.isIntentAvailable(new Intent(Intent.ACTION_VIEW,Uri.parse("google.navigation:q=bibi")),this)) {
    menu.removeItem(R.id.navigate);
  }
  menu.removeItem(holder.favorite.isChecked() ? R.id.add_favorite : R.id.remove_favorite);
  mSelected=(String.valueOf((Integer)holder.favorite.getTag()));
  menu.setHeaderTitle(holder.name.getText());
}
 

Example 59

From project opensudoku, under directory /OpenSudoku/src/cz/romario/opensudoku/gui/.

Source file: FolderListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"bad menuInfo",e);
    return;
  }
  Cursor cursor=(Cursor)getListAdapter().getItem(info.position);
  if (cursor == null) {
    return;
  }
  menu.setHeaderTitle(cursor.getString(cursor.getColumnIndex(FolderColumns.NAME)));
  menu.add(0,MENU_ITEM_EXPORT,0,R.string.export_folder);
  menu.add(0,MENU_ITEM_RENAME,1,R.string.rename_folder);
  menu.add(0,MENU_ITEM_DELETE,2,R.string.delete_folder);
}
 

Example 60

From project opensudoku-blackberry, under directory /opensudoku/src/net/bmagro/blackberry/opensudoku/gui/.

Source file: FolderListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"bad menuInfo",e);
    return;
  }
  Cursor cursor=(Cursor)getListAdapter().getItem(info.position);
  if (cursor == null) {
    return;
  }
  menu.setHeaderTitle(cursor.getString(cursor.getColumnIndex(FolderColumns.NAME)));
  menu.add(0,MENU_ITEM_EXPORT,0,R.string.export_folder);
  menu.add(0,MENU_ITEM_RENAME,1,R.string.rename_folder);
  menu.add(0,MENU_ITEM_DELETE,2,R.string.delete_folder);
}
 

Example 61

From project packages_apps_FileManager, under directory /src/org/openintents/filemanager/.

Source file: FileManagerActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"bad menuInfo",e);
    return;
  }
  IconifiedTextListAdapter adapter=(IconifiedTextListAdapter)getListAdapter();
  if (adapter == null) {
    return;
  }
  IconifiedText it=(IconifiedText)adapter.getItem(info.position);
  menu.setHeaderTitle(it.getText());
  menu.setHeaderIcon(it.getIcon());
  File file=FileUtils.getFile(currentDirectory,it.getText());
  if (!file.isDirectory()) {
    if (mState == STATE_PICK_FILE) {
      menu.add(0,MENU_OPEN,0,R.string.menu_open);
    }
    menu.add(0,MENU_SEND,0,R.string.menu_send);
  }
  menu.add(0,MENU_MOVE,0,R.string.menu_move);
  if (!file.isDirectory()) {
    menu.add(0,MENU_COPY,0,R.string.menu_copy);
  }
  menu.add(0,MENU_RENAME,0,R.string.menu_rename);
  menu.add(0,MENU_DELETE,0,R.string.menu_delete);
  Uri data=Uri.fromFile(file);
  Intent intent=new Intent(null,data);
  String type=mMimeTypes.getMimeType(file.getName());
  intent.setDataAndType(data,type);
  Log.v(TAG,"Data=" + data);
  Log.v(TAG,"Type=" + type);
  if (type != null) {
    menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE,0,0,new ComponentName(this,FileManagerActivity.class),null,intent,0,null);
  }
}
 

Example 62

From project PageTurner, under directory /src/main/java/net/nightwhistler/pageturner/activity/.

Source file: ReadingActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  if (this.selectedWord != null) {
    final CharSequence word=this.selectedWord;
    String header=String.format(getString(R.string.word_select),selectedWord);
    menu.setHeaderTitle(header);
    final Intent intent=new Intent(PICK_RESULT_ACTION);
    intent.putExtra(EXTRA_QUERY,word.toString());
    intent.putExtra(EXTRA_FULLSCREEN,false);
    intent.putExtra(EXTRA_HEIGHT,400);
    intent.putExtra(EXTRA_GRAVITY,Gravity.BOTTOM);
    intent.putExtra(EXTRA_MARGIN_LEFT,100);
    if (isIntentAvailable(this,intent)) {
      MenuItem item=menu.add(getString(R.string.dictionary_lookup));
      item.setOnMenuItemClickListener(new OnMenuItemClickListener(){
        @Override public boolean onMenuItemClick(        MenuItem item){
          startActivityForResult(intent,5);
          return true;
        }
      }
);
    }
    MenuItem newItem=menu.add(getString(R.string.wikipedia_lookup));
    newItem.setOnMenuItemClickListener(new BrowserSearchMenuItem("http://en.wikipedia.org/wiki/Special:Search?search=" + URLEncoder.encode(word.toString())));
    MenuItem newItem2=menu.add(getString(R.string.google_lookup));
    newItem2.setOnMenuItemClickListener(new BrowserSearchMenuItem("http://www.google.com/search?q=" + URLEncoder.encode(word.toString())));
    this.selectedWord=null;
  }
}
 

Example 63

From project platform_packages_apps_alarmclock, under directory /src/com/android/alarmclock/.

Source file: AlarmClock.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  getMenuInflater().inflate(R.menu.context_menu,menu);
  final AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  final Cursor c=(Cursor)mAlarmsList.getAdapter().getItem((int)info.position);
  final Alarm alarm=new Alarm(c);
  final Calendar cal=Calendar.getInstance();
  cal.set(Calendar.HOUR_OF_DAY,alarm.hour);
  cal.set(Calendar.MINUTE,alarm.minutes);
  final String time=Alarms.formatTime(this,cal);
  final View v=mFactory.inflate(R.layout.context_menu_header,null);
  TextView textView=(TextView)v.findViewById(R.id.header_time);
  textView.setText(time);
  textView=(TextView)v.findViewById(R.id.header_label);
  textView.setText(alarm.label);
  menu.setHeaderView(v);
  if (alarm.enabled) {
    menu.findItem(R.id.enable_alarm).setTitle(R.string.disable_alarm);
  }
}
 

Example 64

From project platform_packages_apps_contacts, under directory /src/com/android/contacts/detail/.

Source file: ContactDetailFragment.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,view,menuInfo);
  AdapterView.AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  DetailViewEntry selectedEntry=(DetailViewEntry)mAllEntries.get(info.position);
  menu.setHeaderTitle(selectedEntry.data);
  menu.add(ContextMenu.NONE,ContextMenuIds.COPY_TEXT,ContextMenu.NONE,getString(R.string.copy_text));
  String selectedMimeType=selectedEntry.mimetype;
  boolean isUniqueMimeType=true;
  if (Phone.CONTENT_ITEM_TYPE.equals(selectedMimeType)) {
    isUniqueMimeType=mIsUniqueNumber;
  }
 else   if (Email.CONTENT_ITEM_TYPE.equals(selectedMimeType)) {
    isUniqueMimeType=mIsUniqueEmail;
  }
  if (selectedEntry.isPrimary) {
    menu.add(ContextMenu.NONE,ContextMenuIds.CLEAR_DEFAULT,ContextMenu.NONE,getString(R.string.clear_default));
  }
 else   if (!isUniqueMimeType) {
    menu.add(ContextMenu.NONE,ContextMenuIds.SET_DEFAULT,ContextMenu.NONE,getString(R.string.set_default));
  }
}
 

Example 65

From project platform_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: GalleryPicker.java

  15 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.gallerypicker);
  mGridView=(GridView)findViewById(R.id.albums);
  mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      launchFolderGallery(position);
    }
  }
);
  mGridView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener(){
    public void onCreateContextMenu(    ContextMenu menu,    View v,    final ContextMenuInfo menuInfo){
      onCreateGalleryPickerContextMenu(menu,menuInfo);
    }
  }
);
  mReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      onReceiveMediaBroadcast(intent);
    }
  }
;
  mDbObserver=new ContentObserver(mHandler){
    @Override public void onChange(    boolean selfChange){
      rebake(false,ImageManager.isMediaScannerScanning(getContentResolver()));
    }
  }
;
  ImageManager.ensureOSXCompatibleFolder();
}
 

Example 66

From project platform_packages_apps_im, under directory /src/com/android/im/app/.

Source file: LandingPage.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"bad menuInfo",e);
    return;
  }
  Cursor providerCursor=(Cursor)getListAdapter().getItem(info.position);
  menu.setHeaderTitle(providerCursor.getString(PROVIDER_FULLNAME_COLUMN));
  if (providerCursor.isNull(ACTIVE_ACCOUNT_ID_COLUMN)) {
    menu.add(0,ID_ADD_ACCOUNT,0,R.string.menu_add_account);
    return;
  }
  long providerId=providerCursor.getLong(PROVIDER_ID_COLUMN);
  boolean isLoggingIn=isSigningIn(providerCursor);
  boolean isLoggedIn=isSignedIn(providerCursor);
  BrandingResources brandingRes=mApp.getBrandingResource(providerId);
  if (!isLoggedIn) {
    menu.add(0,ID_SIGN_IN,0,R.string.sign_in).setIcon(com.android.internal.R.drawable.ic_menu_login);
  }
 else {
    menu.add(0,ID_VIEW_CONTACT_LIST,0,brandingRes.getString(BrandingResourceIDs.STRING_MENU_CONTACT_LIST));
    menu.add(0,ID_SIGN_OUT,0,R.string.menu_sign_out).setIcon(android.R.drawable.ic_menu_close_clear_cancel);
  }
  boolean isAccountEditible=providerCursor.getInt(ACTIVE_ACCOUNT_LOCKED) == 0;
  if (isAccountEditible && !isLoggingIn && !isLoggedIn) {
    menu.add(0,ID_EDIT_ACCOUNT,0,R.string.menu_edit_account).setIcon(android.R.drawable.ic_menu_edit);
    menu.add(0,ID_REMOVE_ACCOUNT,0,R.string.menu_remove_account).setIcon(android.R.drawable.ic_menu_delete);
  }
  menu.add(0,ID_SETTINGS,0,R.string.menu_settings);
}
 

Example 67

From project platform_packages_apps_mms, under directory /src/com/android/mms/ui/.

Source file: ComposeMessageActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  if (menuInfo != null) {
    Contact c=((RecipientContextMenuInfo)menuInfo).recipient;
    RecipientsMenuClickListener l=new RecipientsMenuClickListener(c);
    menu.setHeaderTitle(c.getName());
    if (c.existsInDatabase()) {
      menu.add(0,MENU_VIEW_CONTACT,0,R.string.menu_view_contact).setOnMenuItemClickListener(l);
    }
 else     if (canAddToContacts(c)) {
      menu.add(0,MENU_ADD_TO_CONTACTS,0,R.string.menu_add_to_contacts).setOnMenuItemClickListener(l);
    }
  }
}
 

Example 68

From project platform_packages_apps_music, under directory /src/com/android/music/.

Source file: AlbumBrowserActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfoIn){
  menu.add(0,PLAY_SELECTION,0,R.string.play_selection);
  SubMenu sub=menu.addSubMenu(0,ADD_TO_PLAYLIST,0,R.string.add_to_playlist);
  MusicUtils.makePlaylistMenu(this,sub);
  menu.add(0,DELETE_ITEM,0,R.string.delete_item);
  AdapterContextMenuInfo mi=(AdapterContextMenuInfo)menuInfoIn;
  mAlbumCursor.moveToPosition(mi.position);
  mCurrentAlbumId=mAlbumCursor.getString(mAlbumCursor.getColumnIndexOrThrow(MediaStore.Audio.Albums._ID));
  mCurrentAlbumName=mAlbumCursor.getString(mAlbumCursor.getColumnIndexOrThrow(MediaStore.Audio.Albums.ALBUM));
  mCurrentArtistNameForAlbum=mAlbumCursor.getString(mAlbumCursor.getColumnIndexOrThrow(MediaStore.Audio.Albums.ARTIST));
  mIsUnknownArtist=mCurrentArtistNameForAlbum == null || mCurrentArtistNameForAlbum.equals(MediaStore.UNKNOWN_STRING);
  mIsUnknownAlbum=mCurrentAlbumName == null || mCurrentAlbumName.equals(MediaStore.UNKNOWN_STRING);
  if (mIsUnknownAlbum) {
    menu.setHeaderTitle(getString(R.string.unknown_album_name));
  }
 else {
    menu.setHeaderTitle(mCurrentAlbumName);
  }
  if (!mIsUnknownAlbum || !mIsUnknownArtist) {
    menu.add(0,SEARCH,0,R.string.search_title);
  }
}
 

Example 69

From project platform_packages_apps_settings, under directory /src/com/android/settings/vpn2/.

Source file: VpnSettings.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo info){
  if (mDialog != null) {
    Log.v(TAG,"onCreateContextMenu() is called when mDialog != null");
    return;
  }
  if (info instanceof AdapterContextMenuInfo) {
    Preference preference=(Preference)getListView().getItemAtPosition(((AdapterContextMenuInfo)info).position);
    if (preference instanceof VpnPreference) {
      VpnProfile profile=((VpnPreference)preference).getProfile();
      mSelectedKey=profile.key;
      menu.setHeaderTitle(profile.name);
      menu.add(Menu.NONE,R.string.vpn_menu_edit,0,R.string.vpn_menu_edit);
      menu.add(Menu.NONE,R.string.vpn_menu_delete,0,R.string.vpn_menu_delete);
    }
  }
}
 

Example 70

From project QuotaForAndroid, under directory /Quota/src/com/southfreo/quota/activities/.

Source file: SummaryActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  if (v == getListView()) {
    AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)menuInfo;
    menu.setHeaderTitle("Provider Options");
    menu.add(0,0,0,"Delete");
    menu.add(1,1,1,"Force refresh");
  }
}
 

Example 71

From project Racenet-for-Android, under directory /src/org/racenet/.

Source file: NewsListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  ExpandableListContextMenuInfo info=(ExpandableListContextMenuInfo)menuInfo;
  final String title=((TextView)info.targetView).getText().toString();
  menu.setHeaderTitle(title);
  menu.add(0,0,0,"Delete");
}
 

Example 72

From project rapidandroid, under directory /rapidandroid/org.rapidandroid/src/org/rapidandroid/activity/.

Source file: FormCreator.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.form_create);
  ListView lsv=(ListView)findViewById(R.id.lsv_createfields);
  lsv.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener(){
    public void onCreateContextMenu(    ContextMenu menu,    View v,    ContextMenuInfo menuInfo){
      menu.setHeaderTitle("Current Field");
      menu.add(0,CONTEXT_MOVE_UP,0,"Move Up");
      menu.add(0,CONTEXT_MOVE_DOWN,0,"Move Down");
      menu.add(0,CONTEXT_REMOVE,0,"Remove").setIcon(android.R.drawable.ic_menu_delete);
    }
  }
);
  lsv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> arg0,    View arg1,    int arg2,    long arg3){
      selectedFieldPosition=arg2;
    }
  }
);
  TextView noFields=new TextView(this);
  noFields.setText("No fields");
  lsv.setEmptyView(noFields);
  updateFieldList();
}
 

Example 73

From project reddit-is-fun, under directory /src/com/andrewshu/android/reddit/comments/.

Source file: CommentsListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  int rowId=(int)info.id;
  ThingInfo item=mCommentsAdapter.getItem(rowId);
  if (rowId == 0) {
    menu.add(0,Constants.SHARE_CONTEXT_ITEM,Menu.NONE,"Share");
    if (getOpThingInfo().isSaved()) {
      menu.add(0,Constants.UNSAVE_CONTEXT_ITEM,Menu.NONE,"Unsave");
    }
 else {
      menu.add(0,Constants.SAVE_CONTEXT_ITEM,Menu.NONE,"Save");
    }
    if (getOpThingInfo().isHidden()) {
      menu.add(0,Constants.UNHIDE_CONTEXT_ITEM,Menu.NONE,"Unhide");
    }
 else {
      menu.add(0,Constants.HIDE_CONTEXT_ITEM,Menu.NONE,"Hide");
    }
    menu.add(0,Constants.DIALOG_VIEW_PROFILE,Menu.NONE,String.format(getResources().getString(R.string.user_profile),item.getAuthor()));
  }
 else   if (isLoadMoreCommentsPosition(rowId)) {
    menu.add(0,Constants.DIALOG_GOTO_PARENT,Menu.NONE,"Go to parent");
  }
 else   if (isHiddenCommentHeadPosition(rowId)) {
    menu.add(0,Constants.DIALOG_SHOW_COMMENT,Menu.NONE,"Show comment");
    menu.add(0,Constants.DIALOG_GOTO_PARENT,Menu.NONE,"Go to parent");
  }
 else {
    if (mSettings.getUsername() != null && mSettings.getUsername().equalsIgnoreCase(item.getAuthor())) {
      menu.add(0,Constants.DIALOG_EDIT,Menu.NONE,"Edit");
      menu.add(0,Constants.DIALOG_DELETE,Menu.NONE,"Delete");
    }
    menu.add(0,Constants.DIALOG_HIDE_COMMENT,Menu.NONE,"Hide comment");
    menu.add(0,Constants.DIALOG_GOTO_PARENT,Menu.NONE,"Go to parent");
    menu.add(0,Constants.DIALOG_VIEW_PROFILE,Menu.NONE,String.format(getResources().getString(R.string.user_profile),item.getAuthor()));
  }
}
 

Example 74

From project safe, under directory /Safe/src/org/openintents/safe/.

Source file: CategoryList.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info;
  info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  menu.setHeaderTitle(rows.get(info.position).plainName);
  menu.add(0,OPEN_CATEGORY_INDEX,0,R.string.open).setIcon(android.R.drawable.ic_menu_view).setAlphabeticShortcut('o');
  menu.add(0,EDIT_CATEGORY_INDEX,0,R.string.password_edit).setIcon(android.R.drawable.ic_menu_edit).setAlphabeticShortcut('e');
  menu.add(0,DEL_CATEGORY_INDEX,0,R.string.password_delete).setIcon(android.R.drawable.ic_menu_delete).setAlphabeticShortcut('d');
}
 

Example 75

From project SASAbus, under directory /src/it/sasabz/android/sasabus/.

Source file: SelectFavoritenActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  if (v.getId() == android.R.id.list) {
    AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)menuInfo;
    menu.setHeaderTitle(list.get(info.position).toString());
    menu.add(Menu.NONE,0,0,R.string.delete);
  }
}
 

Example 76

From project Schedule, under directory /android/src/com/happytap/schedule/activity/.

Source file: StationListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  if (!preferences.contains("f_" + currentStopId)) {
    favorite=menu.add("Add as Favorite");
    favorite.setVisible(false);
  }
 else {
    unfavorite=menu.add("Remove from Favorites");
    unfavorite.setVisible(false);
  }
  super.onCreateContextMenu(menu,v,menuInfo);
}
 

Example 77

From project SeriesGuide, under directory /SeriesGuide/src/com/battlelancer/seriesguide/ui/.

Source file: EpisodesFragment.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  WatchedBox watchedBox=(WatchedBox)info.targetView.findViewById(R.id.CustomCheckBoxWatched);
  if (watchedBox.isChecked()) {
    menu.add(0,CONTEXT_FLAG_UNWATCHED_ID,1,R.string.unmark_episode);
  }
 else {
    menu.add(0,CONTEXT_FLAG_WATCHED_ID,0,R.string.mark_episode);
  }
  menu.add(0,CONTEXT_FLAG_UNTILHERE_ID,2,R.string.mark_untilhere);
  menu.add(0,CONTEXT_MANAGE_LISTS_ID,3,R.string.list_item_manage);
  menu.add(0,CONTEXT_DELETE_EPISODE_ID,4,R.string.delete_show);
}
 

Example 78

From project shoppinglist, under directory /ShoppingList/src/org/openintents/shopping/ui/widget/.

Source file: StoreListView.java

  15 
vote

/** 
 * Additionally to the standard bindView, we also check for STATUS, and strike the item through if BOUGHT.
 */
@Override public void bindView(final View view,final Context context,final Cursor cursor){
  EditText v;
  v=(EditText)view.findViewById(R.id.price);
  v.setTag(null);
  v=(EditText)view.findViewById(R.id.aisle);
  v.setTag(null);
  mBinding=true;
  super.bindView(view,context,cursor);
  mBinding=false;
  boolean status=cursor.getInt(cursorColumnSTOCKS_ITEM) != 0;
  final int cursorpos=cursor.getPosition();
  CheckBox c=(CheckBox)view.findViewById(R.id.check);
  if (debug)   Log.i(TAG,"bindview: pos = " + cursor.getPosition());
  c.setTag(new Integer(cursor.getPosition()));
  c.setVisibility(CheckBox.VISIBLE);
  c.setChecked(status);
  c.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (debug)       Log.d(TAG,"Click: ");
      toggleItemstore(cursorpos);
    }
  }
);
  TextView t;
  t=(TextView)view.findViewById(R.id.name);
  t.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener(){
    public void onCreateContextMenu(    ContextMenu contextmenu,    View view,    ContextMenuInfo info){
    }
  }
);
  v=(EditText)view.findViewById(R.id.price);
  v.setTag(new Integer(cursor.getPosition()));
  v=(EditText)view.findViewById(R.id.aisle);
  v.setTag(new Integer(cursor.getPosition()));
}
 

Example 79

From project sls, under directory /src/com/adam/aslfms/.

Source file: ViewScrobbleCacheActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  if (info.id < 0)   return;
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.view_scrobble_cache_context,menu);
}
 

Example 80

From project Something-Awful-Android, under directory /application/src/com/ferg/awfulapp/.

Source file: ForumDisplayFragment.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu aMenu,View aView,ContextMenuInfo aMenuInfo){
  super.onCreateContextMenu(aMenu,aView,aMenuInfo);
  if (aMenuInfo instanceof AdapterContextMenuInfo) {
    android.view.MenuInflater inflater=getActivity().getMenuInflater();
    AdapterContextMenuInfo info=(AdapterContextMenuInfo)aMenuInfo;
    Cursor row=mCursorAdapter.getRow(info.id);
    if (row.getColumnIndex(AwfulThread.BOOKMARKED) > -1) {
      inflater.inflate(R.menu.thread_longpress,aMenu);
    }
  }
}
 

Example 81

From project SqueezeControl, under directory /src/com/squeezecontrol/.

Source file: AbstractMusicBrowserActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  AdapterContextMenuInfo mi=(AdapterContextMenuInfo)menuInfo;
  mCurrentPosition=mi.position;
  LayoutInflater mInflater=getLayoutInflater();
  View hview=mInflater.inflate(R.layout.context_header,null);
  TextView firstLine=(TextView)hview.findViewById(R.id.first_line);
  firstLine.setText(getSelectedItem().getName());
  menu.setHeaderView(hview);
  menu.add(0,PLAY_CTX_MENU_ITEM,0,"Play now");
  menu.add(0,ADD_TO_PLAYLIST_CTX_MENU_ITEM,1,"Add to playlist");
  addContextMenuItems(menu);
}
 

Example 82

From project SWE12-Drone, under directory /catroid/src/at/tugraz/ist/catroid/ui/.

Source file: ScriptActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  if (view.getId() == R.id.brick_list_view) {
    menu.setHeaderTitle(R.string.script_context_menu_title);
    if (adapter.getItem(listView.getTouchedListPosition()) instanceof Script) {
      scriptToEdit=(Script)adapter.getItem(listView.getTouchedListPosition());
      MenuInflater inflater=getMenuInflater();
      inflater.inflate(R.menu.script_menu,menu);
    }
  }
}
 

Example 83

From project TahoeLAFS-android, under directory /src/org/openintents/filemanager/.

Source file: FileManagerActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"bad menuInfo",e);
    return;
  }
  IconifiedTextListAdapter adapter=(IconifiedTextListAdapter)getListAdapter();
  if (adapter == null) {
    return;
  }
  IconifiedText it=(IconifiedText)adapter.getItem(info.position);
  menu.setHeaderTitle(it.getText());
  menu.setHeaderIcon(it.getIcon());
  File file=FileUtils.getFile(currentDirectory,it.getText());
  if (!file.isDirectory()) {
    if (mState == STATE_PICK_FILE) {
      menu.add(0,MENU_OPEN,0,R.string.menu_open);
    }
    menu.add(0,MENU_SEND,0,R.string.menu_send);
  }
  menu.add(0,MENU_MOVE,0,R.string.menu_move);
  if (!file.isDirectory()) {
    menu.add(0,MENU_COPY,0,R.string.menu_copy);
  }
  menu.add(0,MENU_RENAME,0,R.string.menu_rename);
  menu.add(0,MENU_DELETE,0,R.string.menu_delete);
  Uri data=Uri.fromFile(file);
  Intent intent=new Intent(null,data);
  String type=mMimeTypes.getMimeType(file.getName());
  intent.setDataAndType(data,type);
  menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE,0,0,new ComponentName(this,FileManagerActivity.class),null,intent,0,null);
}
 

Example 84

From project todo.txt-touch, under directory /src/com/todotxt/todotxttouch/.

Source file: TodoTxtTouch.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  MenuInflater inflater=getMenuInflater();
  AdapterView.AdapterContextMenuInfo menuInfoAdap=(AdapterView.AdapterContextMenuInfo)menuInfo;
  final int pos;
  if (m_pos != Constants.INVALID_POSITION) {
    pos=m_pos;
  }
 else {
    pos=menuInfoAdap.position;
  }
  final Task task=m_adapter.getItem(pos);
  if (task.isCompleted()) {
    inflater.inflate(R.menu.context_completed,menu);
  }
 else {
    addVariableMenuItems(menu,task);
    inflater.inflate(R.menu.main_long,menu);
  }
}
 

Example 85

From project UDJ-Android-Client, under directory /src/org/klnusbaum/udj/PullToRefresh/.

Source file: PullToRefreshListView.java

  15 
vote

public ContextMenuInfo getContextMenuInfo(){
  AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)super.getContextMenuInfo();
  AdapterView.AdapterContextMenuInfo copy=new AdapterContextMenuInfo(info.targetView,info.position,info.id);
  copy.position--;
  return copy;
}
 

Example 86

From project valence, under directory /src/com/cafbit/valence/.

Source file: ValenceActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  if (v.equals(modButton)) {
    menu.setHeaderTitle("Modifier keys");
    for (int i=0; i < RFBKeyEvent.MODIFIERS.length; i++) {
      SpecialKey key=RFBKeyEvent.MODIFIERS[i];
      menu.add(Menu.NONE,(1 << 16) | i,Menu.NONE,key.name);
    }
  }
 else   if (v.equals(keyButton)) {
    menu.setHeaderTitle("Special keys");
    for (int i=0; i < RFBKeyEvent.SPECIALS.length; i++) {
      SpecialKey key=RFBKeyEvent.SPECIALS[i];
      menu.add(Menu.NONE,(2 << 16) | i,Menu.NONE,key.name);
    }
  }
}
 

Example 87

From project vanilla, under directory /src/org/kreed/vanilla/.

Source file: LibraryPagerAdapter.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  View targetView=info.targetView;
  Intent intent=info.id == -1 ? createHeaderIntent(targetView) : mCurrentAdapter.createData(targetView);
  mActivity.onCreateContextMenu(menu,intent);
}
 

Example 88

From project Wake-Me-At, under directory /src/uk/co/spookypeanut/wake_me_at/.

Source file: WakeMeAt.java

  15 
vote

/** 
 * Create the context menu for the list items
 * @see android.app.Activity#onCreateContextMenu(android.view.ContextMenu,android.view.View,android.view.ContextMenu.ContextMenuInfo)
 */
@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  Log.d(LOG_NAME,"onCreateContextMenu");
  AdapterContextMenuInfo myInfo=(AdapterContextMenuInfo)menuInfo;
  if (mLocListAdapter.isNewLocItem(myInfo.position)) {
    Log.d(LOG_NAME,"This is the new location item");
    return;
  }
  long id=myInfo.id;
  menu.setHeaderTitle(db.getNick(id));
  menu.setHeaderIcon(R.drawable.icon);
  MenuInflater inflater=getMenuInflater();
  if (WakeMeAtService.serviceRunning && (id == mRowId)) {
    inflater.inflate(R.menu.mn_context_running_wake_me_at,menu);
  }
 else {
    inflater.inflate(R.menu.mn_context_wake_me_at,menu);
  }
}
 

Example 89

From project xinkvpn, under directory /main/src/activity/xink/vpn/.

Source file: VpnSettings.java

  15 
vote

@Override public void onCreateContextMenu(final ContextMenu menu,final View v,final ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  MenuInflater inflater=getMenuInflater();
  inflater.inflate(R.menu.vpn_list_context_menu,menu);
  AdapterContextMenuInfo info=(AdapterContextMenuInfo)menuInfo;
  VpnViewItem selectedVpnItem=getVpnViewItemAt(info.position);
  VpnProfile p=selectedVpnItem.profile;
  menu.setHeaderTitle(p.getName());
  boolean isIdle=p.getState() == VpnState.IDLE;
  menu.findItem(R.id.menu_edit_vpn).setEnabled(isIdle);
  menu.findItem(R.id.menu_del_vpn).setEnabled(isIdle);
}
 

Example 90

From project yammp, under directory /src/org/yammp/fragment/.

Source file: AlbumFragment.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo info){
  if (mCursor == null)   return;
  menu.add(hashCode(),PLAY_SELECTION,0,R.string.play_selection);
  menu.add(hashCode(),DELETE_ITEMS,0,R.string.delete_music);
  menu.add(hashCode(),DELETE_LYRICS,0,R.string.delete_lyrics);
  AdapterContextMenuInfo adapterinfo=(AdapterContextMenuInfo)info;
  mSelectedPosition=adapterinfo.position;
  mCursor.moveToPosition(mSelectedPosition);
  try {
    mSelectedId=mCursor.getLong(mIdIdx);
  }
 catch (  IllegalArgumentException ex) {
    mSelectedId=adapterinfo.id;
  }
  mCurrentArtistNameForAlbum=mCursor.getString(mArtistIdx);
  mCurrentAlbumName=mCursor.getString(mAlbumIdx);
  if (mCurrentAlbumName != null && !MediaStore.UNKNOWN_STRING.equals(mCurrentAlbumName)) {
    menu.add(hashCode(),SEARCH,0,android.R.string.search_go);
    menu.setHeaderTitle(mCurrentAlbumName);
  }
 else {
    menu.setHeaderTitle(R.string.unknown_album);
  }
}
 

Example 91

From project Yeno-Checklist, under directory /src/com/yeno/checklist/view/.

Source file: ChecklistActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,view,menuInfo);
  AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  Task selectedTask=(Task)adapter.getItem(info.position);
switch (selectedTask.getTaskState()) {
case DONE:
    menu.add(0,CONTEXT_MENU_BLANK,0,R.string.context_menu_blank);
  menu.add(0,CONTEXT_MENU_SKIPPED,0,R.string.context_menu_skipped);
menu.add(0,CONTEXT_MENU_PROBLEM,0,R.string.context_menu_problem);
break;
case SKIPPED:
menu.add(0,CONTEXT_MENU_BLANK,0,R.string.context_menu_blank);
menu.add(0,CONTEXT_MENU_DONE,0,R.string.context_menu_done);
menu.add(0,CONTEXT_MENU_PROBLEM,0,R.string.context_menu_problem);
break;
case PROBLEM:
menu.add(0,CONTEXT_MENU_BLANK,0,R.string.context_menu_blank);
menu.add(0,CONTEXT_MENU_DONE,0,R.string.context_menu_done);
menu.add(0,CONTEXT_MENU_SKIPPED,0,R.string.context_menu_skipped);
break;
default :
menu.add(0,CONTEXT_MENU_DONE,0,R.string.context_menu_done);
menu.add(0,CONTEXT_MENU_SKIPPED,0,R.string.context_menu_skipped);
menu.add(0,CONTEXT_MENU_PROBLEM,0,R.string.context_menu_problem);
break;
}
if (!TextUtils.isEmpty(selectedTask.getComment())) {
menu.add(0,CONTEXT_MENU_INFO,0,R.string.context_menu_info);
}
menu.add(0,CONTEXT_MENU_EDIT,0,R.string.context_menu_edit);
menu.add(0,CONTEXT_MENU_DELETE,0,R.string.context_menu_delete);
}
 

Example 92

From project zirco-browser, under directory /src/org/zirco/ui/activities/.

Source file: AdBlockerWhiteListActivity.java

  15 
vote

@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  long id=((AdapterContextMenuInfo)menuInfo).id;
  if (id != -1) {
    menu.setHeaderTitle(mDbAdapter.getWhiteListItemById(id));
  }
  menu.add(0,MENU_DELETE,0,R.string.Commons_Delete);
}