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.xabber.android.ui.helper.ContextMenuHelper.java

public static void createGroupContextMenu(final FragmentActivity activity, final UpdatableAdapter adapter,
        final String account, final String group, ContextMenu menu) {
    menu.setHeaderTitle(GroupManager.getInstance().getGroupName(account, group));
    if (!group.equals(GroupManager.ACTIVE_CHATS) && !group.equals(GroupManager.IS_ROOM)) {
        menu.add(R.string.group_rename).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {

            @Override//from   w  w w. jav a 2 s .co  m
            public boolean onMenuItemClick(MenuItem item) {
                GroupRenameDialogFragment
                        .newInstance(account.equals(GroupManager.NO_ACCOUNT) ? null : account,
                                group.equals(GroupManager.NO_GROUP) ? null : group)
                        .show(activity.getFragmentManager(), "GROUP_RENAME");
                return true;
            }
        });
        if (!group.equals(GroupManager.NO_GROUP)) {
            menu.add(R.string.group_remove).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {

                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    GroupDeleteDialogFragment
                            .newInstance(account.equals(GroupManager.NO_ACCOUNT) ? null : account, group)
                            .show(activity.getFragmentManager(), "GROUP_DELETE");
                    return true;
                }
            });
        }
    }
    if (!group.equals(GroupManager.ACTIVE_CHATS)) {
        menu.add(R.string.show_offline_settings)
                .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                    @Override
                    public boolean onMenuItemClick(MenuItem item) {
                        createOfflineContactsDialog(activity, adapter, account, group).show();
                        return true;
                    }
                });
    }
}

From source file:com.xabber.android.ui.helper.ContextMenuHelper.java

public static void createAccountContextMenu(final FragmentActivity activity, final UpdatableAdapter adapter,
        final String account, ContextMenu menu) {
    activity.getMenuInflater().inflate(R.menu.account, menu);
    menu.setHeaderTitle(AccountManager.getInstance().getVerboseName(account));

    setUpAccountMenu(activity, adapter, account, menu);
}

From source file:com.xabber.android.ui.helper.ContextMenuHelper.java

public static void createContactContextMenu(final FragmentActivity activity, final UpdatableAdapter adapter,
        AbstractContact abstractContact, ContextMenu menu) {
    final String account = abstractContact.getAccount();
    final String user = abstractContact.getUser();
    menu.setHeaderTitle(abstractContact.getName());
    MenuInflater inflater = activity.getMenuInflater();
    inflater.inflate(R.menu.contact_list_contact_context_menu, menu);

    setContactContextMenuActions(activity, adapter, menu, account, user);
    setContactContextMenuItemsVisibilty(abstractContact, menu, account, user);
}

From source file:org.mixare.MixListView.java

public static void createContextMenu(ImageView icon) {
    icon.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
        public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
            int index = 0;
            switch (ListItemAdapter.itemPosition) {
            case 0:
                menu.setHeaderTitle("Wiki Menu");
                menu.add(index, index, index, "We are working on it...");
                break;
            case 1:
                menu.setHeaderTitle("Twitter Menu");
                menu.add(index, index, index, "We are working on it...");
                break;
            case 2:
                menu.setHeaderTitle("Buzz Menu");
                menu.add(index, index, index, "We are working on it...");
                break;
            case 3:
                menu.setHeaderTitle("OpenStreetMap Menu");
                menu.add(index, index, index, "We are working on it...");
                break;
            case 4:
                AlertDialog.Builder alert = new AlertDialog.Builder(ctx);
                alert.setTitle("insert your own URL:");

                final EditText input = new EditText(ctx);
                input.setText(customizedURL);
                alert.setView(input);//from  w  w  w. j  ava2s.  c o m

                alert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        Editable value = input.getText();
                        customizedURL = "" + value;
                    }
                });
                alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.dismiss();
                    }
                });
                alert.show();
                break;
            }
        }
    });

}

From source file:test.red.house.DeviceFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.setHeaderTitle("Options");
    menu.add(0, v.getId(), 0, "Remove Device");

}

From source file:eu.trentorise.smartcampus.eb.fragments.CollectionsListFragment.java

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

From source file:com.may.ple.parking.gateway.activity.GateOutActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.setHeaderTitle("??");
    menu.add(0, 1, 0, "Ticket ");
    menu.add(0, 2, 1, "Ticket ??");
}

From source file:eu.trentorise.smartcampus.eb.fragments.ExperiencesListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
    menu.setHeaderTitle(R.string.exp_menu_header);
    android.view.MenuInflater inflater = getSherlockActivity().getMenuInflater();
    inflater.inflate(R.menu.exp_list_menu, menu);
    MenuItem item = menu.findItem(R.id.expmenu_share);
    if (item != null) {
        AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
        Experience exp = experiencesList.get(info.position);
        item.setEnabled(exp.getEntityId() > 0).setVisible(exp.getEntityId() > 0);
    }/* www  .  ja  va 2  s .c  o m*/
}

From source file:test.red.house.SensorFragment.java

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

    super.onCreateContextMenu(menu, v, menuInfo);
    menu.setHeaderTitle("Options");
    menu.add(1, v.getId(), 0, "Remove Sensor");

}

From source file:eu.trentorise.smartcampus.communicator.fragments.labels.LabelListFragment.java

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