Example usage for android.view ContextMenu setHeaderTitle

List of usage examples for android.view ContextMenu setHeaderTitle

Introduction

In this page you can find the example usage for android.view ContextMenu setHeaderTitle.

Prototype

public ContextMenu setHeaderTitle(CharSequence title);

Source Link

Document

Sets the context menu header's title to the title given in title.

Usage

From source file:com.sandklef.coachapp.fragments.TrainingPhasesFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    Log.d(LOG_TAG, "  onCreateContextMenu()");

    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    String word = ((TextView) info.targetView).getText().toString();
    long id = info.id;

    menu.setHeaderTitle("Select");
    try {//from  ww  w .  jav  a  2s .  co  m
        currentTPId = Storage.getInstance().getTrainingPhases().get((int) id).getUuid();
        menu.add(0, v.getId(), 0, "Create instruction video");
    } catch (StorageNoClubException e) {
        e.printStackTrace();
    }

}

From source file:net.lp.actionbarpoirot.helpers.ActivityHelper.java

/**
 * Set the title for the context menu.//from www  . jav  a2 s. c  o m
 * 
 * @param menu Menu that is shown.
 * @param title Title text to set.
 */
public void setContextTitle(ContextMenu menu, final String title) {
    // Setup the menu header
    menu.setHeaderTitle(title);
}

From source file:com.droidvnteam.hexagonrom.GestureAnywhereBuilderActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {

    super.onCreateContextMenu(menu, v, menuInfo);

    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    menu.setHeaderTitle(((TextView) info.targetView).getText());

    menu.add(0, MENU_ID_EDIT, 0, R.string.ga_gestures_edit);
    menu.add(0, MENU_ID_REMOVE, 0, R.string.ga_gestures_delete);
}

From source file:com.github.nutomic.pegasus.activities.AreaList.java

/**
 * Create context menu for ListView items. Modifiers are hidden for the
 * default area./*from ww w  .  j  av  a2s  .  c  o  m*/
 */
public void onCreateContextMenu(android.view.ContextMenu menu, View v,
        android.view.ContextMenu.ContextMenuInfo menuInfo) {
    getMenuInflater().inflate(R.menu.area_list_context, menu);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;

    String name = getAreaName(info);

    menu.setHeaderTitle(name);

    // Default area selected, can't rename, learn or delete.
    if (info.id == AreaColumns.AREA_DEFAULT) {
        menu.removeItem(R.id.rename);
        menu.removeItem(R.id.learn);
        menu.removeItem(R.id.delete);
    }
}

From source file:eu.trentorise.smartcampus.communicator.fragments.messages.AbstractMessageListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
    menu.setHeaderTitle(R.string.notice_options_header);
    android.view.MenuInflater inflater = getSherlockActivity().getMenuInflater();
    inflater.inflate(R.menu.notice_menu, menu);
}

From source file:com.meetingninja.csse.notes.NotesFragment.java

private void setupViews(View v) {
    // setup listview
    ListView lv = (ListView) v.findViewById(R.id.notesList);
    noteAdpt = new NoteArrayAdapter(getActivity(), R.layout.list_item_note, notes);
    lv.setAdapter(noteAdpt);/*from w  w  w  . ja v  a2  s  .  c o  m*/

    // pretty images are better than boring text
    notesImageButton = (ImageButton) v.findViewById(android.R.id.empty);
    lv.setEmptyView(notesImageButton);
    notesImageButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            createNote();
        }
    });

    // Item click event
    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parentAdapter, View v, int position, long id) {
            Note clickedNote = noteAdpt.getItem(position);

            Intent editNote = new Intent(getActivity(), ViewNoteActivity.class);
            editNote.putExtra("listPosition", position);
            editNote.putExtra(Keys.Note.PARCEL, clickedNote);
            startActivityForResult(editNote, 1);

        }
    });

    // make list long-pressable
    registerForContextMenu(lv);

    // Item long-click event
    // TODO: Add additional options and click-events to these options
    lv.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
        @Override
        public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
            AdapterContextMenuInfo aInfo = (AdapterContextMenuInfo) menuInfo;

            Note n = noteAdpt.getItem(aInfo.position);
            menu.setHeaderTitle("Options for " + "'" + n.getTitle().trim() + "'");
            menu.add(MainActivity.DrawerLabel.NOTES.getPosition(), aInfo.position, 1, "Add Content");
            menu.add(MainActivity.DrawerLabel.NOTES.getPosition(), aInfo.position, 2, "Delete");
            menu.add(MainActivity.DrawerLabel.NOTES.getPosition(), aInfo.position, 3, "Version Control");
            menu.add(MainActivity.DrawerLabel.NOTES.getPosition(), aInfo.position, 4, "Merge");
        }

    });
}

From source file:com.filepager.afilechooser.FileListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    // TODO Auto-generated method stub
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    FileListAdapter adapter = (FileListAdapter) getListView().getAdapter();
    if (adapter != null) {
        File file = (File) adapter.getItem(info.position);
        if (!file.isDirectory()) {
            menu.setHeaderTitle(R.string.select_action);
            menu.add(Menu.NONE, 0, 0, "Send file to " + fileChooserActivity.hostname);
            menu.add(Menu.NONE, 1, 1, "Open");

        }/*www . jav a2  s. co m*/

    }

    super.onCreateContextMenu(menu, v, menuInfo);
}

From source file:edu.stanford.mobisocial.dungbeetle.GroupsActivity.java

@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" };//, "Write to Tag" };
    for (int i = 0; i < menuItems.length; i++) {
        menu.add(Menu.NONE, i, i, menuItems[i]);
    }/*ww w.  java2 s  .c o m*/
}

From source file:org.microg.gms.ui.GcmRegisteredAppsFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    GcmData.AppInfo appInfo = appsAdapter.getItem(((AdapterView.AdapterContextMenuInfo) menuInfo).position);
    MenuInflater menuInflater = getActivity().getMenuInflater();
    menuInflater.inflate(R.menu.gcm_app, menu);

    PackageManager packageManager = getContext().getPackageManager();
    try {//from   w w w  .  j a va  2s  . co  m
        ApplicationInfo applicationInfo = packageManager.getApplicationInfo(appInfo.app, 0);
        menu.setHeaderTitle(packageManager.getApplicationLabel(applicationInfo));
    } catch (PackageManager.NameNotFoundException e) {
        menu.setHeaderTitle(appInfo.app);
    }
}

From source file:com.sandklef.coachapp.fragments.MemberFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    Log.d(LOG_TAG, "  onCreateContextMenu()");

    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    String word = ((TextView) info.targetView).getText().toString();
    long id = info.id;

    try {//  w  ww .  j a  va 2  s  .c om
        menu.setHeaderTitle("Select");
        String memberUuid = Storage.getInstance().getMembers().get((int) id).getUuid();

        contextMedia = MediaFilterEngine.apply(Storage.getInstance().getMedia(),
                MediaMemberFilter.newMediaMemberFilter(memberUuid));

        for (Media media : contextMedia) {
            Log.d(LOG_TAG, " * " + media.getUuid());
            menu.add(0, v.getId(), 0, CADateFormat.getDateString(media.getDate()));
        }
    } catch (StorageNoClubException e) {
        e.printStackTrace();
    }
}