aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/export/GpxExport.java
diff options
context:
space:
mode:
authorBananeweizen <Bananeweizen@gmx.de>2013-01-23 21:07:51 +0100
committerBananeweizen <Bananeweizen@gmx.de>2013-01-23 21:07:51 +0100
commit10f23bdcc058b7233b471aeefec73014cfb34a73 (patch)
treef6b846b109480f440ab817fb493ad3e3b37aadb3 /main/src/cgeo/geocaching/export/GpxExport.java
parent5432089c6edfe4df2c940dda3682a74e0e36deb1 (diff)
downloadcgeo-10f23bdcc058b7233b471aeefec73014cfb34a73.zip
cgeo-10f23bdcc058b7233b471aeefec73014cfb34a73.tar.gz
cgeo-10f23bdcc058b7233b471aeefec73014cfb34a73.tar.bz2
#1791: remove selfmade dialog button
Diffstat (limited to 'main/src/cgeo/geocaching/export/GpxExport.java')
-rw-r--r--main/src/cgeo/geocaching/export/GpxExport.java60
1 files changed, 29 insertions, 31 deletions
diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java
index a2d5be6..1cba79d 100644
--- a/main/src/cgeo/geocaching/export/GpxExport.java
+++ b/main/src/cgeo/geocaching/export/GpxExport.java
@@ -4,10 +4,10 @@ import cgeo.geocaching.LogEntry;
import cgeo.geocaching.R;
import cgeo.geocaching.Settings;
import cgeo.geocaching.Waypoint;
-import cgeo.geocaching.activity.ActivityMixin;
-import cgeo.geocaching.activity.Progress;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgData;
+import cgeo.geocaching.activity.ActivityMixin;
+import cgeo.geocaching.activity.Progress;
import cgeo.geocaching.enumerations.CacheAttribute;
import cgeo.geocaching.enumerations.LoadFlags;
import cgeo.geocaching.geopoint.Geopoint;
@@ -20,7 +20,9 @@ import org.xmlpull.v1.XmlSerializer;
import android.app.Activity;
import android.app.AlertDialog;
+import android.app.Dialog;
import android.app.ProgressDialog;
+import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
@@ -58,44 +60,40 @@ class GpxExport extends AbstractExport {
} else {
// Show configuration dialog
- new ExportOptionsDialog(caches, activity).show();
+ getExportDialog(caches, activity).show();
}
}
- /**
- * A dialog to allow the user to set options for the export.
- *
- * Currently available option is: opening of share menu after successful export
- */
- private class ExportOptionsDialog extends AlertDialog {
- public ExportOptionsDialog(final List<cgCache> caches, final Activity activity) {
- super(activity);
+ private Dialog getExportDialog(final List<cgCache> caches, final Activity activity) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(activity);
- View layout = activity.getLayoutInflater().inflate(R.layout.gpx_export_dialog, null);
- setView(layout);
+ View layout = activity.getLayoutInflater().inflate(R.layout.gpx_export_dialog, null);
+ builder.setView(layout);
- final TextView text = (TextView) layout.findViewById(R.id.info);
- text.setText(getString(R.string.export_gpx_info, Settings.getGpxExportDir()));
+ final TextView text = (TextView) layout.findViewById(R.id.info);
+ text.setText(getString(R.string.export_gpx_info, Settings.getGpxExportDir()));
- final CheckBox shareOption = (CheckBox) layout.findViewById(R.id.share);
+ final CheckBox shareOption = (CheckBox) layout.findViewById(R.id.share);
- shareOption.setChecked(Settings.getShareAfterExport());
+ shareOption.setChecked(Settings.getShareAfterExport());
- shareOption.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Settings.setShareAfterExport(shareOption.isChecked());
- }
- });
+ shareOption.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Settings.setShareAfterExport(shareOption.isChecked());
+ }
+ });
- layout.findViewById(R.id.export).setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- dismiss();
- new ExportTask(caches, activity).execute((Void) null);
- }
- });
- }
+ builder.setPositiveButton(R.string.export, new DialogInterface.OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ new ExportTask(caches, activity).execute((Void) null);
+ }
+ });
+
+ return builder.create();
}
private class ExportTask extends AsyncTask<Void, Integer, File> {