From 210e8778ce82fb56e0fd683d04f69b6b7ee8a6ef Mon Sep 17 00:00:00 2001 From: Bananeweizen Date: Wed, 11 Jun 2014 21:22:06 +0200 Subject: new: make import/export top level menu items --- main/src/cgeo/geocaching/export/ExportFactory.java | 67 ---------------------- 1 file changed, 67 deletions(-) delete mode 100644 main/src/cgeo/geocaching/export/ExportFactory.java (limited to 'main/src/cgeo/geocaching/export/ExportFactory.java') diff --git a/main/src/cgeo/geocaching/export/ExportFactory.java b/main/src/cgeo/geocaching/export/ExportFactory.java deleted file mode 100644 index e743eb2..0000000 --- a/main/src/cgeo/geocaching/export/ExportFactory.java +++ /dev/null @@ -1,67 +0,0 @@ -package cgeo.geocaching.export; - -import cgeo.geocaching.Geocache; -import cgeo.geocaching.R; -import cgeo.geocaching.utils.Log; - -import android.app.Activity; -import android.app.AlertDialog; -import android.content.DialogInterface; -import android.widget.ArrayAdapter; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * Factory to create a dialog with all available exporters. - */ -public abstract class ExportFactory { - - /** - * Contains instances of all available exporter classes. - */ - private static final List> exporterClasses; - - static { - final ArrayList> temp = new ArrayList>(); - temp.add(FieldnoteExport.class); - temp.add(GpxExport.class); - exporterClasses = Collections.unmodifiableList(temp); - } - - /** - * Creates a dialog so that the user can select an exporter. - * - * @param caches - * The {@link List} of {@link cgeo.geocaching.Geocache} to be exported - * @param activity - * The {@link Activity} in whose context the dialog should be shown - */ - public static void showExportMenu(final List caches, final Activity activity) { - final AlertDialog.Builder builder = new AlertDialog.Builder(activity); - builder.setTitle(R.string.export).setIcon(R.drawable.ic_menu_share); - - final ArrayList export = new ArrayList(); - for (Class exporterClass : exporterClasses) { - try { - export.add(exporterClass.newInstance()); - } catch (Exception ex) { - Log.e("showExportMenu", ex); - } - } - - final ArrayAdapter adapter = new ArrayAdapter(activity, android.R.layout.select_dialog_item, export); - - builder.setAdapter(adapter, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int item) { - dialog.dismiss(); - final Export selectedExport = adapter.getItem(item); - selectedExport.export(caches, activity); - } - }); - - builder.create().show(); - } -} \ No newline at end of file -- cgit v1.1