Search in sources :

Example 1 with AvailableGPXFragment

use of net.osmand.plus.myplaces.AvailableGPXFragment in project Osmand by osmandapp.

the class OsmEditingPlugin method optionsMenuFragment.

@Override
public void optionsMenuFragment(final Activity activity, final Fragment fragment, ContextMenuAdapter optionsMenuAdapter) {
    if (fragment instanceof AvailableGPXFragment) {
        final AvailableGPXFragment f = ((AvailableGPXFragment) fragment);
        optionsMenuAdapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.local_index_mi_upload_gpx, activity).setIcon(R.drawable.ic_action_export).setColor(R.color.color_white).setListener(new ItemClickListener() {

            @Override
            public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
                f.openSelectionMode(R.string.local_index_mi_upload_gpx, R.drawable.ic_action_export, R.drawable.ic_action_export, new OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        List<GpxInfo> selectedItems = f.getSelectedItems();
                        sendGPXFiles(activity, f, selectedItems.toArray(new GpxInfo[selectedItems.size()]));
                    }
                });
                return true;
            }
        }).setPosition(5).createItem());
    }
}
Also used : ItemClickListener(net.osmand.plus.ContextMenuAdapter.ItemClickListener) ContextMenuItem(net.osmand.plus.ContextMenuItem) DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener) List(java.util.List) AvailableGPXFragment(net.osmand.plus.myplaces.AvailableGPXFragment) ArrayAdapter(android.widget.ArrayAdapter)

Aggregations

DialogInterface (android.content.DialogInterface)1 OnClickListener (android.content.DialogInterface.OnClickListener)1 ArrayAdapter (android.widget.ArrayAdapter)1 List (java.util.List)1 ItemClickListener (net.osmand.plus.ContextMenuAdapter.ItemClickListener)1 ContextMenuItem (net.osmand.plus.ContextMenuItem)1 AvailableGPXFragment (net.osmand.plus.myplaces.AvailableGPXFragment)1